Last active
November 19, 2018 12:28
-
-
Save foreseaz/17a5a0b545e5c364130a7fa8b49bc25f to your computer and use it in GitHub Desktop.
install_docker.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [email protected] | |
# domain=www.foreseaz.com | |
usage() { | |
echo "$0 <email> <domain>" | |
exit 1 | |
} | |
main() { | |
if [[ $# -ne 2 ]]; then | |
usage | |
fi | |
local email="${1:-noset}" | |
local domain="${2:-noset}" | |
echo "Email: $email Domain: $domain" | |
mkdir -p ./letsencrypt/www/${domain} | |
certbot certonly \ | |
--webroot \ | |
--config-dir "$(pwd)/letsencrypt/etc" \ | |
--logs-dir "$(pwd)/letsencrypt/log" \ | |
--work-dir "$(pwd)/letsencrypt/lib" \ | |
-m ${email} \ | |
-w ./letsencrypt/www/${domain} -d ${domain} | |
} | |
main "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
nginx: | |
image: nginx:stable-alpine | |
container_name: nginx | |
restart: always | |
expose: | |
- '80' | |
ports: | |
- '80:80' | |
- '443:443' | |
networks: | |
- default | |
- homepage_default | |
volumes: | |
- './servers/:/etc/nginx/conf.d/' | |
- './letsencrypt/www/:/var/www/letsencrypt/' | |
- './letsencrypt/etc/:/etc/certs/' | |
- '${HOME}/deploy/foreseaz:/var/www/foreseaz/' | |
networks: | |
homepage_default: | |
external: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSL Refer: https://gist.github.com/nrollr/9a39bb636a820fb97eec2ed85e473d38 | |
server { | |
listen 80; | |
server_name foreseaz.com; | |
location /.well-known/ { | |
root /var/www/letsencrypt/foreseaz.com; | |
} | |
location / { | |
return 301 https://$server_name$request_uri; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name foreseaz.com; | |
ssl_certificate /etc/certs/live/foreseaz.com/fullchain.pem; | |
ssl_certificate_key /etc/certs/live/foreseaz.com/privkey.pem; | |
location / { | |
root /var/www/foreseaz; | |
try_files $uri $uri/ /index.html; | |
} | |
location /static/ { | |
alias /var/www/foreseaz/static/; | |
gzip on; | |
gzip_min_length 1k; | |
gzip_buffers 4 16k; | |
gzip_types *; | |
gzip_comp_level 5; | |
gzip_vary off; | |
gzip_disable "MSIE [1-6]\."; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "[INSTALL] docker" | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo usermod -aG docker ubuntu | |
# install docker-compose | |
echo "[INSTALL] docker-compose" | |
export LC_ALL=C | |
sudo apt install python-pip | |
sudo pip install docker-compose | |
# post install | |
sudo groupadd docker | |
sudo gpasswd -a $USER docker | |
docker run hello-world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSL Refer: https://gist.github.com/nrollr/9a39bb636a820fb97eec2ed85e473d38 | |
server { | |
listen 80; | |
server_name www.foreseaz.com; | |
location /.well-known/ { | |
root /var/www/letsencrypt/www.foreseaz.com; | |
} | |
location / { | |
return 301 https://foreseaz.com$request_uri; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name www.foreseaz.com; | |
ssl_certificate /etc/certs/live/www.foreseaz.com/fullchain.pem; | |
ssl_certificate_key /etc/certs/live/www.foreseaz.com/privkey.pem; | |
location / { | |
return 301 https://foreseaz.com$request_uri; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment