Skip to content

Instantly share code, notes, and snippets.

@langhard
Last active July 23, 2019 18:21
Show Gist options
  • Save langhard/9945de1649a1cc80521b90bd62a1b091 to your computer and use it in GitHub Desktop.
Save langhard/9945de1649a1cc80521b90bd62a1b091 to your computer and use it in GitHub Desktop.
Invoiceninja behind a reverse-proxy with let's encrypt support and database backup (file backup is missing!)
version: '2'
services:
nginx:
restart: always
image: jwilder/nginx-proxy
container_name: nginx
ports:
- 80:80
- 443:443
volumes:
- ./volumes/proxy/conf.d:/etc/nginx/conf.d
- ./volumes/proxy/vhost.d:/etc/nginx/vhost.d
- ./volumes/proxy/html:/usr/share/nginx/html
- ./volumes/proxy/certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
letsencrypt-nginx-proxy-companion:
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-companion
depends_on: [nginx]
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./volumes/proxy/certs:/etc/nginx/certs:rw
invoiceninja-db:
restart: always
image: mysql
container_name: invoiceninja-db
environment:
MYSQL_DATABASE: ninja
MYSQL_ROOT_PASSWORD: ********
volumes:
- ./volumes/invoiceninja/db:/var/lib/mysql
ports:
- 3306:3306
invoiceninja-app:
restart: always
image: invoiceninja/invoiceninja
container_name: invoiceninja-app
links:
- invoiceninja-db:mysql
environment:
DB_USERNAME: root
DB_PASSWORD: ********
volumes:
- ./volumes/invoiceninja/app/public/logo:/var/www/app/public/logo
- ./volumes/invoiceninja/app/storage:/var/www/app/storage
- ./volumes/invoiceninja/app/.env:/var/www/app/.env
invoiceninja-web:
restart: always
image: nginx
container_name: invoiceninja-web
environment:
- VIRTUAL_HOST=domain.tld
- VIRTUAL_NETWORK=nginx-proxy
- LETSENCRYPT_HOST=domain.tld
- [email protected]
volumes:
- ./volumes/invoiceninja/web/nginx.conf:/etc/nginx/nginx.conf:ro
links:
- invoiceninja-app
volumes_from:
- invoiceninja-app
invoiceninja-cron:
restart: always
image: invoiceninja/invoiceninja
container_name: invoiceninja-cron
volumes_from:
- invoiceninja-app
links:
- invoiceninja-db:mysql
user: www-data
environment:
APP_DEBUG: 1
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 300s
while /bin/true; do
DB_USERNAME=root DB_PASSWORD=******** /usr/local/bin/php /var/www/app/artisan ninja:send-invoices
DB_USERNAME=root DB_PASSWORD=******** /usr/local/bin/php /var/www/app/artisan ninja:send-reminders
sleep 1d
done
EOF'
invoiceninja-backup-db:
restart: always
image: tutum/mysql-backup
container_name: invoiceninja-backup-db
volumes:
- ./volumes/invoiceninja/backup/db:/backup
links:
- invoiceninja-db:mysql
environment:
MYSQL_HOST: invoiceninja-db
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASS: ********
CRON_TIME: '0 0 * * *'
MAX_BACKUPS: 30
INIT_BACKUP: 'true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment