mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-01 20:17:26 +01:00
Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c3237d3b9 | ||
|
|
e29f786b34 | ||
|
|
bfc5625687 | ||
|
|
4b5abbbd5e | ||
|
|
a12f18836a | ||
|
|
d59d534ac5 | ||
|
|
35d9ee80b7 | ||
|
|
115b997cab | ||
|
|
8ca8e459be | ||
|
|
15625f41f9 | ||
|
|
9dc1fec1fb | ||
|
|
2342fd8cbb | ||
|
|
ae1f8fcecb | ||
|
|
6528ef7162 | ||
|
|
2f6b5ea55e | ||
|
|
7c1ef82a09 | ||
|
|
98846729e6 | ||
|
|
f03860d8ea | ||
|
|
c624f6ed40 | ||
|
|
c94145edca | ||
|
|
ff2c813355 | ||
|
|
e0cf941736 | ||
|
|
b1d65a8ac9 | ||
|
|
e6ad0c58ee | ||
|
|
11b99e7970 | ||
|
|
5fa605cba4 | ||
|
|
388f1a75b9 | ||
|
|
253c3339cf | ||
|
|
d67fa3059a | ||
|
|
98e41ad73b | ||
|
|
14c597312e | ||
|
|
af77440555 | ||
|
|
9377777f62 | ||
|
|
ac7c520620 | ||
|
|
1ae79cde4f | ||
|
|
a58b89c55d | ||
|
|
89e6cffa90 | ||
|
|
a82d60b4f5 | ||
|
|
32c93eb4d7 | ||
|
|
9e603ba79f | ||
|
|
d9889fcfaa | ||
|
|
a89e145bf9 | ||
|
|
85d46e8968 | ||
|
|
0fb5fa73e0 | ||
|
|
de3a2e4278 | ||
|
|
bb514e8d06 | ||
|
|
2034c6ebff | ||
|
|
65e36505a3 | ||
|
|
03c1e32123 | ||
|
|
3612c87323 | ||
|
|
4e9731a23e | ||
|
|
dea442c442 | ||
|
|
a24c1b98a3 | ||
|
|
1596478724 | ||
|
|
a240fd2977 | ||
|
|
7c1ef67755 | ||
|
|
bfc1d7add8 | ||
|
|
111f5a7e4e | ||
|
|
330f3e1c0e | ||
|
|
baeb925d87 | ||
|
|
079a05bbd8 | ||
|
|
8e995aa2ef | ||
|
|
dee4d0f27d | ||
|
|
60e5a68e01 | ||
|
|
67ad43d05d | ||
|
|
35beefba60 | ||
|
|
d1309cc86f | ||
|
|
a1d9220506 | ||
|
|
386359a346 | ||
|
|
b503418904 | ||
|
|
450eaf16e3 | ||
|
|
1f65c9f7f6 | ||
|
|
c02bf7bd03 | ||
|
|
4111fa87c9 | ||
|
|
0d5a7671ba | ||
|
|
7ea6e7c48e | ||
|
|
27e1788e91 | ||
|
|
d24a69ec39 | ||
|
|
8384175465 | ||
|
|
f8c442ec5f | ||
|
|
05f89f064e | ||
|
|
902745ec5a | ||
|
|
4efba38ce5 | ||
|
|
a184cf2844 | ||
|
|
94e8be57e5 | ||
|
|
385a434833 | ||
|
|
9ddeda4c32 | ||
|
|
805e526fc9 | ||
|
|
cdc35aff2f | ||
|
|
1de16ab390 | ||
|
|
b9ab50800d | ||
|
|
d2d03b9b18 | ||
|
|
ea0f3fa981 | ||
|
|
1d9a8681b2 | ||
|
|
f98b3915bd | ||
|
|
8762276c6f | ||
|
|
afcd9389ed | ||
|
|
591c799864 | ||
|
|
4c9c5ddd95 | ||
|
|
994d75a07e | ||
|
|
3348a2beb6 | ||
|
|
c30cae4a99 | ||
|
|
1ed95cdcec | ||
|
|
94126385e2 | ||
|
|
e64dd79cfc | ||
|
|
5942c1c362 | ||
|
|
78b5e59cd5 | ||
|
|
d1a8922f7d | ||
|
|
d87e5948bf | ||
|
|
f4cade9fac | ||
|
|
49f4266418 | ||
|
|
e7f6ef4c35 | ||
|
|
1af469cf04 | ||
|
|
2d934fd703 | ||
|
|
a7668325e8 | ||
|
|
7aef08794b | ||
|
|
001c922e45 | ||
|
|
85161446e9 | ||
|
|
14c0fd89eb | ||
|
|
7b08926961 | ||
|
|
a5e41d3072 | ||
|
|
72e07679eb |
6
.github/workflows/build_push.yml
vendored
6
.github/workflows/build_push.yml
vendored
@@ -31,11 +31,5 @@ jobs:
|
||||
- name: Push alpine-based image - v4
|
||||
run: make push-alpine TAG="${{steps.vars.outputs.tag}}"
|
||||
|
||||
- name: Build image from debian - v4
|
||||
run: make build-debian TAG="${{steps.vars.outputs.tag}}"
|
||||
|
||||
- name: Push debian-based image - v4
|
||||
run: make push-debian TAG="${{steps.vars.outputs.tag}}"
|
||||
|
||||
- name: Logout from DockerHub
|
||||
run: docker logout
|
||||
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at contact@invoiceninja.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
42
Makefile
42
Makefile
@@ -11,6 +11,9 @@ IMAGE="invoiceninja"
|
||||
# Check if v5 tag is passed, so that a v5 version should be built
|
||||
IS_V5=$(shell echo ${TAG} | egrep ^5)
|
||||
|
||||
# Version of Invoice Ninja. As the tag can be something like 5.0.4-p1, the version is 5.0.4.
|
||||
# This supports changes to the Dockerfiles with always the same Invoice Ninja version
|
||||
VERSION=$(shell echo ${TAG} | sed "s/-.*//")
|
||||
|
||||
# Building docker images based on alpine.
|
||||
# Assigned tags:
|
||||
@@ -19,10 +22,10 @@ IS_V5=$(shell echo ${TAG} | egrep ^5)
|
||||
.PHONY: build-alpine
|
||||
build-alpine:
|
||||
ifeq ($(IS_V5),)
|
||||
$(info Make: Building "$(TAG)" tagged images from alpine.)
|
||||
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile .
|
||||
$(info Make: Building "$(VERSION)" tagged images from alpine.)
|
||||
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile .
|
||||
# Tag as alpine-4
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} ${HUB_NAMESPACE}/${IMAGE}:alpine-4
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${HUB_NAMESPACE}/${IMAGE}:alpine-4
|
||||
$(info Make: Done.)
|
||||
endif
|
||||
|
||||
@@ -30,7 +33,7 @@ endif
|
||||
push-alpine:
|
||||
ifeq ($(IS_V5),)
|
||||
$(info Make: Pushing tagged images from alpine.)
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG}
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION}
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-4
|
||||
$(info Make: Done.)
|
||||
endif
|
||||
@@ -38,10 +41,10 @@ endif
|
||||
.PHONY: build-alpine-v5
|
||||
build-alpine-v5:
|
||||
ifneq ($(IS_V5),)
|
||||
$(info Make: Building "$(TAG)" tagged images from alpine.)
|
||||
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile_v5 .
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:5
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:latest
|
||||
$(info Make: Building "$(VERSION)" tagged images from alpine.)
|
||||
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile_v5 .
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:5
|
||||
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:latest
|
||||
$(info Make: Done.)
|
||||
endif
|
||||
|
||||
@@ -49,28 +52,7 @@ endif
|
||||
push-alpine-v5:
|
||||
ifneq ($(IS_V5),)
|
||||
$(info Make: Pushing tagged images from alpine.)
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG}
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:${VERSION}
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:5
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
|
||||
endif
|
||||
|
||||
# Building docker images based on debian.
|
||||
# Assigned tags:
|
||||
# - :latest
|
||||
# - :<RELEASE VERSION>
|
||||
.PHONY: build-debian
|
||||
build-debian:
|
||||
ifeq ($(IS_V5),)
|
||||
$(info Make: Building "$(TAG)" tagged images from debian.)
|
||||
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./debian/Dockerfile .
|
||||
$(info Make: Done.)
|
||||
endif
|
||||
|
||||
.PHONY: push-debian
|
||||
push-debian:
|
||||
ifeq ($(IS_V5),)
|
||||
$(info Make: Pushing tagged images from debian.)
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG}
|
||||
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
|
||||
$(info Make: Done.)
|
||||
endif
|
||||
181
README.md
181
README.md
@@ -4,181 +4,72 @@
|
||||
|
||||
# Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
||||
|
||||
:bulb: Please consider posting your question on [StackOverflow](https://stackoverflow.com/) as this widens the audience that can help you. Just use the tag `invoice-ninja` and we are there to help. This is mostly related to the usage of Invoice Ninja and the docker setup.
|
||||
If you feel your question is directly related to a code change or you want to sent in a change + PR Github is the right place, of course.
|
||||
|
||||
:crown: **Features**
|
||||
|
||||
:lock: Automatic HTTPS (:heart: [Caddy](https://caddyserver.com/))
|
||||
:fire: NGINX webserver support [NGINX](https://nginx.org/)
|
||||
:hammer: Fully production-ready through docker-compose
|
||||
:pencil: Adjustable to your needs via environment variable
|
||||
|
||||
## Quickstart V5 Launch
|
||||
|
||||
## Prerequisites
|
||||
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.
|
||||
|
||||
### Generate an application key
|
||||
```
|
||||
git clone https://github.com/invoiceninja/dockerfiles.git
|
||||
cd dockerfiles
|
||||
```
|
||||
|
||||
Before starting Invoice Ninja via Docker make sure you generate a valid application key. If you are not sure what an application key is, please visit [this blog post](https://tighten.co/blog/app-key-and-you/).
|
||||
Instead of defining our environment variables inside our docker-compose.yml file we now define this in the ```env``` file, open this file up and insert your APP_URL and your APP_KEY
|
||||
|
||||
To generate an application just run
|
||||
```
|
||||
APP_URL=http://in.localhost:8003/
|
||||
APP_KEY=<insert your generated key in here>
|
||||
APP_DEBUG=true
|
||||
MULTI_DB_ENABLED=false
|
||||
DB_HOST1=db
|
||||
DB_USERNAME1=ninja
|
||||
DB_PASSWORD1=ninja
|
||||
DB_DATABASE1=ninja
|
||||
PHANTOMJS_PDF_GENERATION=false
|
||||
```
|
||||
|
||||
```shell
|
||||
The ```APP_KEY``` can be generated by running
|
||||
|
||||
```
|
||||
docker run --rm -it invoiceninja/invoiceninja php artisan key:generate --show
|
||||
```
|
||||
|
||||
This will generate an application key for you which you need later.
|
||||
Copy the entire string and insert in the env file at ```APP_KEY=base64....```
|
||||
|
||||
### Create folders for data persistence
|
||||
To ensure folder permissions are correct when the container comes up for the first time it is important that you set the correct folder permissions on the ```docker``` folder.
|
||||
|
||||
To make your data persistent, you have to mount `public` and `storage` from your host to your containers.
|
||||
From the terminal run
|
||||
|
||||
1. Create two folder on your host, e. g. `/var/invoiceninja/public` and `/var/invoiceninja/storage`
|
||||
2. Mount these folders into your container - see [usage](#usage)
|
||||
```sudo chown -R 1500:1500 docker/app```
|
||||
|
||||
You can create these folders wherever you want on your host system.
|
||||
### Note for people running the container locally on their PC ###
|
||||
|
||||
:warning: When using host mounted folder for persistence, make sure they are owned by the proper user and group. As we run Invoice Ninja without `root` , we use a separate user, the folders on the host system need to be owned by uid `1000` and a gid `101`.
|
||||
If you are running the container locally, then the container will need to resolve the host, to support this you will want to insert your LAN IP address and the host name in the hosts file located in ```config/hosts```
|
||||
|
||||
Run this on your host system
|
||||
|
||||
```shell
|
||||
chown -R 1000:101 /var/invoiceninja/public /var/invoiceninja/storage
|
||||
```
|
||||
|
||||
to apply the proper permission to the folders. This also applies to the `docker-compose` setup when using [bind-mounted host directories](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml#L17).
|
||||
For example, lets say your APP_URL is ```http://in5.test:8000``` and your LAN IP is 192.168.0.124 the hosts file will have an entry looking like this:
|
||||
|
||||
|
||||
### PhantomJS key
|
||||
```192.168.0.124 in5.test```
|
||||
|
||||
The PhantomJS key is set to `a-demo-key-with-low-quota-per-ip-address`. This demo key is limited to 100 requests per day.
|
||||
**Please note that PDF generation using local host your domain name MUST end in .test for your PDFs to generate correctly, this is a DNS resolver issue with chromium.
|
||||
|
||||
To set a different key feel free to add `-e PHANTOMJS_CLOUD_KEY='<INSERT YOUR PHANTOMJS KEY HERE>'` to thee docker command below.
|
||||
|
||||
For further configuration and toubleshotting regarding PhantomJS and Invoice Ninja [see documentation here](https://docs.invoiceninja.com/configure.html?#phantomjs).
|
||||
All that is left to do now is bring up the container
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
:warning: The `latest` tag contains the new version 5 of Invoice Ninja which is still in alpha state. To stick to the version 4 please use `alpine-4` tag.
|
||||
|
||||
To run it:
|
||||
|
||||
```shell
|
||||
docker run -d \
|
||||
-v /var/invoiceninja/public:/var/app/public \
|
||||
-v /var/invoiceninja/storage:/var/app/storage \
|
||||
-e APP_URL='http://ninja.dev' \
|
||||
-e APP_KEY='<INSERT THE GENERATED APPLICATION KEY HERE>' \
|
||||
-e DB_HOST='localhost' \
|
||||
-e DB_DATABASE='ninja' \
|
||||
-e DB_USERNAME='ninja' \
|
||||
-e DB_PASSWORD='ninja' \
|
||||
-p '9000:9000' \
|
||||
invoiceninja/invoiceninja:alpine-4
|
||||
```
|
||||
A list of environment variables can be found [here](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example).
|
||||
``` docker-compose up -d```
|
||||
|
||||
|
||||
### With docker-compose
|
||||
**Note: When performing the setup, the Database host is ```db```
|
||||
|
||||
Running Invoice Ninja with docker-compose gives you everything to quickly start. Before starting please make sure you configured your setup correctly. You can do so by opening the `docker-compose.yml` and may change the follwing items.
|
||||
## Support
|
||||
|
||||
:warning: The `docker-compose.yml` runs the new version 5 of Invoice Ninja which is still in alpha state. To stick to the version 4 please use `alpine-4` tag.
|
||||
|
||||
**Port**
|
||||
|
||||
_default: 80_
|
||||
|
||||
This is the port where your Invoice Ninja is reachable, when you type in `http://<your-domain.com>`. If it should be different than `80` make sure to call your installation `http://<your-domain.com>:<YOUR-PORT>`, e. g. `http://<your-domain.com>:8080`.
|
||||
|
||||
```yml
|
||||
ports:
|
||||
- "8080:80" # To run it on port 8080
|
||||
```
|
||||
|
||||
:warning: Make sure the port set is available and not occupied by another service on your host system.
|
||||
|
||||
**URL and application key**
|
||||
|
||||
_default: https://localhost_
|
||||
|
||||
For generating a proper application key see [generate an application key](#generate-an-application-key). Change the value where your Invoice Ninja installation should be reachable.
|
||||
|
||||
```yml
|
||||
environment:
|
||||
- APP_URL=http://localhost
|
||||
````
|
||||
|
||||
**MYSQL root password**
|
||||
|
||||
_default: ninjaAdm1nPassword_
|
||||
|
||||
The mysql database server comes with two users: one for accessing the Invoice Ninja database and the `root` user. Please change the default password for `root` to something more special :wink:
|
||||
|
||||
**Volumes and directories**
|
||||
|
||||
_default: volumes_
|
||||
|
||||
This is the place where your uploaded files are stored. Normally this is a so called _volume_ which can be reused by different docker containers. One might prefer to store the files directly on the host system - for this the config section is prepared with what is called _bind-mounted host directory_. Just adjust the paths and Invoice Ninja stores the user files on the host system.
|
||||
|
||||
```yml
|
||||
volumes:
|
||||
...
|
||||
# Configure your mounted directories, make sure the folder 'public' and 'storage'
|
||||
# exist, before mounting them
|
||||
#- public:/var/www/app/public
|
||||
#- storage:/var/www/app/storage
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
```
|
||||
|
||||
The sample above stores the files on the post at `./docker/app/public` and `./docker/app/storage`.
|
||||
|
||||
:warning: If using bind-mounted host directories make sure they exists and have proper rights. See [here](#create-folders-for-data-persistence) for details.
|
||||
|
||||
## Docker secrets
|
||||
|
||||
:information_source: This feature is borrowed from [mariadb docker image](https://hub.docker.com/_/mariadb).
|
||||
|
||||
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to the below listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in _/run/secrets/<secret_name>_ files.
|
||||
|
||||
Supported are these variables:
|
||||
`APP_KEY`, `API_SECRET`, `CLOUDFLARE_API_KEY`, `DB_USERNAME`, `DB_PASSWORD`, `MAIL_USERNAME`, `MAIL_PASSWORD`, `MAILGUN_SECRET`, `S3_KEY`, `S3_SECRET`
|
||||
If you discover a bug, please create and issue, if you query is general in nature please visit us on our [Forum ](https://forum.invoiceninja.com/)
|
||||
|
||||
|
||||
## Debugging your Docker setup
|
||||
|
||||
Even when running your Invoice Ninja setup with Docker - errors can occur. Depending on where the error happens - the webserver, Invoice Ninja or the database - different log files can be responsible.
|
||||
|
||||
### Show logs without `docker-compose`
|
||||
|
||||
If you are not running `docker-compose` you first need to find the container id for your php container with `docker ps`. Then you can run
|
||||
|
||||
```shell
|
||||
docker logs -f <CONTAINER NAME>
|
||||
```
|
||||
|
||||
This gives you a constant output of the log files for the php container.
|
||||
|
||||
### Show logs with `docker-compose`
|
||||
|
||||
If you are running the `docker-compose` setup you can output all logs, from all containers, with the following command
|
||||
|
||||
```shell
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
If you better want a physical log file in in your `storage/logs` folder, just add `-e LOG=single` to the [usage](#usage) command.
|
||||
Or add an environment variable
|
||||
|
||||
```yml
|
||||
...
|
||||
environment:
|
||||
LOG: single
|
||||
...
|
||||
```
|
||||
|
||||
to your `docker-compose.yml`.
|
||||
|
||||
This generated log file will only hold Invoice Ninja information.
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
ARG PHP_VERSION=7.2
|
||||
ARG BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/
|
||||
ARG BAK_PUBLIC_PATH=/var/www/app/docker-backup-public/
|
||||
|
||||
FROM php:${PHP_VERSION}-fpm-alpine
|
||||
|
||||
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
|
||||
LABEL maintainer="David Bomba <turbo124@gmail.com>"
|
||||
|
||||
#####
|
||||
# SYSTEM REQUIREMENT
|
||||
#####
|
||||
ARG INVOICENINJA_VERSION
|
||||
ARG BAK_STORAGE_PATH
|
||||
ARG BAK_PUBLIC_PATH
|
||||
ENV BAK_STORAGE_PATH $BAK_STORAGE_PATH
|
||||
ENV BAK_PUBLIC_PATH $BAK_PUBLIC_PATH
|
||||
WORKDIR /var/www/app
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||
@@ -24,8 +30,8 @@ RUN set -eux; \
|
||||
libzip-dev
|
||||
|
||||
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include --with-webp-dir=/usr/include --with-freetype-dir=/usr/include/; \
|
||||
docker-php-ext-configure zip --with-libzip; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
docker-php-ext-configure zip --with-libzip; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
iconv \
|
||||
gd \
|
||||
gmp \
|
||||
@@ -39,20 +45,20 @@ COPY ./config/php/php.ini /usr/local/etc/php/php.ini
|
||||
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
|
||||
|
||||
# Separate user
|
||||
ENV IN_USER=invoiceninja
|
||||
ENV INVOICENINJA_USER=invoiceninja
|
||||
|
||||
RUN addgroup -S "$IN_USER" && \
|
||||
adduser \
|
||||
RUN addgroup --gid=1500 -S "$INVOICENINJA_USER" && \
|
||||
adduser --uid=1500 \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "$(pwd)" \
|
||||
--ingroup "$IN_USER" \
|
||||
--ingroup "$INVOICENINJA_USER" \
|
||||
--no-create-home \
|
||||
"$IN_USER"; \
|
||||
addgroup "$IN_USER" www-data; \
|
||||
chown -R "$IN_USER":"$IN_USER" .
|
||||
"$INVOICENINJA_USER"; \
|
||||
addgroup "$INVOICENINJA_USER" www-data; \
|
||||
chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" .
|
||||
|
||||
USER $IN_USER
|
||||
USER $INVOICENINJA_USER
|
||||
|
||||
# Download and install IN
|
||||
ENV INVOICENINJA_VERSION="${INVOICENINJA_VERSION}"
|
||||
@@ -60,10 +66,9 @@ ENV INVOICENINJA_VERSION="${INVOICENINJA_VERSION}"
|
||||
RUN curl -s -o /tmp/ninja.zip -SL https://download.invoiceninja.com/ninja-v${INVOICENINJA_VERSION}.zip \
|
||||
&& bsdtar --strip-components=1 -C /var/www/app -xf /tmp/ninja.zip \
|
||||
&& rm /tmp/ninja.zip \
|
||||
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
|
||||
&& mv /var/www/app/public /var/www/app/docker-backup-public \
|
||||
&& mv /var/www/app/storage $BAK_STORAGE_PATH \
|
||||
&& mv /var/www/app/public $BAK_PUBLIC_PATH \
|
||||
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
|
||||
&& cp /var/www/app/.env.example /var/www/app/.env \
|
||||
&& chmod -R 755 /var/www/app/storage \
|
||||
&& rm -rf /var/www/app/docs /var/www/app/tests
|
||||
|
||||
|
||||
@@ -1,39 +1,45 @@
|
||||
ARG PHP_VERSION=7.3
|
||||
ARG PHP_VERSION=7.4
|
||||
ARG BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/
|
||||
ARG BAK_PUBLIC_PATH=/var/www/app/docker-backup-public/
|
||||
|
||||
# Get Invoice Ninja
|
||||
FROM alpine:latest as base
|
||||
# Get Invoice Ninja and install nodejs packages
|
||||
FROM node:lts-alpine as frontend
|
||||
ARG INVOICENINJA_VERSION
|
||||
ARG BAK_STORAGE_PATH
|
||||
ARG BAK_PUBLIC_PATH
|
||||
|
||||
# Install dependencies
|
||||
RUN set -eux; \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
libarchive-tools; \
|
||||
mkdir -p /var/www/app
|
||||
curl
|
||||
|
||||
# Download Invoice Ninja
|
||||
RUN curl -o /tmp/ninja.tar.gz -LJ0 https://github.com/invoiceninja/invoiceninja/tarball/v$INVOICENINJA_VERSION \
|
||||
&& bsdtar --strip-components=1 -C /var/www/app -xf /tmp/ninja.tar.gz \
|
||||
&& rm /tmp/ninja.tar.gz \
|
||||
&& cp -R /var/www/app/storage /var/www/app/docker-backup-storage \
|
||||
&& cp -R /var/www/app/public /var/www/app/docker-backup-public \
|
||||
&& mkdir -p /var/www/app \
|
||||
&& tar --strip-components=1 -xf /tmp/ninja.tar.gz -C /var/www/app/ \
|
||||
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
|
||||
&& cp /var/www/app/.env.example /var/www/app/.env \
|
||||
&& cp /var/www/app/.env.dusk.example /var/www/app/.env.dusk.local \
|
||||
&& mv /var/www/app/.env.example /var/www/app/.env \
|
||||
&& rm -rf /var/www/app/docs /var/www/app/tests
|
||||
|
||||
# Install nodejs packages
|
||||
FROM node:12-alpine as frontend
|
||||
|
||||
COPY --from=base /var/www/app /var/www/app
|
||||
WORKDIR /var/www/app/
|
||||
|
||||
RUN npm install
|
||||
# Install node packages
|
||||
RUN npm install --production \
|
||||
&& npm run production \
|
||||
&& rm -rf node_modules \
|
||||
&& mv /var/www/app/storage $BAK_STORAGE_PATH \
|
||||
&& mv /var/www/app/public $BAK_PUBLIC_PATH
|
||||
|
||||
# Prepare php image
|
||||
FROM php:${PHP_VERSION}-fpm-alpine
|
||||
ARG INVOICENINJA_VERSION
|
||||
ENV INVOICENINJA_VERSION=$INVOICENINJA_VERSION
|
||||
ARG BAK_STORAGE_PATH
|
||||
ARG BAK_PUBLIC_PATH
|
||||
ENV INVOICENINJA_VERSION $INVOICENINJA_VERSION
|
||||
ENV BAK_STORAGE_PATH $BAK_STORAGE_PATH
|
||||
ENV BAK_PUBLIC_PATH $BAK_PUBLIC_PATH
|
||||
|
||||
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
|
||||
LABEL maintainer="David Bomba <turbo124@gmail.com>"
|
||||
|
||||
WORKDIR /var/www/app
|
||||
|
||||
@@ -43,22 +49,27 @@ RUN chmod +x /usr/local/bin/docker-entrypoint
|
||||
|
||||
RUN set -eux; \
|
||||
apk add --no-cache \
|
||||
mysql-client \
|
||||
freetype-dev \
|
||||
gmp-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libzip-dev; \
|
||||
docker-php-ext-configure zip --with-libzip; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
libzip-dev \
|
||||
# oniguruma-dev \
|
||||
git \
|
||||
# busybox-suid \
|
||||
zip \
|
||||
chromium \
|
||||
harfbuzz \
|
||||
ttf-freefont \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
bcmath \
|
||||
exif \
|
||||
gd \
|
||||
gmp \
|
||||
mbstring \
|
||||
mysqli \
|
||||
opcache \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
zip
|
||||
|
||||
@@ -66,30 +77,32 @@ COPY ./config/php/php.ini /usr/local/etc/php/php.ini
|
||||
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
|
||||
|
||||
## Separate user
|
||||
ARG UID=1500
|
||||
ENV INVOICENINJA_USER=invoiceninja
|
||||
|
||||
RUN addgroup -S "$INVOICENINJA_USER" && \
|
||||
adduser \
|
||||
RUN addgroup --gid=$UID -S "$INVOICENINJA_USER" \
|
||||
&& adduser --uid=$UID \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "$(pwd)" \
|
||||
--ingroup "$INVOICENINJA_USER" \
|
||||
--no-create-home \
|
||||
"$INVOICENINJA_USER"; \
|
||||
addgroup "$INVOICENINJA_USER" www-data; \
|
||||
chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app
|
||||
"$INVOICENINJA_USER" \
|
||||
&& addgroup "$INVOICENINJA_USER" www-data \
|
||||
&& chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer; \
|
||||
composer global require hirak/prestissimo;
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer;
|
||||
|
||||
USER $INVOICENINJA_USER
|
||||
USER $UID
|
||||
|
||||
RUN composer install --no-dev --no-suggest --no-progress
|
||||
RUN /usr/local/bin/composer install --no-dev --quiet
|
||||
|
||||
# Override the environment settings from projects .env file
|
||||
ENV APP_ENV production
|
||||
ENV LOG errorlog
|
||||
ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint"]
|
||||
CMD ["php-fpm"]
|
||||
CMD ["php-fpm"]
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
root * /var/www/app/public
|
||||
php_fastcgi app:9000
|
||||
encode zstd gzip
|
||||
templates
|
||||
file_server browse
|
||||
}
|
||||
|
||||
16
config/cron.sh
Executable file
16
config/cron.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Early Entry"
|
||||
|
||||
cleanup ()
|
||||
{
|
||||
kill -s SIGTERM $!
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
while :
|
||||
do
|
||||
sleep 60 ; cd /var/www/app/ && php artisan schedule:run;
|
||||
done
|
||||
3
config/cron/cronjob_v5.sh
Executable file
3
config/cron/cronjob_v5.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cd /var/www/app; php artisan schedule:run >> /dev/null 2>&1
|
||||
1
config/hosts
Normal file
1
config/hosts
Normal file
@@ -0,0 +1 @@
|
||||
192.168.0.124 in5.test
|
||||
25
config/nginx/in-vhost.conf
Normal file
25
config/nginx/in-vhost.conf
Normal file
@@ -0,0 +1,25 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
root /var/www/app/public/;
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_intercept_errors off;
|
||||
fastcgi_buffer_size 16k;
|
||||
fastcgi_buffers 4 16k;
|
||||
}
|
||||
}
|
||||
76
debian/Dockerfile
vendored
76
debian/Dockerfile
vendored
@@ -1,76 +0,0 @@
|
||||
ARG PHP_VERSION=7.2
|
||||
|
||||
FROM php:${PHP_VERSION}-fpm-stretch
|
||||
|
||||
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
|
||||
|
||||
#####
|
||||
# SYSTEM REQUIREMENT
|
||||
#####
|
||||
ARG INVOICENINJA_VERSION
|
||||
COPY ./debian/entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint
|
||||
|
||||
ENV BUILD_DEPS \
|
||||
zlib1g-dev \
|
||||
git \
|
||||
libgmp-dev \
|
||||
unzip \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libpng-dev \
|
||||
build-essential \
|
||||
chrpath \
|
||||
libssl-dev \
|
||||
libxft-dev \
|
||||
libfreetype6 \
|
||||
libfontconfig1 \
|
||||
libfontconfig1-dev
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends $BUILD_DEPS \
|
||||
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/ \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-configure gmp \
|
||||
&& docker-php-ext-install iconv mbstring pdo pdo_mysql zip gd gmp opcache
|
||||
|
||||
ENV PHANTOMJS phantomjs-2.1.1-linux-x86_64
|
||||
# Install PHANTOMJS
|
||||
RUN curl -o ${PHANTOMJS}.tar.bz2 -SL https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOMJS}.tar.bz2 \
|
||||
&& tar xvjf ${PHANTOMJS}.tar.bz2 \
|
||||
&& rm ${PHANTOMJS}.tar.bz2 \
|
||||
&& mv ${PHANTOMJS} /usr/local/share \
|
||||
&& ln -sf /usr/local/share/${PHANTOMJS}/bin/phantomjs /usr/local/bin \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./config/php/php.ini /usr/local/etc/php/php.ini
|
||||
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
|
||||
|
||||
# Download and install IN
|
||||
ENV INVOICENINJA_VERSION="${INVOICENINJA_VERSION}"
|
||||
|
||||
RUN curl -o ninja.zip -SL https://download.invoiceninja.com/ninja-v${INVOICENINJA_VERSION}.zip \
|
||||
&& unzip -q ninja.zip -d /var/www/ \
|
||||
&& rm ninja.zip \
|
||||
&& mv /var/www/ninja /var/www/app \
|
||||
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
|
||||
&& mv /var/www/app/public /var/www/app/docker-backup-public \
|
||||
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
|
||||
&& cp /var/www/app/.env.example /var/www/app/.env \
|
||||
&& chmod -R 755 /var/www/app/storage \
|
||||
&& chown -R www-data:www-data /var/www/app/storage /var/www/app/bootstrap /var/www/app/public/logo /var/www/app/.env /var/www/app/docker-backup-storage /var/www/app/docker-backup-public\
|
||||
&& rm -rf /var/www/app/docs /var/www/app/tests /var/www/ninja
|
||||
|
||||
# Override the environment settings from projects .env file
|
||||
ENV LOG errorlog
|
||||
ENV SELF_UPDATER_SOURCE ''
|
||||
ENV PHANTOMJS_BIN_PATH /usr/local/bin/phantomjs
|
||||
|
||||
|
||||
# use to be mounted into nginx for example
|
||||
VOLUME /var/www/app/public
|
||||
|
||||
WORKDIR /var/www/app
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint"]
|
||||
CMD ["php-fpm"]
|
||||
46
debian/entrypoint.sh
vendored
46
debian/entrypoint.sh
vendored
@@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ ! -d /var/www/app/storage ]; then
|
||||
cp -Rp /var/www/app/docker-backup-storage /var/www/app/storage
|
||||
else
|
||||
IN_STORAGE_BACKUP="$(ls /var/www/app/docker-backup-storage/)"
|
||||
for path in $IN_STORAGE_BACKUP; do
|
||||
if [ ! -e "/var/www/app/storage/$path" ]; then
|
||||
cp -Rp "/var/www/app/docker-backup-storage/$path" "/var/www/app/storage/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -d /var/www/app/public/logo ]; then
|
||||
cp -Rp /var/www/app/docker-backup-public/logo /var/www/app/public/logo
|
||||
else
|
||||
IN_LOGO_BACKUP="$(ls /var/www/app/docker-backup-public/logo/)"
|
||||
for path in $IN_LOGO_BACKUP; do
|
||||
if [ ! -e "/var/www/app/public/logo/$path" ]; then
|
||||
cp -Rp "/var/www/app/docker-backup-public/logo/$path" "/var/www/app/public/logo/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# compare public volume version with image version
|
||||
if [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
|
||||
echo 'clone public directory'
|
||||
cp -Rp /var/www/app/docker-backup-public/* /var/www/app/public/
|
||||
echo $INVOICENINJA_VERSION > /var/www/app/public/version
|
||||
fi
|
||||
|
||||
# fix permission for mounted directories
|
||||
chown www-data:www-data /var/www/app/storage
|
||||
chown www-data:www-data /var/www/app/public/logo
|
||||
|
||||
#php artisan optimize --force
|
||||
#php artisan migrate --force
|
||||
|
||||
#if [ ! -e "/var/www/app/is-seeded" ]; then
|
||||
#php artisan db:seed --force
|
||||
#touch "/var/www/app/is-seeded"
|
||||
#fi
|
||||
|
||||
echo 'start'
|
||||
exec "$@"
|
||||
@@ -2,76 +2,91 @@ version: '3.7'
|
||||
|
||||
services:
|
||||
server:
|
||||
image: caddy:alpine
|
||||
image: nginx
|
||||
restart: always
|
||||
environment:
|
||||
- APP_URL=https://localhost
|
||||
env_file: env
|
||||
volumes:
|
||||
# Vhost configuration
|
||||
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
|
||||
|
||||
# Configure your mounted directories, make sure the folder 'public' and 'storage'
|
||||
# exist, before mounting them
|
||||
- public:/var/www/app/public
|
||||
- storage:/var/www/app/storage
|
||||
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
|
||||
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
depends_on:
|
||||
- app
|
||||
# Run webserver nginx on port 80
|
||||
# Feel free to modify depending what port is already occupied
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
#- "443:443"
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "in5.localhost:192.168.0.124 " #host and ip
|
||||
|
||||
app:
|
||||
image: invoiceninja/invoiceninja:5
|
||||
env_file: env
|
||||
restart: always
|
||||
environment:
|
||||
- APP_URL=https://localhost
|
||||
- APP_KEY=<INSERT THE GENERATED APPLICATION KEY HERE>
|
||||
- MULTI_DB_ENABLED=false
|
||||
- DB_HOST1=db
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
volumes:
|
||||
# Configure your mounted directories, make sure the folder 'public' and 'storage'
|
||||
# exist, before mounting them
|
||||
- public:/var/www/app/public
|
||||
- storage:/var/www/app/storage
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
- ./config/hosts:/etc/hosts:ro
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "in5.localhost:192.168.0.124 " #host and ip
|
||||
|
||||
db:
|
||||
image: mysql:5
|
||||
ports:
|
||||
- "3305:3306"
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
|
||||
- MYSQL_USER=ninja
|
||||
- MYSQL_PASSWORD=ninja
|
||||
- MYSQL_DATABASE=db-ninja-01
|
||||
- MYSQL_DATABASE=ninja
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql:rw
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/mysql/data:/var/lib/mysql:rw,delegated
|
||||
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "in5.localhost:192.168.0.124 " #host and ip
|
||||
|
||||
|
||||
# THIS IS ONLY A VALID CONFIGURATION FOR IN 5. DO NOT USE FOR IN 4.
|
||||
cron:
|
||||
image: invoiceninja/invoiceninja:5
|
||||
env_file: env
|
||||
volumes:
|
||||
- ./config/cron.sh:/usr/local/bin/cron.sh
|
||||
- ./config/hosts:/etc/hosts:ro
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
command:
|
||||
- cron.sh
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "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
|
||||
# image: invoiceninja/invoiceninja:alpine-4
|
||||
# volumes:
|
||||
# - storage:/var/www/app/storage
|
||||
# - logo:/var/www/app/public/logo
|
||||
# - public:/var/www/app/public
|
||||
# - ./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: |
|
||||
# bash -c 'bash -s <<EOF
|
||||
# /bin/sh -c 'sh -s <<EOF
|
||||
# trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
# sleep 300s
|
||||
# while /bin/true; do
|
||||
@@ -82,11 +97,7 @@ services:
|
||||
# EOF'
|
||||
# networks:
|
||||
# - invoiceninja
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
public:
|
||||
storage:
|
||||
#
|
||||
|
||||
networks:
|
||||
invoiceninja:
|
||||
1
docker/app/public/.keep
Normal file
1
docker/app/public/.keep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
docker/app/storage/.keep
Normal file
1
docker/app/storage/.keep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -12,16 +12,9 @@ in_error() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here.
|
||||
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this "magic" here.
|
||||
ie_gv() {
|
||||
local line name value
|
||||
set | \
|
||||
while read line; do
|
||||
name=${line%=*} value=${line#*=\'}
|
||||
if [ "$name" = "$1" ]; then
|
||||
echo ${value%\'}
|
||||
fi
|
||||
done
|
||||
eval "echo \$$1"
|
||||
}
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
@@ -37,7 +30,7 @@ file_env() {
|
||||
in_error "Both $var and $fileVar are set (but are exclusive)"
|
||||
fi
|
||||
|
||||
local val="$def"
|
||||
local val="$def"
|
||||
if [ "$(ie_gv ${var})" != "" ]; then
|
||||
val=$(ie_gv ${var})
|
||||
elif [ "$(ie_gv ${fileVar})" != "" ]; then
|
||||
@@ -48,55 +41,60 @@ file_env() {
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- php-fpm "$@"
|
||||
fi
|
||||
|
||||
BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/
|
||||
BAK_LOGO_PATH=/var/www/app/docker-backup-public/logo/
|
||||
|
||||
if [ ! -d /var/www/app/storage ]; then
|
||||
cp -Rp $BAK_STORAGE_PATH /var/www/app/storage
|
||||
else
|
||||
if [ -d $BAK_STORAGE_PATH ]; then
|
||||
IN_STORAGE_BACKUP="$(ls $BAK_STORAGE_PATH)"
|
||||
for path in $IN_STORAGE_BACKUP; do
|
||||
if [ ! -e "/var/www/app/storage/$path" ]; then
|
||||
cp -Rp "$BAK_STORAGE_PATH/$path" "/var/www/app/storage/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# create storage volume
|
||||
if [ ! -d /var/www/app/storage ] && [ -d "$BAK_STORAGE_PATH" ]; then
|
||||
mv "$BAK_STORAGE_PATH" /var/www/app/storage
|
||||
elif [ -d "$BAK_STORAGE_PATH" ]; then
|
||||
# copy missing folders in storage
|
||||
IN_STORAGE_BACKUP="$(ls "$BAK_STORAGE_PATH")"
|
||||
for path in $IN_STORAGE_BACKUP; do
|
||||
if [ ! -e "/var/www/app/storage/$path" ]; then
|
||||
cp -Rp "$BAK_STORAGE_PATH/$path" "/var/www/app/storage/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -rf "$BAK_STORAGE_PATH"
|
||||
|
||||
if [ ! -d /var/www/app/public/logo ] && [ -d $BAK_LOGO_PATH ]; then
|
||||
cp -Rp $BAK_LOGO_PATH /var/www/app/public/logo
|
||||
else
|
||||
if [ -d $BAK_LOGO_PATH ]; then
|
||||
IN_LOGO_BACKUP="$(ls $BAK_LOGO_PATH)"
|
||||
for path in $IN_LOGO_BACKUP; do
|
||||
if [ ! -e "/var/www/app/public/logo/$path" ]; then
|
||||
cp -Rp "$BAK_LOGO_PATH/$path" "/var/www/app/public/logo/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# compare public volume version with image version
|
||||
if [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
|
||||
cp -au /var/www/app/docker-backup-public/* /var/www/app/public/
|
||||
echo $INVOICENINJA_VERSION > /var/www/app/public/version
|
||||
# create public volume
|
||||
if [ ! -d /var/www/app/public ] && [ -d "$BAK_PUBLIC_PATH" ]; then
|
||||
mv "$BAK_PUBLIC_PATH" /var/www/app/public
|
||||
elif [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
|
||||
# version mismatch, update all
|
||||
cp -au "$BAK_PUBLIC_PATH/"* /var/www/app/public
|
||||
echo "$INVOICENINJA_VERSION" > /var/www/app/public/version
|
||||
elif [ ! -d /var/www/app/public/logo ] && [ -d "$BAK_PUBLIC_PATH/logo" ]; then
|
||||
# missing logo folder only, copy folder
|
||||
cp -a "$BAK_PUBLIC_PATH/logo" /var/www/app/public/logo
|
||||
elif [ -d "$BAK_PUBLIC_PATH/logo" ]; then
|
||||
# copy missing folders in logo
|
||||
IN_LOGO_BACKUP="$(ls "$BAK_PUBLIC_PATH/logo")"
|
||||
for path in $IN_LOGO_BACKUP; do
|
||||
if [ ! -e "/var/www/app/public/logo/$path" ]; then
|
||||
cp -a "$BAK_PUBLIC_PATH/logo/$path" "/var/www/app/public/logo/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -rf "$BAK_PUBLIC_PATH"
|
||||
|
||||
# Set permission for web server to create/update files
|
||||
chown -R invoiceninja:www-data /var/www/app/storage /var/www/app/public /var/www/app/bootstrap
|
||||
chown -R "$INVOICENINJA_USER":www-data /var/www/app/storage /var/www/app/public /var/www/app/bootstrap
|
||||
|
||||
# Initialize values that might be stored in a file
|
||||
file_env 'APP_KEY'
|
||||
file_env 'API_SECRET'
|
||||
file_env 'CLOUDFLARE_API_KEY'
|
||||
file_env 'DB_USERNAME'
|
||||
file_env 'DB_USERNAME1'
|
||||
file_env 'DB_USERNAME2'
|
||||
file_env 'DB_PASSWORD'
|
||||
file_env 'DB_PASSWORD1'
|
||||
file_env 'DB_PASSWORD2'
|
||||
file_env 'MAIL_USERNAME'
|
||||
file_env 'MAIL_PASSWORD'
|
||||
file_env 'MAILGUN_SECRET'
|
||||
@@ -106,5 +104,6 @@ file_env 'S3_SECRET'
|
||||
# Run Laravel stuff
|
||||
php artisan config:cache
|
||||
php artisan optimize
|
||||
php artisan migrate --force
|
||||
|
||||
exec docker-php-entrypoint "$@"
|
||||
|
||||
17
env
Normal file
17
env
Normal file
@@ -0,0 +1,17 @@
|
||||
APP_URL=http://in.localhost:8003/
|
||||
APP_KEY=<insert your generated key in here>
|
||||
APP_DEBUG=true
|
||||
MULTI_DB_ENABLED=false
|
||||
DB_HOST1=db
|
||||
DB_USERNAME1=ninja
|
||||
DB_PASSWORD1=ninja
|
||||
DB_DATABASE1=ninja
|
||||
PHANTOMJS_PDF_GENERATION=false
|
||||
|
||||
#V4 env vars
|
||||
DB_STRICT=false
|
||||
DB_HOST=db
|
||||
DB_DATABASE=ninja
|
||||
DB_USERNAME=ninja
|
||||
DB_PASSWORD=ninja
|
||||
APP_CIPHER=AES-256-CBC
|
||||
Reference in New Issue
Block a user