项目作者: cubedserver

项目描述 :
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.
高级语言: Shell
项目地址: git://github.com/cubedserver/server-setup.git
创建时间: 2018-11-27T23:16:33Z
项目社区:https://github.com/cubedserver/server-setup

开源协议:MIT License

下载


Server Setup



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:

  • Definition of timezone
  • root user settings
  • Adds new default user for full privilege deploy
  • Install git, zip, unzip, curl, acl, docker
  • Adds github, gitlab and bitbucket to trusted hosts

Tested on a VPS running Ubuntu Server 22.04 LTS with 4GB RAM, but can be used in similar distributions.

Installation

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.

Installation

Basic installation with Docker in Swarm mode

  1. wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \
  2. --swarm-mode \
  3. --advertise-addr <Your Server IP Address>

Basic installation with NGINX as default

  1. wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \
  2. --proxy-template nginx \
  3. --app-templates mysql,postgres,redis,whoami,adminer,phpmyadmin,portainer \
  4. --domain example.com \
  5. --email email@example.com

Basic installation with TRAEFIK as default

  1. wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- \
  2. --proxy-template traefik \
  3. --app-templates mysql,postgres,redis,whoami,adminer,phpmyadmin,portainer \
  4. --domain example.com \
  5. --email email@example.com

Command options

You can get help by passing the -h option.

  1. Script for initial configurations of Docker, Docker Swarm, Docker Compose and Reverse Proxy.
  2. USAGE:
  3. wget -qO- https://raw.githubusercontent.com/cubedserver/server-setup/main/server-setup.sh | bash -s -- [OPTIONS]
  4. OPTIONS:
  5. -h|--help Print help
  6. -t|--timezone Standard system timezone
  7. --root-password New root user password. The script forces the password update
  8. --default-user Alternative user (with super powers) that will be used for deploys and remote access later
  9. --default-user-password
  10. --workdir Folder where all files of this setup will be stored
  11. --spaces Subfolders where applications will be allocated (eg. apps, backups)
  12. --root-ssh-passphrase Provides a passphrase for the ssh key
  13. --ssh-passphrase Provides a passphrase for the ssh key
  14. -f|--force Force install/re-install
  15. OPTIONS (Docker Swarm):
  16. -s|--swarm-mode Run Docker Engine in swarm mode
  17. --advertise-addr Advertised address (format: <ip|interface>[:port])
  18. OPTIONS (Proxy Settings):
  19. -b|--proxy-template Proxy templates to be installed. Currently traefik and nginx are available
  20. -a|--app-templates Additional applications that will be installed along with the proxy
  21. -d|--domain If you have configured your DNS and pointed A records to this host, this will be the domain used to access the services
  22. After everything is set up, you can access the services as follows: service.yourdomain.local
  23. -e|--email Email that Let's Encrypt will use to generate SSL certificates
  24. OPTIONS (Service Credentials):
  25. --mysql-password MySQL root password
  26. --postgres-password PostgreSQL password
  27. --redis-password Redis password
  28. --traefik-password Traefik admin password
  29. OPTIONS (Webhook):
  30. --webhook-url Ping URL with provisioning updates

Important

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.).

Tips

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.

  1. ssh-copy-id <USERNAME>@<SERVER IP>

Reverse Proxy

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:

Contributing

  1. Fork this repository!
  2. Create your feature from the develop branch: git checkout -b feature/my-new-feature
  3. Write and comment your code
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push the branch: git push origin feature/my-new-feature
  6. Make a pull request to the branch develop

Credits

License

Licensed under the MIT License.