Skip to content

Commit

Permalink
Improve Docker configuration, improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyril committed Nov 13, 2019
1 parent 1c8e717 commit c71244f
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 13 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 11 additions & 3 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
DATABASE_URL=mysql://davis:[email protected]: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
Expand Down
12 changes: 7 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.2-fpm
FROM php:7.3-fpm

# Mail : configuration for ssmtp
ARG email
Expand All @@ -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
Expand All @@ -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
35 changes: 35 additions & 0 deletions docker/configurations/davis.conf
Original file line number Diff line number Diff line change
@@ -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)(.*)$;
}
}
4 changes: 3 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c71244f

Please sign in to comment.