From 3e991516a10dde173ff34a221095a3301337b82f Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 8 Apr 2020 13:35:33 +0200 Subject: [PATCH] Updated the docker configuration, using PHP 7.4 and MySQL v5.7, CAPTCHA also works now (#447). --- .gitignore | 4 ++-- docker/docker-compose.yml | 40 +++++++++++++++++---------------------- docker/mysql/.gitkeep | 0 docker/server/Dockerfile | 15 +++++++++++++++ docker/server/php.ini | 5 +++++ docs/docker.md | 28 +++++++++++++++------------ 6 files changed, 55 insertions(+), 37 deletions(-) create mode 100644 docker/mysql/.gitkeep create mode 100644 docker/server/Dockerfile create mode 100644 docker/server/php.ini diff --git a/.gitignore b/.gitignore index d6d7e800..e0de0c53 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,8 @@ /docs/apigen/html /docs/jsdoc/html /docs/plato/html -/docker/.env* -!/docker/.env.example +/docker/mysql/* +!/docker/mysql/.gitkeep /node_modules/ /npm-debug.log /assets/js/**/*.min.js diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 927869e6..c03d1f62 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,27 +1,21 @@ -version: '2' +version: "3.1" services: - database: + mysql: image: mysql:5.7 - environment: - - MYSQL_DATABASE=${DB_NAME} - - MYSQL_USER=${DB_USERNAME} - - MYSQL_PASSWORD=${DB_PASSWORD} - - MYSQL_ROOT_PASSWORD=${DB_PASSWORD} - - application: - image: easyappointments - build: - context: . + container_name: easyappointments-database volumes: - - ../src:/var/www/html - command: dev - ports: - - ${APP_HOST}:80:80 + - ./mysql:/var/lib/mysql environment: - - DB_HOST=database:3306 - - APP_URL=localhost - depends_on: - - database - env_file: - - .env - restart: always + - MYSQL_ROOT_PASSWORD=root + - MYSQL_DATABASE=easyappointments + ports: + - "8001:3306" + server: + build: ./server + image: easyappointments-server:v1 + container_name: easyappointments-server + ports: + - "8000:80" + volumes: + - ../:/var/www/html + - ./server/php.ini:/usr/local/etc/php/conf.d/99-overrides.ini diff --git a/docker/mysql/.gitkeep b/docker/mysql/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile new file mode 100644 index 00000000..9dc7289b --- /dev/null +++ b/docker/server/Dockerfile @@ -0,0 +1,15 @@ +FROM php:7.4-apache + +WORKDIR "/var/www/html" + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd gettext mysqli pdo_mysql + +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug diff --git a/docker/server/php.ini b/docker/server/php.ini new file mode 100644 index 00000000..5727af35 --- /dev/null +++ b/docker/server/php.ini @@ -0,0 +1,5 @@ +date.timezone=UTC +upload_max_filesize = 100M +post_max_size = 100M +xdebug.remote_enable=on +max_execution_time=0 diff --git a/docs/docker.md b/docs/docker.md index ebc6e980..e1f5b8e4 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,14 +1,12 @@ # Docker -Run the development containers of Easy!Appointments with Docker and Docker Compose utility. Docker allows you to compose your application from micro-services, without worrying about inconsistencies between development and production environments and without locking into any platform or language. +Run the development containers of Easy!Appointments with Docker and Docker Compose utility. Docker allows you to compose +your application from micro-services, without worrying about inconsistencies between development and production +environments and without locking into any platform or language. -Copy the `.env.example` file to `.env` inside the `docker` directory and set the desired environment variables. +Enter the `docker` directory and run `docker-compose up` to start the environment. -Make sure that you have Docker and Docker Compose installed and configured in your system and execute the following command through your terminal while being in `docker` directory of your Git clone: - -`docker-compose up` - -Then modify the root `config.php` so that it matches the following example: +You will need modify the root `config.php` so that it matches the following example: ```php class Config { @@ -16,7 +14,7 @@ class Config { // GENERAL SETTINGS // ------------------------------------------------------------------------ - const BASE_URL = 'http://{DOCKER-SERVER-IP}'; // e.g. 192.168.99.100 + const BASE_URL = 'http://localhost:8000'; const LANGUAGE = 'english'; const DEBUG_MODE = TRUE; @@ -24,16 +22,16 @@ class Config { // DATABASE SETTINGS // ------------------------------------------------------------------------ - const DB_HOST = 'database:3306'; + const DB_HOST = 'easyappointments-database:3306'; const DB_NAME = 'easyappointments'; - const DB_USERNAME = 'easyappointments'; - const DB_PASSWORD = 'easyappointments'; + const DB_USERNAME = 'root'; + const DB_PASSWORD = 'root'; // ------------------------------------------------------------------------ // GOOGLE CALENDAR SYNC // ------------------------------------------------------------------------ - const GOOGLE_SYNC_FEATURE = FALSE; + const GOOGLE_SYNC_FEATURE = FALSE; // You can optionally enable the Google Sync feature. const GOOGLE_PRODUCT_NAME = ''; const GOOGLE_CLIENT_ID = ''; const GOOGLE_CLIENT_SECRET = ''; @@ -41,6 +39,12 @@ class Config { } ``` +In the host machine the server is accessible from `http://localhost:8000` and the database from `localhost:8001`. + +You can remove the docker containers with `docker rm easyappointments-server easyappointments-database`. + +You can remove the server image with `docker rmi easyappointments-server:v1`. + *This document applies to Easy!Appointments v1.4.0.* [Back](readme.md)