Easy starter kit to jumpstart your bun project with https enabled.
- Docker
- Docker Compose can be be
docker compose
ordocker-compose
- A domain name with a record pointing to your server's public IP address, can be a subdomain or a root domain.
- Ports 80 and 443 open on your server.
- Clone the repository
- Create a
.env
file based on the.env.example
file, add your domain name, email address and project name. - Run
docker-compose up -d
- Open your browser and open
https://your-domain-name.com
The docker-compose.yml
file defines four services: bun
, nginx
, certbot
, and cron
.
- The
bun
service is a simple bun server that listens on port 3000. - The
nginx
service first usesnginx/nginx-templates/nginx.conf.template
that opens port 80 and allowscertobot
to verify the domain ownership. After the certificate is issued, thenginx
service detects the certificate files and switches tonginx/nginx-templates/nginx.conf.bkp
that opens port 443 and serves the bun server. - The
certbot
service will issue a certificate using the provided domain name and email address. - The
cron
service will try to renew the certificate every month.
- If you encounter any issues, please check the logs of the services using
docker-compose logs -f <service-name>
. - If the
docker-compose
command fails, try replacing it withdocker compose
. - If you have troubles with the
certbot
service add--staging
to thecertbot
command in thedocker-compose.yml
file to use the staging environment and avoid rate limits.