From c71fae6632da9fa433393501b2b23a0b64f9796a Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 10 May 2020 15:40:36 +0200 Subject: [PATCH] Update doc and examples (#8) --- .../docker-compose.yml | 2 +- .examples/nginx-proxy/docker-compose.yml | 2 +- .examples/readme.md | 2 +- .../supervisor/apache/docker-compose.yml | 2 +- .../supervisor/fpm-alpine/docker-compose.yml | 2 +- .examples/supervisor/fpm/docker-compose.yml | 2 +- .github/workflows/build.yml | 2 +- README.md | 78 ++++++++++++------- apache/Dockerfile | 2 +- fpm-alpine/Dockerfile | 2 +- fpm/Dockerfile | 2 +- 11 files changed, 59 insertions(+), 39 deletions(-) diff --git a/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml b/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml index 429c659..036f1dc 100644 --- a/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml +++ b/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml @@ -35,7 +35,7 @@ services: db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD=sekret_root_password + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret diff --git a/.examples/nginx-proxy/docker-compose.yml b/.examples/nginx-proxy/docker-compose.yml index 445ccfa..6964fdb 100644 --- a/.examples/nginx-proxy/docker-compose.yml +++ b/.examples/nginx-proxy/docker-compose.yml @@ -34,7 +34,7 @@ services: db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD=sekret_root_password + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret diff --git a/.examples/readme.md b/.examples/readme.md index 17d2734..ae26ad8 100644 --- a/.examples/readme.md +++ b/.examples/readme.md @@ -57,7 +57,7 @@ Don't forget to set: - `LETSENCRYPT_EMAIL` with a valid email - `APP_URL` in your `.env` file with the right domain url -You may want to set `APP_ENV=production` to force the use of `https` mode. +You may want to set `APP_ENV=production` to force the use of `https` scheme. This example add a `redis` container, that can be used too, adding these variables to your `.env` file: - `REDIS_HOST=redis`: mandatory diff --git a/.examples/supervisor/apache/docker-compose.yml b/.examples/supervisor/apache/docker-compose.yml index 5834b43..098bf43 100644 --- a/.examples/supervisor/apache/docker-compose.yml +++ b/.examples/supervisor/apache/docker-compose.yml @@ -16,7 +16,7 @@ services: db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD=sekret_root_password + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret diff --git a/.examples/supervisor/fpm-alpine/docker-compose.yml b/.examples/supervisor/fpm-alpine/docker-compose.yml index 03d1deb..cc742f2 100644 --- a/.examples/supervisor/fpm-alpine/docker-compose.yml +++ b/.examples/supervisor/fpm-alpine/docker-compose.yml @@ -25,7 +25,7 @@ services: db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD=sekret_root_password + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret diff --git a/.examples/supervisor/fpm/docker-compose.yml b/.examples/supervisor/fpm/docker-compose.yml index 03d1deb..cc742f2 100644 --- a/.examples/supervisor/fpm/docker-compose.yml +++ b/.examples/supervisor/fpm/docker-compose.yml @@ -25,7 +25,7 @@ services: db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD=sekret_root_password + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5193485..a9cc71f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - name: Install bashbrew run: | - curl -fsSL -o bashbrew https://doi-janky.infosiftr.net/job/bashbrew/lastSuccessfulBuild/artifact/bin/bashbrew-amd64 + curl -fsSL -o bashbrew https://doi-janky.infosiftr.net/job/bashbrew/job/master/lastSuccessfulBuild/artifact/bashbrew-amd64 chmod +x "bashbrew" echo "::add-path::$(pwd)" - name: Run stackbrew diff --git a/README.md b/README.md index 2209ce8..9caf864 100644 --- a/README.md +++ b/README.md @@ -73,12 +73,13 @@ See some examples of docker-compose possibilities in the [example section](/.exa This version will use the apache image and add a mysql container. The volumes are set to keep your data persistent. This setup provides **no ssl encryption** and is intended to run behind a proxy. -Make sure to pass in values for `APP_KEY` and `MYSQL_ROOT_PASSWORD` variables before you run this setup. +Make sure to pass in values for `APP_KEY` variable before you run this setup. Set `APP_KEY` to a random 32-character string. For example, if you have the `pwgen` utility installed, you could copy and paste the output of `pwgen -s 32 1`. +1. Create a `docker-compose.yml` file ```yaml version: "3.4" @@ -87,20 +88,20 @@ services: app: image: monica depends_on: - - mysql + - db ports: - 8080:80 environment: - APP_KEY= - - DB_HOST=mysql + - DB_HOST=db volumes: - data:/var/www/html/storage restart: always - mysql: + db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD= + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret @@ -115,14 +116,25 @@ volumes: name: mysql ``` -Run `docker-compose up -d`. +2. Set a value for `APP_KEY` variable before you run this setup. + It should be a random 32-character string. For example, if you have the `pwgen` utility installed, + you can copy and paste the output of + ```sh + pwgen -s 32 1 + ``` -Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. If this looks ok, add your first user account. +3. Run + ```sh + docker-compose up -d + ``` -Then run this command once: -```sh -docker-compose exec app php artisan setup:production -``` + Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. + If this looks ok, add your first user account. + +4. Run this command once: + ```sh + docker-compose exec app php artisan setup:production + ``` ### FPM version @@ -130,14 +142,12 @@ When using FPM image, you will need another container with a webserver to proxy The webserver will need an access to all static files from Monica container, the volumes `html` will deal with it. -An example of `nginx.conf` file can be found on the [`example section`](/.examples/supervisor/fpm/web/nginx.conf). - -Make sure to set values for `APP_KEY` and `MYSQL_ROOT_PASSWORD` variables before you run this setup. - -Set `APP_KEY` to a random 32-character string. For example, if you -have the `pwgen` utility installed, you could copy and paste the -output of `pwgen -s 32 1`. +1. Download `nginx.conf` file. An example can be found on the [`example section`](/scripts/docker/.examples/supervisor/fpm/web/nginx.conf) + ```sh + curl -sSL https://raw.githubusercontent.com/monicahq/monica/master/scripts/docker/.examples/supervisor/fpm/web/nginx.conf -o nginx.conf + ``` +2. Create a `docker-compose.yml` file ```yaml version: "3.4" @@ -146,10 +156,10 @@ services: app: image: monica:fpm depends_on: - - mysql + - db environment: - APP_KEY= - - DB_HOST=mysql + - DB_HOST=db volumes: - html:/var/www/html - data:/var/www/html/storage @@ -167,10 +177,10 @@ services: - data:/var/www/html/storage:ro restart: always - mysql: + db: image: mysql:5.7 environment: - - MYSQL_ROOT_PASSWORD= + - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=homestead - MYSQL_PASSWORD=secret @@ -187,19 +197,29 @@ volumes: name: mysql ``` -Run `docker-compose up -d`. +3. Set a value for `APP_KEY` variable before you run this setup. + It should be a random 32-character string. For example, if you have the `pwgen` utility installed, + you can copy and paste the output of + ```sh + pwgen -s 32 1 + ``` -Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. If this looks ok, add your first user account. +4. Run + ```sh + docker-compose up -d + ``` -Then run this command once: -```sh -docker-compose exec app php artisan setup:production -``` + Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. + If this looks ok, add your first user account. +5. Run this command once: + ```sh + docker-compose exec app php artisan setup:production + ``` ## Make Monica available from the internet -To expose your Monica instance for the internet, it's important to set `APP_ENV=production` in your `.env` file. In this case `https` mode will be mandatory. +To expose your Monica instance for the internet, it's important to set `APP_ENV=production` in your `.env` file or environment variables. In this case `https` scheme will be **mandatory**. ### Using a proxy webserver on the host diff --git a/apache/Dockerfile b/apache/Dockerfile index cfcd9da..2565117 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -66,7 +66,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.18; \ pecl install memcached-3.1.5; \ - pecl install redis-5.2.1; \ + pecl install redis-5.2.2; \ \ docker-php-ext-enable \ apcu \ diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index 366ddaf..8c4945f 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -65,7 +65,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.18; \ pecl install memcached-3.1.5; \ - pecl install redis-5.2.1; \ + pecl install redis-5.2.2; \ \ docker-php-ext-enable \ apcu \ diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 197fa66..242be00 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -66,7 +66,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.18; \ pecl install memcached-3.1.5; \ - pecl install redis-5.2.1; \ + pecl install redis-5.2.2; \ \ docker-php-ext-enable \ apcu \