Improve Docker configuration, improve README

This commit is contained in:
Cyril 2019-11-13 10:59:05 +01:00
parent 1c8e71757a
commit c71244fb03
6 changed files with 76 additions and 13 deletions

View File

@ -3,9 +3,13 @@ Davis
A simple, fully translatable admin interface and frontend for `sabre/dav` based on [Symfony 4](https://symfony.com/) and [Bootstrap 4](https://getbootstrap.com/), largely inspired by [Baïkal](https://github.com/sabre-io/Baikal).
![Dashboard page](https://raw.githubusercontent.com/tchapi/davis/master/_screenshots/dashboard.png)
![User creation page](https://raw.githubusercontent.com/tchapi/davis/master/_screenshots/user.png)
# Requirements
PHP > 7.1.3, MySQL (or MariaDB).
PHP > 7.3.0, MySQL (or MariaDB).
# Installation
@ -170,11 +174,23 @@ If you use Nginx, you can add this to your configuration:
# Dockerized installation
A Dockerfile is available for you to compile the container.
A `Dockerfile` is available for you to compile the container.
We use `ssmtp` as a delivery service for a configured mailhost instead of using local delivery (_that should work out of the box_). You can ignore this or remove it from the Dockerfile if you want.
A `docker-compose.yml` file is also included as a minimal example setup.
A `docker-compose.yml` file is also included as a minimal example setup with a MariaDB database and Nginx as a reverse proxy.
You can start the containers with :
cd deploy && docker-compose up -d
**⚠ Do not forget to create the database the first time you run the container** :
docker exec -it davis bash -c "APP_ENV=prod bin/console migrate --no-interaction"
Then, head up to <YOUR_DOCKER_IP> to see the status display :
![Status page](https://raw.githubusercontent.com/tchapi/davis/master/_screenshots/status.png)
# Development

View File

@ -2,7 +2,7 @@
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"php": "^7.3.0",
"ext-ctype": "*",
"ext-iconv": "*",
"friendsofphp/php-cs-fixer": "^2.15",

View File

@ -1,11 +1,19 @@
DATABASE_URL=mysql://davis:davis@127.0.0.1:3306/davis
# For the MariaDB container
MYSQL_ROOT_PASSWORD=notSoSecure
MYSQL_DATABASE=davis
MYSQL_USER=davis_user
MYSQL_PASSWORD=davis_password
# For Davis
APP_ENV=prod
DATABASE_URL=mysql://davis_user:davis_password@mysql:3306/davis
ADMIN_LOGIN=admin
ADMIN_PASSWORD=test
ADMIN_PASSWORD=admin
AUTH_REALM=SabreDAV
AUTH_METHOD=Basic
AUTH_METHOD=Digest
CALDAV_ENABLED=true
CARDDAV_ENABLED=true

View File

@ -1,4 +1,4 @@
FROM php:7.2-fpm
FROM php:7.3-fpm
# Mail : configuration for ssmtp
ARG email
@ -24,11 +24,14 @@ RUN echo "root=${email}\nmailhub=${mail_host}\nrewriteDomain= \
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
# There are for php-intl
zlib1g-dev libicu-dev g++ \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Configure PHP extensions
RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install intl \
&& docker-php-source delete
# Davis installation
@ -40,10 +43,9 @@ RUN mv /var/www/1.0.0 /var/www/davis
WORKDIR /var/www/davis
# Install dependencies, and migrate the database if needed
# Install dependencies
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
RUN bin/console migrate --no-interaction
RUN APP_ENV=prod composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
RUN chown -Rf www-data:www-data .
RUN chmod -Rf g+w .
RUN chmod -Rf g+w var

View File

@ -0,0 +1,35 @@
# This is a very simple / naive configuration for Davis
upstream docker-davis {
server davis:9000;
}
server {
listen 80;
access_log off;
root /var/www/davis/public/;
index index.php;
rewrite ^/.well-known/caldav /dav redirect;
rewrite ^/.well-known/carddav /dav redirect;
charset utf-8;
location ~ /(\.ht) {
deny all;
return 404;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^(.+\.php)(.*)$ {
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_pass docker-davis;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_split_path_info ^(.+\.php)(.*)$;
}
}

View File

@ -11,9 +11,11 @@ services:
- davis
volumes:
- davis_www:/var/www/davis
- type: bind
source: ./configurations/davis.conf
target: /etc/nginx/conf.d/default.conf
ports:
- 80:80
- 443:443
mysql:
image: mariadb:latest