-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d7bf4d
commit f8c8c68
Showing
3 changed files
with
292 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,291 @@ | ||
--- | ||
title: Docker Compose | ||
description: Running Kimai with Docker compose | ||
canonical: /documentation/docker-compose.html | ||
--- | ||
|
||
This will run the latest prod version using FPM with an nginx reverse proxy: | ||
|
||
```dockerfile | ||
version: '3.5' | ||
services: | ||
|
||
sqldb: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_DATABASE=kimai | ||
- MYSQL_USER=kimaiuser | ||
- MYSQL_PASSWORD=kimaipassword | ||
- MYSQL_ROOT_PASSWORD=changemeplease | ||
volumes: | ||
- mysql:/var/lib/mysql | ||
command: --default-storage-engine innodb | ||
restart: unless-stopped | ||
healthcheck: | ||
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
nginx: | ||
image: tobybatch/nginx-fpm-reverse-proxy | ||
ports: | ||
- 8001:80 | ||
volumes: | ||
- public:/opt/kimai/public:ro | ||
restart: unless-stopped | ||
depends_on: | ||
- kimai | ||
healthcheck: | ||
test: wget --spider http://nginx/health || exit 1 | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
kimai: | ||
image: kimai/kimai2:latest | ||
environment: | ||
- [email protected] | ||
- ADMINPASS=changemeplease | ||
- DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8&serverVersion=5.7 | ||
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1 | ||
- MAILER_URL=smtp://mailer:1025 | ||
- [email protected] | ||
volumes: | ||
- public:/opt/kimai/public | ||
# - var:/opt/kimai/var | ||
# - ./ldap.conf:/etc/openldap/ldap.conf:z | ||
# - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z | ||
restart: unless-stopped | ||
|
||
phpmyadmin: | ||
image: phpmyadmin | ||
restart: always | ||
ports: | ||
- 8081:80 | ||
environment: | ||
- PMA_ARBITRARY=1 | ||
|
||
swagger: | ||
image: swaggerapi/swagger-ui | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- ./swagger.json:/swagger.json | ||
environment: | ||
- SWAGGER_JSON=/swagger.json | ||
|
||
mailer: | ||
image: schickling/mailcatcher | ||
ports: | ||
- "${MAILER_SMTP_PORT:-1025}:1025" | ||
- "${MAILER_ADMIN_PORT:-1080}:1080" | ||
|
||
volumes: | ||
var: | ||
public: | ||
mysql: | ||
``` | ||
|
||
## More examples | ||
|
||
Listed here are example setups for running the image(s). | ||
If you'd like to contribute a new one them please [raise a PR for this page](https://github.com/kimai/www.kimai.org/edit/main/_documentation/docker/docker-compose.md). | ||
|
||
Be aware that none of these images persist the DB between restarts, unless you add a volume to do that: | ||
```dockerfile | ||
volumes: | ||
- mysql:/var/lib/mysql | ||
``` | ||
|
||
### Apache dev | ||
|
||
```dockerfile | ||
version: '3.5' | ||
services: | ||
|
||
sqldb: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_DATABASE=kimai | ||
- MYSQL_USER=kimaiuser | ||
- MYSQL_PASSWORD=kimaipassword | ||
- MYSQL_ROOT_PASSWORD=changemeplease | ||
command: --default-storage-engine innodb | ||
restart: unless-stopped | ||
healthcheck: | ||
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
kimai: | ||
image: kimai/kimai2:apache-dev | ||
ports: | ||
- 8001:8001 | ||
environment: | ||
- [email protected] | ||
- ADMINPASS=changemeplease | ||
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8&serverVersion=5.7" | ||
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1 | ||
restart: unless-stopped | ||
``` | ||
|
||
### Apache prod | ||
|
||
```dockerfile | ||
version: '3.5' | ||
services: | ||
|
||
sqldb: | ||
image: mysql:5.7 | ||
volumes: | ||
- kimai-mysql:/var/lib/mysql | ||
environment: | ||
- MYSQL_DATABASE=kimai | ||
- MYSQL_USER=kimaiuser | ||
- MYSQL_PASSWORD=kimaipassword | ||
- MYSQL_ROOT_PASSWORD=changemeplease | ||
command: --default-storage-engine innodb | ||
restart: unless-stopped | ||
healthcheck: | ||
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
kimai: | ||
image: kimai/kimai2:apache | ||
volumes: | ||
- kimai-var:/opt/kimai/var | ||
ports: | ||
- 8001:8001 | ||
environment: | ||
- [email protected] | ||
- ADMINPASS=changemeplease | ||
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8&serverVersion=5.7" | ||
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1 | ||
restart: unless-stopped | ||
|
||
volumes: | ||
kimai-var: | ||
kimai-mysql: | ||
``` | ||
|
||
### FPM dev | ||
|
||
```dockerfile | ||
version: '3.5' | ||
services: | ||
|
||
sqldb: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_DATABASE=kimai | ||
- MYSQL_USER=kimaiuser | ||
- MYSQL_PASSWORD=kimaipassword | ||
- MYSQL_ROOT_PASSWORD=changemeplease | ||
command: --default-storage-engine innodb | ||
restart: unless-stopped | ||
healthcheck: | ||
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
nginx: | ||
image: tobybatch/nginx-fpm-reverse-proxy | ||
ports: | ||
- 8001:80 | ||
volumes: | ||
- public:/opt/kimai/public:ro | ||
restart: unless-stopped | ||
depends_on: | ||
- kimai | ||
healthcheck: | ||
test: wget --spider http://nginx/health || exit 1 | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
kimai: | ||
image: kimai/kimai2:fpm-dev | ||
environment: | ||
- [email protected] | ||
- ADMINPASS=changemeplease | ||
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8&serverVersion=5.7" | ||
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1 | ||
volumes: | ||
- public:/opt/kimai/public | ||
# - var:/opt/kimai/var | ||
# - ./ldap.conf:/etc/openldap/ldap.conf:z | ||
# - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z | ||
restart: unless-stopped | ||
|
||
volumes: | ||
var: | ||
public: | ||
``` | ||
|
||
### FPM prod | ||
|
||
```dockerfile | ||
version: '3.5' | ||
services: | ||
|
||
sqldb: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_DATABASE=kimai | ||
- MYSQL_USER=kimaiuser | ||
- MYSQL_PASSWORD=kimaipassword | ||
- MYSQL_ROOT_PASSWORD=changemeplease | ||
command: --default-storage-engine innodb | ||
restart: unless-stopped | ||
healthcheck: | ||
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
nginx: | ||
image: tobybatch/nginx-fpm-reverse-proxy | ||
ports: | ||
- 8001:80 | ||
volumes: | ||
- public:/opt/kimai/public:ro | ||
restart: unless-stopped | ||
depends_on: | ||
- kimai | ||
healthcheck: | ||
test: wget --spider http://nginx/health || exit 1 | ||
interval: 20s | ||
start_period: 10s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
kimai: | ||
image: kimai/kimai2:latest | ||
environment: | ||
- [email protected] | ||
- ADMINPASS=changemeplease | ||
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8&serverVersion=5.7" | ||
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1 | ||
volumes: | ||
- public:/opt/kimai/public | ||
# - var:/opt/kimai/var | ||
# - ./ldap.conf:/etc/openldap/ldap.conf:z | ||
# - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z | ||
restart: unless-stopped | ||
|
||
volumes: | ||
var: | ||
public: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,29 +58,6 @@ Keep in mind that this Docker setup is transient and the data will disappear whe | |
docker rm kimai-mysql-testing kimai-test | ||
``` | ||
|
||
## Using docker-compose | ||
|
||
This will run the latest prod version using FPM with an nginx reverse proxy | ||
|
||
See the [[docker-compose.yml]({{ site.kimai_v2_docker }}/blob/main/docker-compose.yml)] in the root of this repo. | ||
|
||
### Examples | ||
|
||
Listed here are example setups for running the image(s). If you'd like to contribute a new one them please raise a PR for this page. | ||
* [Apache dev]({{ site.kimai_v2_docker }}/tree/main/compose/docker-compose.apache.dev.yml) | ||
* [Apache prod]({{ site.kimai_v2_docker }}/tree/main/compose/docker-compose.apache.prod.yml) | ||
* [FPM dev]({{ site.kimai_v2_docker }}/tree/main/compose/docker-compose.fpm.dev.yml) | ||
* [FPM prod]({{ site.kimai_v2_docker }}/tree/main/compose/docker-compose.fpm.prod.yml) | ||
None of these images persist the DB between restarts, you will need to add a volume to do that: | ||
```dockerfile | ||
volumes: | ||
- mysql:/var/lib/mysql | ||
``` | ||
See the [docker-compose.yml](../docker-compose.yml) in the root of the repo. | ||
## Runtime Arguments | ||
|
||
The following settings can set at runtime: | ||
|
@@ -138,20 +115,6 @@ The ```DB_TYPE``` must be `mysql`: | |
|
||
|
||
|
||
{% comment %} | ||
|
||
### Build the docker | ||
|
@@ -181,26 +144,6 @@ Considering you started the machine named `default`, you find the IP with: | |
docker-machine ip default | ||
``` | ||
### Running commands in the docker | ||
|
||
You can run any command in the container in this fashion once it is started. Add `-ti` to attach a terminal. | ||
|
||
```bash | ||
docker exec -ti kimai2 bash | ||
``` | ||
|
||
#### Create a user and dummy data | ||
|
||
This creates a user admin/password with all privileges. | ||
```bash | ||
docker exec kimai2 /opt/kimai/bin/console kimai:user:create admin [email protected] ROLE_SUPER_ADMIN password | ||
``` | ||
|
||
To install the test data (fixtures): | ||
```bash | ||
docker exec kimai2 /opt/kimai/bin/console kimai:reset:dev | ||
``` | ||
|
||
### Using a custom local.yaml | ||
You can mount a [custom configuration]({% link _documentation/local-yaml.md %}) into the container while starting it: | ||
|