sveltekit-docker-nginx
                                
                                 sveltekit-docker-nginx copied to clipboard
                                
                                    sveltekit-docker-nginx copied to clipboard
                            
                            
                            
                        SvelteKit example project with local HMR + SSL using Docker + NGINX
 
SvelteKit-Docker-NGINX
This template allows you to have NGINX proxy requests to your SvelteKit app,
while keeping Hot Module Replacement (HMR) and SSL functional with your development environment.
Features
setup-server.sh
- Installs Docker/Compose dependencies and enables HTTP/HTTPS traffic
setup-ssl.sh
- This script allows production NGINX to start by creating the requisite dummy Certbot certificate, starting NGINX and finally replacing the dummy certificate with a live certificate. This prevents us from having to modify NGINX's production default.conf when deploying.
USE_POLLING/CHOKIDAR_USEPOLLING
- true- Windows development environment (fixes an issue with endless HMR reloads)
- false- Mac/Linux development environment
Usage
Development
- Create a private key and certificate using mkcert- 
mkcert -install -key-file local.key.pem -cert-file local.cert.pem localhost foo.local
- nginx/dev/local.cert.pem&- nginx/dev/local.key.pemneed to be created
- On Mac OS, add key to system keychains in Keychain Access
 
- 
Production
- Replace example.comwith your domain name in:- nginx/prod/default.conf
- setup-ssl.sh
 
- Replace [email protected]with your email address insetup-ssl.sh
- chmod +x setup-server.sh setup-ssl.sh
- sudo ./setup-server.sh
- sudo ./setup-ssl.sh
- docker compose up --build --force-recreate -d