Created Docker Compose with nginx (markdown)

codedge
2020-08-16 22:33:53 +02:00
parent 15e88b70b4
commit c227d19801

@@ -0,0 +1,129 @@
⚠️ The following guides aims at a completely fresh install of Invoice Ninja with the [nginx webserver](https://www.nginx.com/). The is no migration scenario covered.
We especially do not provide any TLS setup here. If you want to have TLS either use our [setup with Caddy](https://github.com/invoiceninja/dockerfiles/wiki/docker-compose-with-caddy) or read some guidline how to set up TLS with nginx.
## Table of content
* Guide for [Invoice Ninja 4](#guide-for-invoice-ninja-4)
* Guide for [Invoice Ninja 5](#guide-for-invoice-ninja-5)
## Prerequisites
Read the [prerequisites section](https://github.com/invoiceninja/dockerfiles/wiki/prerequisites) carefully as you need all of these information for a proper setup.
## Guide for Invoice Ninja 4
### 📁 Create a new folder
First we need an empty folder where our docker files for IN 4 will reside.
_Command_: `mkdir ~/invoiceninja4; cd ~/invoiceninja4`
### 💻 Clone this repository
Now we need to clone this repository to get all the files necessary to corretctly configure and run IN 4 with Docker Compose.
_Command_: `git clone https://github.com/invoiceninja/dockerfiles.git .`
### 🔨 Configure your installation
To get the complete overview what things can be configured please check the [`docker-compose.yml`](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml). Each section and value that can or should be configured is commented.
**Replace Caddy with nginx**
The first thing is to change the server container from Caddy to nginx. This is easily done with replacing the existing `image` with `image: nginx`.
**Add vhost configuration**
Next you need to change the configuration file. Exchange the existing one with this one
```yml
...
volumes:
# Vhost configuration
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
...
```
The config file `in-vhost.conf` comes bundled with the repository.
That's it. Nothing more is needed for a setup with nginx instead of Caddy. 💯
Some more things you might want to check:
* `APP_URL`: Environment variable where to reach your installation. The default one is `in.localhost`.
* Ports: Ports are configured for `80` and `443`. If you only operate o `80`, remove the `443`.
* Database settings: You can find the default settings in the [`docker-compose.yml` file at the db service](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml#L54). So for the `app` service the environment variables that should be added are:
* `DB_HOST`=db
* `DB_USERNAME`=ninja
* `DB_PASSWORD`=ninja
* `DB_DATABASE`=db-ninja-01
### 🚀 Run your installation
After you finished the afore mentioned steps you can now run your installation.
_Command_: `docker-compose up -d`
This will run Invoice Ninja 4 with the configuration made. You should now be able to reach your installation at the `APP_URL` configured.
## Guide for Invoice Ninja 5
### 📁 Create a new folder
First we need an empty folder where our docker files for IN 5 will reside.
_Command_: `mkdir ~/invoiceninja5; cd ~/invoiceninja5`
### 💻 Clone this repository
Now we need to clone this repository to get all the files necessary to corretctly configure and run IN 5 with Docker Compose.
_Command_: `git clone https://github.com/invoiceninja/dockerfiles.git .`
### 🔨 Configure your installation
To get the complete overview what things can be configured please check the [`docker-compose.yml`](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml). Each section and value that can or should be configured is commented.
**Replace Caddy with nginx**
The first thing is to change the server container from Caddy to nginx. This is easily done with replacing the existing `image` with `image: nginx`.
**Add vhost configuration**
Next you need to change the configuration file. Exchange the existing one with this one
```yml
...
volumes:
# Vhost configuration
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
...
```
The config file `in-vhost.conf` comes bundled with the repository.
That's it. Nothing more is needed for a setup with nginx instead of Caddy. 💯
Some more things you might want to check:
* `APP_URL`: Environment variable where to reach your installation. The default one is `in.localhost`.
* Ports: Ports are configured for `80` and `443`. If you only operate o `80`, remove the `443`.
* Database settings: You can find the default settings in the [`docker-compose.yml` file at the db service](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml#L54). So for the `app` service the environment variables that should be added are:
* `DB_HOST`=db
* `DB_USERNAME`=ninja
* `DB_PASSWORD`=ninja
* `DB_DATABASE`=db-ninja-01
### 🚀 Run your installation
After you finished the afore mentioned steps you can now run your installation.
_Command_: `docker-compose up -d`
This will run Invoice Ninja 5 with the configuration made. You should now be able to reach your installation at the `APP_URL` configured.