Compare commits

...

100 Commits

Author SHA1 Message Date
David Bomba
ae1f8fcecb Merge pull request #251 from turbo124/master
fixes for cron
2021-01-05 22:48:50 +11:00
David Bomba
6528ef7162 fixes for cron 2021-01-05 22:48:27 +11:00
David Bomba
2f6b5ea55e Minor fix 2021-01-05 22:45:29 +11:00
David Bomba
7c1ef82a09 Merge pull request #250 from turbo124/master
Update V4 container
2021-01-05 17:15:55 +11:00
David Bomba
98846729e6 update maintainer 2021-01-05 17:15:33 +11:00
David Bomba
f03860d8ea Fixes for V4 container 2021-01-05 17:14:49 +11:00
David Bomba
c624f6ed40 Fixes for V4 2021-01-05 16:20:27 +11:00
David Bomba
c94145edca Merge pull request #249 from turbo124/master
Fixes for Readme.
2021-01-05 12:09:01 +11:00
David Bomba
ff2c813355 Fixes for readme 2021-01-05 12:08:07 +11:00
David Bomba
e0cf941736 Typo 2021-01-05 11:56:49 +11:00
David Bomba
b1d65a8ac9 Typo 2021-01-05 11:56:21 +11:00
David Bomba
e6ad0c58ee Typo 2021-01-05 11:55:00 +11:00
David Bomba
11b99e7970 Typo 2021-01-05 11:54:19 +11:00
David Bomba
5fa605cba4 Typo 2021-01-05 11:53:36 +11:00
David Bomba
388f1a75b9 Merge pull request #248 from turbo124/master
Refactor DockerFiles
2021-01-05 11:52:28 +11:00
David Bomba
253c3339cf Fixes for ReadMe 2021-01-05 11:51:50 +11:00
David Bomba
d67fa3059a fixes for entrypoint 2021-01-05 11:09:56 +11:00
David Bomba
98e41ad73b Rework crons 2021-01-05 11:02:57 +11:00
David Bomba
14c597312e Fixes for formatting 2021-01-05 10:47:59 +11:00
David Bomba
af77440555 changes for README 2021-01-05 10:46:55 +11:00
David Bomba
9377777f62 Create .keep 2021-01-04 20:15:19 +11:00
David Bomba
ac7c520620 Create .keep 2021-01-04 20:15:03 +11:00
David Bomba
1ae79cde4f Merge pull request #247 from turbo124/master
Fixes for docker file
2021-01-04 20:12:35 +11:00
David Bomba
a58b89c55d Fixes for docker file" 2021-01-04 20:11:50 +11:00
David Bomba
89e6cffa90 Merge pull request #246 from turbo124/master
Fixes for crons and folder permissions
2021-01-03 21:34:27 +11:00
David Bomba
a82d60b4f5 Fixes for crons and folder permissions 2021-01-03 21:34:04 +11:00
David Bomba
32c93eb4d7 Merge pull request #241 from beganovich/v5-skip-snappdf-download
(v5) Add environment variable to skip downloading Chromium (snappdf)
2020-12-30 09:26:34 +11:00
=
9e603ba79f Fixes for crontab 2020-12-30 07:33:50 +11:00
Benjamin Beganović
d9889fcfaa Add variable to skip Chromium download 2020-12-28 14:25:16 +01:00
David Bomba
a89e145bf9 Merge pull request #239 from beganovich/v5-transition-to-snappdf
(v5) Support for snappdf
2020-12-24 09:25:32 +11:00
Benjamin Beganović
85d46e8968 support for snappdf 2020-12-23 18:06:31 +01:00
David Bomba
0fb5fa73e0 Merge pull request #233 from turbo124/master
fixes for docker file
2020-12-05 20:14:39 +11:00
David Bomba
de3a2e4278 fixes for docker file 2020-12-05 20:14:19 +11:00
David Bomba
bb514e8d06 Merge pull request #232 from turbo124/master
Remove storage:link from image build
2020-11-30 10:00:27 +11:00
David Bomba
2034c6ebff Remove storage:link from image build 2020-11-30 09:56:30 +11:00
David Bomba
65e36505a3 Merge pull request #231 from turbo124/master
Minor fixes
2020-11-28 18:07:34 +11:00
David Bomba
03c1e32123 Minor fixes 2020-11-28 18:07:16 +11:00
David Bomba
3612c87323 Merge pull request #230 from turbo124/master
Default to puppeteer PDF generation
2020-11-28 17:51:04 +11:00
David Bomba
4e9731a23e Default to puppeteer PDF generation 2020-11-28 17:50:46 +11:00
David Bomba
dea442c442 Merge pull request #229 from turbo124/master
Install libonig-dev with apk
2020-11-28 17:26:33 +11:00
David Bomba
a24c1b98a3 Install libonig-dev with apk 2020-11-28 17:26:13 +11:00
David Bomba
1596478724 Merge pull request #228 from turbo124/master
Install libonig-dev with apt
2020-11-28 17:20:28 +11:00
David Bomba
a240fd2977 Install libonig-dev with apt 2020-11-28 17:20:09 +11:00
David Bomba
7c1ef67755 Merge pull request #227 from turbo124/master
fixes for 7.4
2020-11-28 17:15:14 +11:00
David Bomba
bfc1d7add8 fixes for 7.4 2020-11-28 17:14:57 +11:00
David Bomba
111f5a7e4e Merge pull request #226 from turbo124/master
Add libonig to build
2020-11-28 17:12:27 +11:00
David Bomba
330f3e1c0e Add libonig to build 2020-11-28 17:12:10 +11:00
David Bomba
baeb925d87 Merge pull request #225 from turbo124/master
Add libonig to build
2020-11-28 17:05:46 +11:00
David Bomba
079a05bbd8 Add libonig to build 2020-11-28 17:05:30 +11:00
David Bomba
8e995aa2ef Merge pull request #224 from turbo124/master
Add libonig to build
2020-11-28 16:56:25 +11:00
David Bomba
dee4d0f27d Add libonig to build 2020-11-28 16:56:09 +11:00
David Bomba
60e5a68e01 Merge pull request #223 from turbo124/master
Fixes for lib jpg and freetype for php7.4
2020-11-28 16:49:45 +11:00
David Bomba
67ad43d05d Fixes for lib jpg and freetype for php7.4 2020-11-28 16:49:18 +11:00
David Bomba
35beefba60 Merge pull request #222 from turbo124/master
Fixes for lib jpg and freetype for php7.4
2020-11-28 16:45:22 +11:00
David Bomba
d1309cc86f Fixes for lib jpg and freetype for php7.4 2020-11-28 16:45:03 +11:00
David Bomba
a1d9220506 Merge pull request #221 from turbo124/master
Fix for libzip when using php7.4
2020-11-28 16:39:36 +11:00
David Bomba
386359a346 Fix for libzip when using php7.4 2020-11-28 16:38:50 +11:00
David Bomba
b503418904 Merge pull request #220 from turbo124/master
Fix for libzip when using php7.4
2020-11-28 16:28:33 +11:00
David Bomba
450eaf16e3 Fix for libzip when using php7.4 2020-11-28 16:28:13 +11:00
David Bomba
1f65c9f7f6 Merge pull request #219 from turbo124/master
Fixes for building zip on php7.4
2020-11-28 16:23:28 +11:00
David Bomba
c02bf7bd03 Fixes for building zip on php7.4 2020-11-28 16:22:58 +11:00
David Bomba
4111fa87c9 Merge pull request #218 from turbo124/master
Fix for libzip when using php7.4
2020-11-28 16:15:59 +11:00
David Bomba
0d5a7671ba Fix for libzip when using php7.4 2020-11-28 16:15:40 +11:00
David Bomba
7ea6e7c48e Merge pull request #217 from turbo124/master
Bump PHP version for spatie/browsershot
2020-11-28 16:09:14 +11:00
David Bomba
27e1788e91 Bump PHP version for spatie/browsershot 2020-11-28 16:08:54 +11:00
David Bomba
d24a69ec39 Merge pull request #216 from turbo124/master
Composer fixes
2020-11-28 15:59:17 +11:00
David Bomba
8384175465 Composer fixes 2020-11-28 15:58:56 +11:00
David Bomba
f8c442ec5f Merge pull request #215 from turbo124/master
Ensure we use composer 2
2020-11-28 15:35:01 +11:00
David Bomba
05f89f064e Ensure we use composer 2 2020-11-28 15:34:40 +11:00
David Bomba
902745ec5a Merge pull request #214 from turbo124/master
minor fixes
2020-11-28 15:31:51 +11:00
David Bomba
4efba38ce5 minor fixes 2020-11-28 15:31:21 +11:00
David Bomba
a184cf2844 Merge pull request #213 from turbo124/master
Add Git / link storage
2020-11-28 07:26:12 +11:00
David Bomba
94e8be57e5 Merge branch 'master' of https://github.com/turbo124/dockerfiles 2020-11-28 07:25:07 +11:00
David Bomba
385a434833 Add git to container to allow auto-updating from container 2020-11-28 07:24:59 +11:00
David Bomba
9ddeda4c32 storage link 2020-11-25 20:33:23 +11:00
David Bomba
805e526fc9 Update docker-compose.yml 2020-11-11 10:25:05 +11:00
David Bomba
cdc35aff2f Update Dockerfile_v5 2020-11-11 10:08:21 +11:00
David Bomba
1de16ab390 Update Dockerfile_v5 2020-11-11 09:42:08 +11:00
David Bomba
b9ab50800d Update Dockerfile_v5
remove hirak global
2020-11-11 05:06:01 +11:00
codedge
d2d03b9b18 Merge pull request #198 from beremaran/master
add puppeteer and add SYS_ADMIN cap
2020-10-15 09:53:26 +02:00
Berke Emrecan Arslan
ea0f3fa981 add puppeteer and add SYS_ADMIN cap 2020-09-18 16:12:31 +03:00
codedge
1d9a8681b2 Merge pull request #193 from codedge/master
Make env vars file support compatible with IN 5
2020-08-19 10:46:01 +02:00
Holger Lösken
f98b3915bd Make env vars file support compatible with IN 5 2020-08-19 10:45:33 +02:00
codedge
8762276c6f Merge pull request #192 from codedge/master
Fix execution of cron daemon
2020-08-19 10:42:15 +02:00
Holger Lösken
afcd9389ed Fix execution of cron daemon 2020-08-19 10:41:40 +02:00
codedge
591c799864 Merge pull request #191 from turbo124/master
Minor fix for docker composer
2020-08-19 08:52:37 +02:00
David Bomba
4c9c5ddd95 Minor fix for docker composer 2020-08-19 10:33:40 +10:00
codedge
994d75a07e Merge pull request #189 from codedge/master
Add cronjob for IN 5
2020-08-18 13:00:10 +02:00
Holger Lösken
3348a2beb6 Add cronjob for IN 5 2020-08-18 12:58:38 +02:00
codedge
c30cae4a99 Create CODE_OF_CONDUCT.md 2020-08-18 12:10:30 +02:00
codedge
1ed95cdcec Merge pull request #188 from codedge/master
Adding config for cron for IN 4
2020-08-18 09:41:15 +02:00
Holger Lösken
94126385e2 Adding config for cron for IN 4
This is just a quick fix. Cron config is not properly set up for version 4 and 5.
2020-08-18 09:40:42 +02:00
codedge
e64dd79cfc Merge pull request #187 from codedge/master
No logs for favicon and robots
2020-08-17 07:44:03 +02:00
Holger Lösken
5942c1c362 Merge branch 'master' of github.com:codedge/dockerfiles 2020-08-17 07:42:25 +02:00
Holger Lösken
78b5e59cd5 No log for favicon or robots, making this vhost the default 2020-08-17 07:42:21 +02:00
codedge
d1a8922f7d Merge pull request #185 from codedge/master
Move guidelines to wiki, add sample nginx config
2020-08-16 22:40:23 +02:00
codedge
d87e5948bf Merge branch 'master' into master 2020-08-16 22:40:15 +02:00
Holger Lösken
f4cade9fac Move guidelines to wiki, add sample nginx config 2020-08-16 22:36:24 +02:00
codedge
49f4266418 Merge pull request #179 from HashDot/master
add missing npm/nodejs
2020-08-07 09:13:51 +02:00
Lars Hampe
e7f6ef4c35 add missing npm/nodejs 2020-07-30 10:07:50 +02:00
13 changed files with 264 additions and 202 deletions

76
CODE_OF_CONDUCT.md Normal file
View 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

182
README.md
View File

@@ -4,182 +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 key 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' \
--name invoiceninja \
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.

View File

@@ -2,7 +2,7 @@ ARG PHP_VERSION=7.2
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
@@ -24,8 +24,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 \
@@ -41,8 +41,8 @@ COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
# Separate user
ENV IN_USER=invoiceninja
RUN addgroup -S "$IN_USER" && \
adduser \
RUN addgroup --gid=1500 -S "$IN_USER" && \
adduser --uid=1500 \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
@@ -63,7 +63,6 @@ RUN curl -s -o /tmp/ninja.zip -SL https://download.invoiceninja.com/ninja-v${INV
&& 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 \
&& rm -rf /var/www/app/docs /var/www/app/tests

View File

@@ -1,4 +1,4 @@
ARG PHP_VERSION=7.3
ARG PHP_VERSION=7.4
# Get Invoice Ninja
FROM alpine:latest as base
@@ -7,6 +7,7 @@ ARG INVOICENINJA_VERSION
RUN set -eux; \
apk add --no-cache \
curl \
mysql-client \
libarchive-tools; \
mkdir -p /var/www/app
@@ -17,7 +18,6 @@ RUN curl -o /tmp/ninja.tar.gz -LJ0 https://github.com/invoiceninja/invoiceninja/
&& cp -R /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 \
&& cp /var/www/app/.env.dusk.example /var/www/app/.env.dusk.local \
&& rm -rf /var/www/app/docs /var/www/app/tests
# Install nodejs packages
@@ -33,7 +33,7 @@ FROM php:${PHP_VERSION}-fpm-alpine
ARG INVOICENINJA_VERSION
ENV INVOICENINJA_VERSION=$INVOICENINJA_VERSION
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,19 +43,25 @@ RUN chmod +x /usr/local/bin/docker-entrypoint
RUN set -eux; \
apk add --no-cache \
nodejs \
npm \
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/; \
libzip-dev \
oniguruma-dev \
git \
busybox-suid \
zip; \
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install -j$(nproc) \
bcmath \
exif \
gd \
gmp \
mbstring \
# mbstring \
mysqli \
opcache \
pdo \
@@ -65,11 +71,22 @@ RUN set -eux; \
COPY ./config/php/php.ini /usr/local/etc/php/php.ini
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
RUN apk add --no-cache \
chromium \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn
## Separate user
ENV INVOICENINJA_USER=invoiceninja
RUN addgroup -S "$INVOICENINJA_USER" && \
adduser \
RUN addgroup --gid=1500 -S "$INVOICENINJA_USER" && \
adduser --uid=1500 \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
@@ -79,17 +96,18 @@ RUN addgroup -S "$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
RUN composer install --no-dev --no-suggest --no-progress
RUN /usr/local/bin/composer install --no-dev --no-suggest --no-progress --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"]

16
config/cron.sh Executable file
View 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
View 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
View File

@@ -0,0 +1 @@
192.168.0.124 in5.test

View 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;
}
}

View File

@@ -2,76 +2,89 @@ 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
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 +95,7 @@ services:
# EOF'
# networks:
# - invoiceninja
volumes:
mysql-data:
public:
storage:
#
networks:
invoiceninja:

1
docker/app/public/.keep Normal file
View File

@@ -0,0 +1 @@

1
docker/app/storage/.keep Normal file
View File

@@ -0,0 +1 @@

View File

@@ -41,6 +41,7 @@ file_env() {
unset "$fileVar"
}
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
@@ -89,7 +90,11 @@ 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'
@@ -99,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
View 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