Skip to content

huyfififi/mastodon-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains configuration files for running a Mastodon server at ocalaavenue.net. These configurations are based on those from the official Mastodon repository: mastodon/mastodon.

Certificate Renewal with Let's Encrypt

This setup uses webroot authentication, which allows certificate renewal without stopping the server. Certbot writes challenge files to /var/www/certbot, which nginx serves automatically.

Initial Setup

Before the first certificate issuance, create the webroot directory structure:

sudo mkdir -p /var/www/certbot/.well-known/acme-challenge
sudo chmod -R 755 /var/www/certbot

Initial Certificate Issuance

For the first time obtaining a certificate:

sudo certbot certonly --webroot -w /var/www/certbot -d ocalaavenue.net

Check the Current Certificate Status

sudo certbot certificates

Simulate a Renewal (Dry Run)

sudo certbot renew --dry-run

Renew the Certificates

sudo certbot renew

The renewal process will work automatically without stopping nginx or any other services. After renewal, you may need to reload nginx to use the new certificates:

docker compose exec nginx nginx -s reload

Or restart the nginx container:

docker compose restart nginx

Automatic Renewal

Certbot typically sets up automatic renewal via systemd timer or cron. To verify:

sudo systemctl status certbot.timer

Or check cron:

sudo crontab -l -u root | grep certbot

Automatic Nginx Reload After Renewal

To automatically reload nginx after certificate renewal (so you don't have to manually reload each time), create a post-renewal hook:

sudo mkdir -p /etc/letsencrypt/renewal-hooks/deploy
sudo tee /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh << 'EOF'
#!/bin/bash
docker compose -f /home/ubuntu/mastodon-docker-compose/compose.yaml exec -T nginx nginx -s reload
EOF
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh

This will automatically reload nginx whenever certbot successfully renews a certificate, ensuring the new certificate is used immediately without manual intervention.

Database Backup

docker exec db pg_dump -Fc -U postgres postgres > dumps/202604161211.dump

Server Specifications (ocalaavenue.net)

  • VPS: Amazon Lightsail (4 GB RAM, 2 vCPUs, 80 GB SSD)
  • Domain Name Registrar: Amazon Route 53
  • Object Storage: Amazon S3
  • Mail Server: Gmail (not working now)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors