-
Notifications
You must be signed in to change notification settings - Fork 978
Running AVideo with Docker
Docker is a containerization technology that allows you to run applications in containers, which are lightweight, portable, and self-contained. In this tutorial, we will show you how to run AVideo using Docker.
AVideo, Encoder, and the live server will be installed, and the socket will be enabled as well.
To create a .env file with the parameters you listed, follow these steps:
Open a text editor (e.g. Notepad, Sublime Text, etc.).
Copy and paste the following lines into the text editor:
SERVER_NAME=localhost
SOCKET_PORT=2053
HTTP_PORT=80
HTTPS_PORT=443
NGINX_RTMP_PORT=1935
NGINX_HTTP_PORT=8080
NGINX_HTTPS_PORT=8443
DB_MYSQL_HOST=database
DB_MYSQL_PORT=3306
DB_MYSQL_NAME=avideo
DB_MYSQL_USER=avideo
DB_MYSQL_PASSWORD=avideo
Save the file with the name .env (Note that the file name starts with a period).
It is recommended to replace localhost with your own domain name in the SERVER_NAME variable in the .env file. This is because localhost refers to the local machine where the server is running, and it is not accessible from outside your own computer. If you want your website to be accessible from the internet, you need to use a domain name that points to your server's IP address.
To replace localhost with your own domain name, simply edit the .env file and replace localhost with your domain name. For example:
SERVER_NAME=example.com
Make sure to use your actual domain name instead of example.com. This will make your website accessible from the internet via your domain name.
Each parameter in the .env file corresponds to an environment variable used by the docker-compose file. Here is a brief description of each parameter:
- SOCKET_PORT: The port number used for the socket server. Defaults to 2053.
- HTTP_PORT: The port number used for HTTP traffic. Defaults to 80.
- HTTPS_PORT: The port number used for HTTPS traffic. Defaults to 443.
- NGINX_RTMP_PORT: The port number used for the RTMP server. Defaults to 1935.
- NGINX_HTTP_PORT: The port number used for the HTTP server. Defaults to 8080.
- NGINX_HTTPS_PORT: The port number used for the HTTPS server. Defaults to 8443.
- DB_MYSQL_HOST: The hostname or IP address of the MySQL database. Defaults to the database.
- DB_MYSQL_PORT: The port number used by the MySQL database. Defaults to 3306.
- DB_MYSQL_NAME: The name of the MySQL database. Defaults to avideo.
- DB_MYSQL_USER: The username used to connect to the MySQL database. Defaults to avideo.
- DB_MYSQL_PASSWORD: The password used to connect to the MySQL database. Defaults to avideo.
- SERVER_NAME: The hostname used for the server. Defaults to localhost.
- CREATE_TLS_CERTIFICATE: Specifies whether to create a TLS certificate or not. Defaults to yes.
- TLS_CERTIFICATE_FILE: The path to the TLS certificate file. Defaults to /etc/apache2/ssl/localhost.crt.
- TLS_CERTIFICATE_KEY: The path to the TLS certificate key. Defaults to /etc/apache2/ssl/localhost.key.
- CONTACT_EMAIL: The email address for the server administrator. Defaults to admin@localhost.
- SYSTEM_ADMIN_PASSWORD: The password for the system administrator. Defaults to password.
- WEBSITE_TITLE: The title of the website. Defaults to AVideo.
- MAIN_LANGUAGE: The main language used for the website. Defaults to en_US.
These parameters are used by the docker-compose file to configure the containers and their associated services. By placing these parameters in a .env file, you can easily modify the environment variables used by the containers without modifying the docker-compose file directly.
You may want to change the default ports of a project for several reasons, such as:
- Avoid conflicts with other applications: If you have other applications running on your machine that are using the same ports as the default ports of your project, you will need to change the default ports to avoid conflicts.
- Security reasons: Changing the default ports can also help increase the security of your application by making it harder for attackers to guess which ports are being used by your application. Some attackers may use port scanning techniques to identify open ports on a target machine, and changing the default ports can make it harder for them to identify the ports being used by your application.
- Compliance reasons: In some cases, you may need to change the default ports to comply with regulatory requirements or company policies. For example, your organization may have policies that require all web applications to use ports other than the default HTTP and HTTPS ports to reduce the risk of attacks.
Overall, changing the default ports of your project can help avoid conflicts, increase security, and comply with regulatory requirements or company policies.
2053: The port used for the socket server. 80: The port used for HTTP traffic. 443: The port used for HTTPS traffic. 1935: The port used for the RTMP server. 8080: The port used for the HTTP server. 8443: The port used for the HTTPS server.
To run this project, you should follow these steps:
- Open a terminal window and navigate to the directory where your AVideo directory is located. If you have any existing containers running from a previous run of docker-compose up, it's recommended to stop them first with the command docker-compose down.
- Run the
docker-compose up
command to start the containers defined in the docker-compose.yml file. - Wait for the containers to start and for the services to become available. You should see the output in your terminal showing the status of the various containers and services as they start up.
- Once the containers are running, you should be able to access the AVideo application by navigating to the SERVER_NAME you specified in your .env file in your web browser.
- Note that running
docker-compose up
will start the containers in the foreground, so you'll need to keep the terminal window open while the containers are running. If you want to run the containers in the background (i.e., detached mode), you can add the -d flag to thedocker-compose up
command.
docker-compose up -d
This command will start the AVideo container in detached mode, which means it will run in the background. The container will also be automatically restarted if it crashes or the server reboots.
For example, to start the containers in the background, you would run the command docker-compose up -d. To stop the containers running in the background, you can use the docker-compose stop command.
Also, note that when you run docker-compose up, Docker Compose will read the values of the environment variables from your .env file and pass them to the containers as environment variables. So it's important to make sure that your .env file is correctly configured before you run docker-compose up.
Once the AVideo container is running, you can access it by visiting your domain in a web browser. If everything is set up correctly, you should see the AVideo login page.
In this tutorial, you learned how to run AVideo using Docker. With Docker, you can easily deploy and manage AVideo on your server. If you encounter any issues, refer to the AVideo documentation or seek help from the AVideo community.
- Use multiple external encoders
- User Encoder Network
- Use multiple live servers