Scripts for configuring and deploying environments on a dedicated Ubuntu server (AWS, DigitalOcean, etc.)
- Install Ubuntu LTS on your machine.
- Create DNS domain name records for the environments you need.
- Open the terminal by connecting via ssh or using the GUI, on behalf of a superuser or a user with superuser rights.
- Clone current repository.
git clone https://github.com/alignedcode/awesome-machine-deployment-scripts.git
- Go to the cloned directory and edit the environment configuration file
environment.config
cd awesome-machine-deployment-scripts
nano environment.config
For example, the set of domain names for 3 environments (production, staging, dev) can be as follows
DOMAINS=(
"acvod.alignedcode.com"
"acvod-staging.alignedcode.com"
"acvod-dev.alignedcode.com"
)
Depending on the project (Client application or Server application), set the port values.
Project type | Ports template |
---|---|
CLIENT | 808* |
SERVER | 800* |
For example, the set of ports for 3 environments (production, staging, dev) can be as follows
PROJECT_PORTS=(
"8082"
"8081"
"8080"
)
Warning
The order in which domain names and ports are declared is important. Each position in the array of domain names corresponds to a position in the array of ports
- Run the script run.sh with superuser (root) rights
sudo ./run.sh
If the command is not found, make the script an executable file
chmod u+x ./run.sh
sudo ./run.sh
Info
During the execution of the script, agree with everything, prescribing Y or simply pressing Enter
Combines the main scripts to run in the right order
- Creating configuration files for nginx
- Configuring an Ubuntu server using previously generated nginx configuration files
Based on the list of domain names and ports from the configuration file, generates two configuration files for nginx: for 80 and 443 ports (http and https)
To run only this one, use:
sudo ./generate-nginx-configs.sh
Performs the initial configuration of Ubuntu server
- Installs updates
- Configures the swap partition
- Setup and enable firewall
- Configures Nginx using previously generated configuration files and generates SSL certificates
- Installs docker
- Sets up a scheduled task to update SSL certificates
To run only this one, use:
sudo ./init-system.sh