Script to make initial configurations of Docker, Docker Swarm, Docker Compose and Reverse Proxy (Traefik or NGINX) on servers in Digital Ocean, Linone, AWS EC2 or similar.
Script to make initial configurations of Docker, Docker Swarm and Reverse Proxy (Traefik or NGINX) on servers in Digital Ocean, Linone, AWS EC2 or similar.
Performs the following configuration steps:
Tested on a VPS running Ubuntu Server 22.04 LTS with 4GB RAM, but can be used in similar distributions.
To do the setup, download and run the script server-setup.sh or if you prefer (proceed at your own risk), execute the instruction below.
Basic installation with Docker in Swarm mode
wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \--swarm-mode \--advertise-addr <Your Server IP Address>
Basic installation with NGINX as default
wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \--proxy-template nginx \--app-templates mysql,postgres,redis,whoami,adminer,phpmyadmin,portainer \--domain example.com \--email email@example.com
Basic installation with TRAEFIK as default
wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \--proxy-template traefik \--app-templates mysql,postgres,redis,whoami,adminer,phpmyadmin,portainer \--domain example.com \--email email@example.com
You can get help by passing the -h option.
Script for initial configurations of Docker, Docker Swarm, Docker Compose and Reverse Proxy.USAGE:wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- [OPTIONS]OPTIONS:-h|--help Print help-t|--timezone Standard system timezone--root-password New root user password. The script forces the password update--default-user Alternative user (with super powers) that will be used for deploys and remote access later--default-user-password--workdir Folder where all files of this setup will be stored--spaces Subfolders where applications will be allocated (eg. apps, backups)--root-ssh-passphrase Provides a passphrase for the ssh key--ssh-passphrase Provides a passphrase for the ssh key-f|--force Force install/re-installOPTIONS (Docker Swarm):-s|--swarm-mode Run Docker Engine in swarm mode--advertise-addr Advertised address (format: <ip|interface>[:port])OPTIONS (Proxy Settings):-b|--proxy-template Proxy templates to be installed. Currently traefik and nginx are available-a|--app-templates Additional applications that will be installed along with the proxy-d|--domain If you have configured your DNS and pointed A records to this host, this will be the domain used to access the servicesAfter everything is set up, you can access the services as follows: service.yourdomain.local-e|--email Email that Let's Encrypt will use to generate SSL certificatesOPTIONS (Service Credentials):--mysql-password MySQL root password--postgres-password PostgreSQL password--redis-password Redis password--traefik-password Traefik admin passwordOPTIONS (Webhook):--webhook-url Ping URL with provisioning updates
In order for you to be able to deploy applications using git and some deployment tools such as the deployer, you will need to add the public key (id_rsa.pub) of the user created on your VCS server (bitbucket, gitlab, github, etc.).
To not have to enter the password every time you need to access the remote server by SSH or have to do some deploy, type the command below. This will add your public key to the new user’s authorized_keys file.
ssh-copy-id <USERNAME>@<SERVER IP>
If you are looking for a template for fast configuration of docker containers for reverse proxy, automatic configuration of virtualhosts and generation of SSL certificates with Let’s Encrypt, see the repositories:
git commit -am 'Add some feature'git push origin feature/my-new-featureLicensed under the MIT License.