docker-compose for production

This commit is contained in:
Sam
2018-01-14 22:44:20 +01:00
parent 16f77b069e
commit 13487557e6
5 changed files with 58 additions and 49 deletions

View File

@@ -6,8 +6,6 @@ The easiest way to test Invoice Ninja with docker is by copying the example dire
To make your data persistent, you have to mount `/var/www/app/public/logo` and `/var/www/app/storage`.
All the supported environment variable can be found here https://github.com/invoiceninja/invoiceninja/blob/master/.env.example
### Usage
@@ -32,6 +30,12 @@ docker run -d
A list of environment variables can be found [here](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example)
### With docker-compose
A pretty ready to use docker-compose configuration can be found into [`./docker-compose`](https://github.com/invoiceninja/dockerfiles/tree/master/docker-compose).
Rename `.env.example` into `.env` and change the environment's variable as needed.
The file assume that all your persistent data is mounted from `/srv/invoiceninja/`.
### Know issue
Phantomjs doesn't work on linux alpine https://github.com/ariya/phantomjs/issues/14186

View File

@@ -1,6 +1,7 @@
MYSQL_DATABASE=ninja
MYSQL_ROOT_PASSWORD=pwd
APP_DEBUG=1
APP_DEBUG=0
APP_URL=http://localhost:8000
APP_KEY=SomeRandomStringSomeRandomString
APP_CIPHER=AES-256-CBC

View File

@@ -0,0 +1,49 @@
version: "2"
services:
db:
image: mysql
env_file: .env
restart: always
volumes:
- ./srv/invoiceninja/mysql:/var/lib/mysql
app:
image: invoiceninja/invoiceninja
links:
- db:mysql
env_file: .env
restart: always
volumes:
- ./srv/invoiceninja/storage:/var/www/app/storage:rw
- ./srv/invoiceninja/logo:/var/www/app/public/logo:rw
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- app
volumes_from:
- app
ports:
- 8000:80
cron:
image: invoiceninja/invoiceninja
links:
- db:mysql
env_file: .env
volumes_from:
- app
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 300s
while /bin/true; do
./artisan ninja:send-invoices
./artisan ninja:send-reminders
sleep 1h
done
EOF'

View File

@@ -1,45 +0,0 @@
version: "2"
services:
db:
image: mysql
environment:
MYSQL_DATABASE: ninja
MYSQL_ROOT_PASSWORD: pwd
volumes:
- ./var/mysql:/var/lib/mysql
app:
image: invoiceninja/invoiceninja
links:
- db:mysql
env_file: .env
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- app
volumes_from:
- app
ports:
- 8000:80
# cron:
# image: invoiceninja/invoiceninja
# links:
# - db:mysql
# env_file: .env
# volumes_from:
# - app
# entrypoint: |
# bash -c 'bash -s <<EOF
# trap "break;exit" SIGHUP SIGINT SIGTERM
# sleep 300s
# while /bin/true; do
# /usr/local/bin/php /var/www/app/artisan ninja:send-invoices
# /usr/local/bin/php /var/www/app/artisan ninja:send-reminders
# sleep 1d
# done
# EOF'