diff --git a/docs/installation/providers/docker.md b/docs/installation/providers/docker.md index d6aa62b9c..4ce962893 100644 --- a/docs/installation/providers/docker.md +++ b/docs/installation/providers/docker.md @@ -89,12 +89,13 @@ See some examples of docker-compose possibilities in the [example section](/scri 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" @@ -103,20 +104,21 @@ services: app: image: monicahq/monicahq depends_on: - - mysql + - db ports: - 8080:80 environment: + # generate with `pwgen -s 32 1` for instance: - APP_KEY= - - DB_HOST=mysql + - DB_HOST=db volumes: - data:/var/www/monica/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 @@ -131,14 +133,27 @@ volumes: name: mysql ``` -Run `docker-compose up -d`. +2. Set a value for `APP_KEY` variable before you run this setup. -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. + 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 + ``` + +3. Run + ```sh + docker-compose up -d + ``` + + 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 + ``` -Then run this command once: -```sh -docker-compose exec app php artisan setup:production -``` ### FPM version @@ -146,14 +161,13 @@ 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`](/scripts/docker/.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" @@ -162,10 +176,11 @@ services: app: image: monicahq/monicahq:fpm depends_on: - - mysql + - db environment: + # generate with `pwgen -s 32 1` for instance: - APP_KEY= - - DB_HOST=mysql + - DB_HOST=db volumes: - html:/var/www/monica - data:/var/www/monica/storage @@ -178,15 +193,16 @@ services: depends_on: - app volumes: + # see [`nginx.conf`](/scripts/docker/.examples/supervisor/fpm/web/nginx.conf) - ./nginx.conf:/etc/nginx/nginx.conf:ro - html:/var/www/monica:ro - data:/var/www/monica/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 @@ -203,19 +219,31 @@ volumes: name: mysql ``` -Run `docker-compose up -d`. +3. Set a value for `APP_KEY` variable before you run this setup. -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. + 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 + ``` -Then run this command once: -```sh -docker-compose exec app php artisan setup:production -``` +4. Run + ```sh + docker-compose up -d + ``` + + 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/scripts/docker/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml b/scripts/docker/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml index f7ba72b2b..551fa3352 100644 --- a/scripts/docker/.examples/nginx-proxy-self-signed-ssl/docker-compose.yml +++ b/scripts/docker/.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/scripts/docker/.examples/nginx-proxy/docker-compose.yml b/scripts/docker/.examples/nginx-proxy/docker-compose.yml index 62ab29e81..750a8d54c 100644 --- a/scripts/docker/.examples/nginx-proxy/docker-compose.yml +++ b/scripts/docker/.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/scripts/docker/.examples/readme.md b/scripts/docker/.examples/readme.md index 17d2734cc..ae26ad808 100644 --- a/scripts/docker/.examples/readme.md +++ b/scripts/docker/.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/scripts/docker/.examples/supervisor/apache/docker-compose.yml b/scripts/docker/.examples/supervisor/apache/docker-compose.yml index 2ab91e8de..d64e5135a 100644 --- a/scripts/docker/.examples/supervisor/apache/docker-compose.yml +++ b/scripts/docker/.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/scripts/docker/.examples/supervisor/fpm/docker-compose.yml b/scripts/docker/.examples/supervisor/fpm/docker-compose.yml index fa9cfed41..3a6d76a99 100644 --- a/scripts/docker/.examples/supervisor/fpm/docker-compose.yml +++ b/scripts/docker/.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/scripts/docker/.examples/supervisor/php-apache/docker-compose.yml b/scripts/docker/.examples/supervisor/php-apache/docker-compose.yml index 2ab91e8de..d64e5135a 100644 --- a/scripts/docker/.examples/supervisor/php-apache/docker-compose.yml +++ b/scripts/docker/.examples/supervisor/php-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