Compare commits

...

6 Commits

Author SHA1 Message Date
David Bomba
0d93596cde Update README.md 2021-03-05 20:44:54 +11:00
=
10aaf3fb6e Set auto DB backups to optin by default 2021-03-03 16:48:54 +11:00
David Bomba
8117d0c5bd Merge pull request #291 from danielgroen/master
auto db backup script
2021-03-03 16:46:13 +11:00
danielgroen
fef92891cb auto db backup script 2021-03-02 13:05:12 +01:00
David Bomba
7f415803fb Merge pull request #286 from invoiceninja/revert-284-dotenv_improvements
Revert "got all the vars onto the dotenv file"
2021-02-11 16:04:19 +11:00
David Bomba
1caa8c7e70 Revert "got all the vars onto the dotenv file" 2021-02-11 16:04:11 +11:00
6 changed files with 74 additions and 36 deletions

5
.gitignore vendored
View File

@@ -1,5 +0,0 @@
*.sql
# docker/*
.env
!.env.example

View File

@@ -11,6 +11,10 @@
:hammer: Fully production-ready through docker-compose
:pencil: Adjustable to your needs via environment variable
## You want some Kubernetes + Helm with that?
[Helm Chat](https://github.com/Saddamus/invoiceninja-helm) by @Saddamus
[Kubernetes](https://github.com/invoiceninja/dockerfiles/issues/94) by @spacepluk
## Quickstart V5 Launch
The dockerfile has been revamped to make is easier to get started, by default the base image selected in 5 which will pull in the latest v5 stable image.

10
config/mysql/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM mysql:5
ENV force_color_prompt yes
RUN apt-get update;
RUN apt-get install -y cron;
ENTRYPOINT \
service cron start; \
printenv | grep -v "no_proxy" >> /etc/environment; \
docker-entrypoint.sh mysqld

View File

@@ -0,0 +1,28 @@
#!/bin/sh
FREQUENTY=`basename "$0"`
TIMESTAMP=$(date +"%Y-%m-%d")
case $FREQUENTY in
daily)
DAYS=6
;;
weekly)
DAYS=30
find /backups -type f -name $TIMESTAMP-daily.sql.gz -delete
;;
monthly)
DAYS=122
find /backups -type f -name $TIMESTAMP-weekly.sql.gz -delete
;;
esac
mysqldump -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} | gzip > /backups/$TIMESTAMP-$FREQUENTY.sql.gz
# Remove old backups
find /backups -mtime +${DAYS} -type f -name *-$FREQUENTY.sql.gz -delete
exit 0;

View File

@@ -1,10 +1,10 @@
version: "3.7"
version: '3.7'
services:
server:
image: nginx
restart: always
env_file: .env
env_file: env
volumes:
# Vhost configuration
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
@@ -15,17 +15,17 @@ services:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
ports:
- ${PORT}:80
#- "443:443"
ports:
- "80:80"
#- "443:443"
networks:
- invoiceninja
extra_hosts:
- "${CNAME}:192.168.0.124 " #host and ip
- "in5.localhost:192.168.0.124 " #host and ip
app:
image: invoiceninja/invoiceninja:5
env_file: .env
env_file: env
restart: always
volumes:
- ./config/hosts:/etc/hosts:ro
@@ -34,40 +34,44 @@ services:
- ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on:
- db
networks:
- invoiceninja
networks:
- invoiceninja
extra_hosts:
- "${CNAME}:192.168.0.124 " #host and ip
- "in5.localhost:192.168.0.124 " #host and ip
db:
image: mysql:5
env_file: .env
# For auto DB backups comment out image and use the build block below
# build:
# context: ./config/mysql
ports:
- "3305:3306"
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD1} # config for 5
- MYSQL_USER=${DB_USERNAME1}
- MYSQL_PASSWORD=${DB_PASSWORD1}
- MYSQL_DATABASE=${DB_DATABASE1}
# - MYSQL_ROOT_PASSWORD=${DB_PASSWORD} # config for 4
# - MYSQL_USER=${DB_USERNAME}
# - MYSQL_PASSWORD=${DB_PASSWORD}
# - MYSQL_DATABASE=${DB_DATABASE}
environment:
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=ninja
volumes:
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
# remove comments for next 4 lines if you want auto sql backups
#- ./docker/mysql/bak:/backups:rw
#- ./config/mysql/backup-script:/etc/cron.daily/daily:ro
#- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro
#- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro
networks:
- invoiceninja
extra_hosts:
- "${CNAME}:192.168.0.124 " #host and ip
- "in5.localhost:192.168.0.124 " #host and ip
# THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
# cron:
# image: invoiceninja/invoiceninja:alpine-4
# volumes:
# - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
# - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
# - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
# - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
# entrypoint: |
# /bin/sh -c 'sh -s <<EOF
# trap "break;exit" SIGHUP SIGINT SIGTERM
@@ -80,7 +84,7 @@ services:
# EOF'
# networks:
# - invoiceninja
#
#
networks:
invoiceninja:
invoiceninja:

View File

@@ -1,7 +1,4 @@
APP_URL=http://${CNAME}:${port}
PORT=8003
CNAME=in.localhost
APP_URL=http://in.localhost:8003/
APP_KEY=<insert your generated key in here>
APP_DEBUG=true
MULTI_DB_ENABLED=false
@@ -19,4 +16,4 @@ DB_HOST=db
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja
APP_CIPHER=AES-256-CBC
APP_CIPHER=AES-256-CBC