diff --git a/create-dev.sh b/create-dev.sh index 06e8c8f..ea47840 100644 --- a/create-dev.sh +++ b/create-dev.sh @@ -1,4 +1,41 @@ +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 +