# Installing Streamwell

Before you begin, make sure your server meets the [requirements](https://docs.streamwell.net/streamwell-v1.3.5/getting-started/system-requirements) and has a static (fixed) IP address on your network. If you plan to share video over the internet, you should have the correct ports forwarded to the server from your router - and ideally, a domain name already pointed to the public IP of your router (examples [here](https://docs.streamwell.net/streamwell-v1.3.5/help-and-support/examples-and-tips)).\
\
For ease of deployment, Streamwell works with [**Docker**](https://www.docker.com). This lets you deploy or update Streamwell on any hardware or virtual machine, in seconds. Docker can be installed on your platform of choice for free at [www.docker.com](http://www.docker.com).

Once Docker is installed and running, hit the command prompt or terminal and *pull* the latest available docker image:

`docker pull beamwell/streamwell:latest`

Create or mount directories to hold your SSL certificate, recordings, logs and uploaded files. By storing these outside of the Docker container we are about to create, we can freely update it without fear of losing them:

`mkdir ssl rec log files`

Now, let's run the container (see [below](#what-do-these-commands-mean) for further explanation and more options)

Linux:

`docker run -d --name Streamwell --restart always -e SYSTEM_KEY="yourSecretKey" --network host -v ~/ssl:/etc/letsencrypt -v ~/rec:/rec -v ~/log:/log -v ~/files:/files beamwell/streamwell:latest`

Windows and macOS:

`docker run -d --name Streamwell --restart always -e SYSTEM_KEY="yourSecretKey" -p 80:80 -p 443:443 -p 1935:1935 -p 1936:1936 -p 3333:3333 -p 3334:3334 -p 8000:8000 -p 8081:8081 -p 9999:9999/udp -p 10010:10010 -p 10010:10010/udp -v /path/to/ssl:/etc/letsencrypt -v /path/to/rec:/rec -v /path/to/log:/log -v /path/to/files:/files beamwell/streamwell:latest`\
\
After a few seconds, you should be ready to say "[Hello World](https://docs.streamwell.net/streamwell-v1.3.5/getting-started/hello-world)" to your new Streamwell server 😎

### **What do these commands mean?**

`docker pull` = downloads the application image and version specified (e.g. mycompany/myapp:version).

`docker run -d  --name Streamwell` *=* runs a detached container (so we can close the terminal) and calls it Streamwell

`--restart always` *=* If the container crashes or is rebooted due to a power failure / system restart, it will automatically restart itself

`-e` = Environment Variables.  Here are the available options:

*STRONGLY RECOMMENDED:* Pass a ‘**SYSTEM\_KEY**’ and we’ll use that as the encryption key inside the application, to secure your links and stream keys. If you don’t pass a key in, one will be created for you and printed a single time in the startup logs (use *docker container logs Streamwell* to view those logs).

*OPTIONAL:* Pass a '**STREAMWELL\_DOMAIN\_NAME**' and '**STREAMWELL\_DOMAIN\_EMAIL**', and Streamwell will automatically configure HTTPS for your server, assuming it is reachable over the internet at that domain name. You might choose to omit these on the first run and configure them later in the web interface.

*OPTIONAL:* Pass environment variables to customize which ports are used for the various protocols: ***HTTP\_PORT, HTTPS\_PORT*****,&#x20;*****WS\_PORT, WSS\_PORT, RTMP\_PORT, RTMPS\_PORT, HLS\_PORT, API\_PORT, SRT\_PORT, DATA\_PORT***. The web server always runs within the container on the standard ports 80 / 443, but you can pass *HTTP(S)\_PORT* variables and map different ports to serve the web client interface if required, e.g. `-p 8080:80 -p 8443:443 -e HTTP_PORT=8080 -e HTTPS_PORT=8443`

*OPTIONAL*: "***UPLOAD\_MB\_LIMIT"*** sets the maximum file upload size in megabytes (e.g. UPLOAD\_MB\_LIMIT=512). The default is 256. The maximum is 1024.

OPTIONAL: "***TZ"*** overrides the default internal timezone setting of 'UTC' - see [Timezone Configuration](https://docs.streamwell.net/streamwell-v1.3.5/more-information/advanced-configuration#timezone-configuration) for more details.

`-p` = Connect this port from the outside world to the container. On Linux hosts, you don’t need to do this. Instead you can use the argument *--network host* in your command. Or connect the ports manually if you prefer.

*`-v`* = Connect this folder from the computer running Docker to the container

The -v flag is particularly useful since that lets you house things like file uploads, recordings, logs, certificates and more on the host server rather than in the running container. So when you need to update the application it is as simple as replacing the running container with one run from an updated image. While not absolutely required, you should create these directories on your server for data persistence outside of the Docker container:

*-v /your/path/to/SSL:/etc/letsencrypt*

*-v /your/path/to/LOGS:/log*

*-v /your/path/to/RECORDINGS:/rec*

*-v /your/path/to/FILES:/files*

BEST PRACTICE: Once you figure out the run command for your system, tuck it away somewhere so you can easily re-deploy whenever you [Update Streamwell](https://docs.streamwell.net/streamwell-v1.3.5/help-and-support/how-to-update)<br>
