Skip to content

Commit

Permalink
wording to warn about the non-production state of the fpm proxy image
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Jan 28, 2024
1 parent 387bccb commit a783365
Showing 1 changed file with 93 additions and 82 deletions.
175 changes: 93 additions & 82 deletions _documentation/docker/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ 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:
Several docker-compose example files that use the latest Kimai version.

## Apache (prod)

```dockerfile
version: '3.5'
services:

sqldb:
image: mysql:5.7
volumes:
- mysql:/var/lib/mysql
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:
Expand All @@ -28,79 +30,25 @@ services:
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
image: kimai/kimai2:apache
volumes:
- data:/opt/kimai/var/data
ports:
- 8001:8001
environment:
- [email protected]
- ADMINPASS=changemeplease
- DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8mb4&serverVersion=5.7.40
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8mb4&serverVersion=5.7.40"
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1
- MAILER_URL=smtp://mailer:1025
- [email protected]
volumes:
- public:/opt/kimai/public
# - data:/opt/kimai/var/data
# - ./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:
data:
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
data:
mysql:
```

### Apache dev
## Apache (dev)

```dockerfile
version: '3.5'
Expand Down Expand Up @@ -134,16 +82,32 @@ services:
restart: unless-stopped
```

### Apache prod
## FPM and nginx

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).

None of these images persist the DB between restarts, unless you add a volume to do that:
```dockerfile
volumes:
- mysql:/var/lib/mysql
```

{% capture proxImage %}
Be aware that the below image [tobybatch/nginx-fpm-reverse-proxy](https://github.com/tobybatch/nginx-fpm-reverse-proxy) is only meant as example.
It is not made for production usage. Use your existing reverse proxy instead!
{% endcapture %}
{% assign proxImage = proxImage|markdownify %}
{% include alert.html icon="fas fa-exclamation" type="danger" alert=proxImage %}

### Production

```dockerfile
version: '3.5'
services:

sqldb:
image: mysql:5.7
volumes:
- mysql:/var/lib/mysql
environment:
- MYSQL_DATABASE=kimai
- MYSQL_USER=kimaiuser
Expand All @@ -158,26 +122,44 @@ services:
timeout: 10s
retries: 3

kimai:
image: kimai/kimai2:apache
volumes:
- data:/opt/kimai/var/data
nginx:
image: tobybatch/nginx-fpm-reverse-proxy
ports:
- 8001:8001
- 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=utf8mb4&serverVersion=5.7.40"
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1
volumes:
- public:/opt/kimai/public
# - data:/opt/kimai/var/data
# - ./ldap.conf:/etc/openldap/ldap.conf:z
# - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z
restart: unless-stopped

volumes:
data:
mysql:
data:
public:
mysql:
```

### FPM dev

### With addons
```dockerfile
version: '3.5'
services:
Expand All @@ -189,6 +171,8 @@ services:
- MYSQL_USER=kimaiuser
- MYSQL_PASSWORD=kimaipassword
- MYSQL_ROOT_PASSWORD=changemeplease
volumes:
- mysql:/var/lib/mysql
command: --default-storage-engine innodb
restart: unless-stopped
healthcheck:
Expand All @@ -215,25 +199,51 @@ services:
retries: 3

kimai:
image: kimai/kimai2:fpm-dev
image: kimai/kimai2:latest
environment:
- [email protected]
- ADMINPASS=changemeplease
- "DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8mb4&serverVersion=5.7.40"
- DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai?charset=utf8mb4&serverVersion=5.7.40
- TRUSTED_HOSTS=nginx,localhost,127.0.0.1
- MAILER_URL=smtp://mailer:1025
- [email protected]
volumes:
- public:/opt/kimai/public
# - data:/opt/kimai/var/data
# - ./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:
data:
public:
mysql:
```

### FPM prod
### Development

```dockerfile
version: '3.5'
Expand Down Expand Up @@ -272,7 +282,7 @@ services:
retries: 3

kimai:
image: kimai/kimai2:latest
image: kimai/kimai2:fpm-dev
environment:
- [email protected]
- ADMINPASS=changemeplease
Expand All @@ -288,4 +298,5 @@ services:
volumes:
data:
public:
mysql:
```

0 comments on commit a783365

Please sign in to comment.