scripts/create-dev.sh
2025-02-20 21:59:39 +00:00

52 lines
No EOL
1.1 KiB
Bash

DOMAIN=$1
## Install MicroK8s
# Check latest channel `snap info microk8s`
sudo snap install microk8s --classic --channel=1.32/stable
# Adding user to microk8s group missed here
# Enable modules
sudo microk8s enable dashboard
sudo microk8s enable ingress
## Install NGINX
sudo apt install -y nginx
# Install Certbot
sudo apt install -y certbot python3-certbot-nginx
# Setup nginx config
sudo sed -i "s/server_name _/server_name ${DOMAIN}/" /etc/nginx/sites-available/default
sudo systemctl reload nginx
sudo certbot --nginx -d ${DOMAIN}
# Apply proxy pass config
PROXY_PASS_CFG='\
proxy_set_header Host $host; \
proxy_pass http:\/\/127.0.0.1; \
proxy_set_header Connection ''; \
proxy_http_version 1.1; \
chunked_transfer_encoding off; \
proxy_buffering off; \
proxy_cache off; \
'
sudo sed -i "s/try_files \$uri \$uri\/ =404;/$PROXY_PASS_CFG/" /etc/nginx/sites-available/default
## Install Docker
# --
## Run standalone
# Run postgres
# Run redis
# Run rabbit