Added documentation and install script from latest master

This commit is contained in:
bkraul 2019-07-09 12:47:37 -05:00
parent 188167f6b1
commit 52582f8eab
10 changed files with 152 additions and 25 deletions

89
README.md Normal file
View File

@ -0,0 +1,89 @@
# Description
This image provides the nginx and apache version of the Kimai2 time tracking system. For more information about Kimai2, go [here](https://www.kimai.org/).
# Features
Turn-key installation based on environment variables passed to the container. Creates initial super user on first install. Currently based on project's [master](https://github.com/kevinpapst/kimai2/).
# Usage
## docker-compose (preferred)
The recommended way of running is by using [jwilder/nginx-proxy](jwilder/nginx-proxy) as follows.
### With nginx-proxy
For installations where there is a bridged network dedicated to nginx proxy:
```yml
version: '3.7'
services:
kimai:
image: bkraul/kimai2:nginx-alpine
volumes:
- /etc/localtime:/etc/localtime:ro
- ./local.yaml:/app/config/packages/local.yaml
environment:
# nginx-proxy
- VIRTUAL_HOST=kimai.mydomain.com
- PHP_DATE_TIMEZONE=America/Chicago
# kimai2
- APP_ENV=prod
- DATABASE_URL=mysql://validsqlurl
- MAILER_FROM=kimai@mydomain.com
- MAILER_URL=smtp://validsmtpurl
- APP_SECRET=Superdupersecret
# initial admin user
- APP_ADMIN_USER=master
- APP_ADMIN_EMAIL=master@mydomain.com
- APP_ADMIN_PASS=masterPassword
networks:
- reverse-proxy
networks:
reverse-proxy:
external:
name: reverse-proxy
```
### Without nginx-proxy
For installations without nginx-proxy, a port usually needs to be mapped. The exposed ports in the container are 80 and 443 (see here for how)
```
version: '3.7'
services:
kimai:
image: bkraul/kimai2:nginx-alpine
volumes:
- /etc/localtime:/etc/localtime:ro
- ./local.yaml:/app/config/packages/local.yaml
ports:
- '8001:80'
environment:
# web server
- PHP_DATE_TIMEZONE=America/Chicago
# kimai2
- APP_ENV=prod
- DATABASE_URL=mysql://validsqlurl
- MAILER_FROM=kimai@mydomain.com
- MAILER_URL=smtp://validsmtpurl
- APP_SECRET=Superdupersecret
# initial admin user
- APP_ADMIN_USER=master
- APP_ADMIN_EMAIL=master@mydomain.com
- APP_ADMIN_PASS=masterPassword
```
# Environment variables
* `PHP_DATE_TIMEZONE`: Sets the correct php timezone.
* `APP_ENV`: The current kimai environment, [`dev, prod (default)`]
* `DATABASE_URL`: Valid URL for database. Use `mysql://user:pass@server.tld/database`
* `MAILER_FROM`: The from address for the mailing system.
* `MAILER_URL`: Valid swift mailer format URL. i.e. `smtp://server.tld:25?encryption=ssl&auth_mode=login&username=&password=`
* `APP_SECRET`: The encryption secret for the app.
* `APP_ADMIN_USER`: The user name for the first super admin to be created automatically.
* `APP_ADMIN_EMAIL`: First super admin email.
* `APP_ADMIN_PASS`: First super admin password.

View File

@ -7,9 +7,5 @@ echo MAILER_FROM=${MAILER_FROM} >> /app/.env
echo MAILER_URL=${MAILER_URL} >> /app/.env
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
su -c "/app/bin/console cache:clear --env=${APP_ENV} || true" -l application
su -c "cd /app && composer install --optimize-autoloader || true" -l application
su -c "/app/bin/console doctrine:schema:create || true" -l application
su -c "/app/bin/console doctrine:migrations:version --add --all -n || true" -l application
su -c "/app/bin/console cache:warmup --env=${APP_ENV} || true" -l application
su -c "/app/bin/console kimai:install || true" -l application
su -c "/app/bin/console kimai:create-user ${APP_ADMIN_USER} ${APP_ADMIN_EMAIL} ROLE_SUPER_ADMIN ${APP_ADMIN_PASS} --env=${APP_ENV} -vvv || true" -l application

View File

@ -7,9 +7,5 @@ echo MAILER_FROM=${MAILER_FROM} >> /app/.env
echo MAILER_URL=${MAILER_URL} >> /app/.env
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
su -c "/app/bin/console cache:clear --env=${APP_ENV} || true" -l application
su -c "cd /app && composer install --optimize-autoloader || true" -l application
su -c "/app/bin/console doctrine:schema:create || true" -l application
su -c "/app/bin/console doctrine:migrations:version --add --all -n || true" -l application
su -c "/app/bin/console cache:warmup --env=${APP_ENV} || true" -l application
su -c "/app/bin/console kimai:install || true" -l application
su -c "/app/bin/console kimai:create-user ${APP_ADMIN_USER} ${APP_ADMIN_EMAIL} ROLE_SUPER_ADMIN ${APP_ADMIN_PASS} --env=${APP_ENV} -vvv || true" -l application

11
develop/50-kimai-init.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin
echo Refreshing .env file...
echo APP_ENV=${APP_ENV} > /app/.env
echo DATABASE_URL=${DATABASE_URL} >> /app/.env
echo MAILER_FROM=${MAILER_FROM} >> /app/.env
echo MAILER_URL=${MAILER_URL} >> /app/.env
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
su -c "/app/bin/console kimai:install || true" -l application
su -c "/app/bin/console kimai:create-user ${APP_ADMIN_USER} ${APP_ADMIN_EMAIL} ROLE_SUPER_ADMIN ${APP_ADMIN_PASS} --env=${APP_ENV} -vvv || true" -l application

18
develop/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM webdevops/php-nginx:alpine
MAINTAINER Belman Kraul <bkraul@belmankraul.com>
ENV \
WEB_DOCUMENT_ROOT="/app/public"
RUN git clone https://github.com/kevinpapst/kimai2.git -b install-command /app && \
sed "s/prod/dev/g" /app/.env.dist > /app/.env && \
chown -R ${APPLICATION_UID}:${APPLICATION_GID} /app && \
su -c '/usr/local/bin/composer install --working-dir=/app --optimize-autoloader' -l application && \
su -c '/usr/local/bin/composer require zendframework/zend-ldap --working-dir=/app' -l application && \
rm /app/.env && \
touch /app/.env && \
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
COPY ./50-kimai-init.sh /opt/docker/provision/entrypoint.d/50-kimai-init.sh
WORKDIR /app

18
develop/Dockerfile.bak Normal file
View File

@ -0,0 +1,18 @@
FROM webdevops/php-nginx:alpine
MAINTAINER Belman Kraul <bkraul@belmankraul.com>
ENV \
WEB_DOCUMENT_ROOT="/app/public"
RUN git clone https://github.com/kevinpapst/kimai2.git /app && \
sed "s/prod/dev/g" /app/.env.dist > /app/.env && \
chown -R ${APPLICATION_UID}:${APPLICATION_GID} /app && \
su -c '/usr/local/bin/composer install --working-dir=/app --optimize-autoloader' -l application && \
su -c '/usr/local/bin/composer require zendframework/zend-ldap --working-dir=/app' -l application && \
rm /app/.env && \
touch /app/.env && \
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
COPY ./50-kimai-init.sh /opt/docker/provision/entrypoint.d/50-kimai-init.sh
WORKDIR /app

7
develop/build Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
docker pull webdevops/php-nginx:alpine
docker build $1\
-t bkraul/kimai2:develop \
.

View File

@ -7,9 +7,5 @@ echo MAILER_FROM=${MAILER_FROM} >> /app/.env
echo MAILER_URL=${MAILER_URL} >> /app/.env
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
su -c "/app/bin/console cache:clear --env=${APP_ENV} || true" -l application
su -c "cd /app && composer install --optimize-autoloader || true" -l application
su -c "/app/bin/console doctrine:schema:create || true" -l application
su -c "/app/bin/console doctrine:migrations:version --add --all -n || true" -l application
su -c "/app/bin/console cache:warmup --env=${APP_ENV} || true" -l application
su -c "/app/bin/console kimai:install || true" -l application
su -c "/app/bin/console kimai:create-user ${APP_ADMIN_USER} ${APP_ADMIN_EMAIL} ROLE_SUPER_ADMIN ${APP_ADMIN_PASS} --env=${APP_ENV} -vvv || true" -l application

View File

@ -7,9 +7,5 @@ echo MAILER_FROM=${MAILER_FROM} >> /app/.env
echo MAILER_URL=${MAILER_URL} >> /app/.env
chown ${APPLICATION_UID}:${APPLICATION_GID} /app/.env
su -c "/app/bin/console cache:clear --env=${APP_ENV} || true" -l application
su -c "cd /app && composer install --optimize-autoloader || true" -l application
su -c "/app/bin/console doctrine:schema:create || true" -l application
su -c "/app/bin/console doctrine:migrations:version --add --all -n || true" -l application
su -c "/app/bin/console cache:warmup --env=${APP_ENV} || true" -l application
su -c "/app/bin/console kimai:install || true" -l application
su -c "/app/bin/console kimai:create-user ${APP_ADMIN_USER} ${APP_ADMIN_EMAIL} ROLE_SUPER_ADMIN ${APP_ADMIN_PASS} --env=${APP_ENV} -vvv || true" -l application