This commit is contained in:
Alexis Saettler 2020-07-05 14:29:49 +02:00
parent 6a521436c4
commit 053b629fef
No known key found for this signature in database
GPG Key ID: E0E7B3254E8E4407
1 changed files with 111 additions and 116 deletions

View File

@ -16,7 +16,7 @@ The `fpm` tag contains a fastCGI-Process that serves the web pages. This image s
This image contains a webserver that exposes port 80. Run the container with: This image contains a webserver that exposes port 80. Run the container with:
```sh ```console
docker run --name some-%%REPO%% -d -p 80:80 %%IMAGE%% docker run --name some-%%REPO%% -d -p 80:80 %%IMAGE%%
``` ```
@ -24,7 +24,7 @@ docker run --name some-%%REPO%% -d -p 80:80 %%IMAGE%%
This image serves a fastCGI server that exposes port 9000. You may need an additional web server that can proxy requests to the fpm port 9000 of the container. Run this container with: This image serves a fastCGI server that exposes port 9000. You may need an additional web server that can proxy requests to the fpm port 9000 of the container. Run this container with:
```sh ```console
docker run --name some-%%REPO%% -d -p 9000:9000 %%IMAGE%%:fpm docker run --name some-%%REPO%% -d -p 9000:9000 %%IMAGE%%:fpm
``` ```
@ -34,9 +34,9 @@ To have a persistent storage for your datas, you may want to create volumes for
Run a container with this named volume: Run a container with this named volume:
```sh ```console
docker run -d docker run -d \
-v monica_data:/var/www/html/storage -v monica_data:/var/www/html/storage \
%%IMAGE%% %%IMAGE%%
``` ```
@ -44,13 +44,13 @@ docker run -d
Like every Laravel application, the `php artisan` command is very usefull for Monica. To run a command inside the container, run Like every Laravel application, the `php artisan` command is very usefull for Monica. To run a command inside the container, run
```sh ```console
docker exec CONTAINER_ID php artisan COMMAND docker exec CONTAINER_ID php artisan COMMAND
``` ```
or for docker-compose or for docker-compose
```sh ```console
docker-compose exec %%REPO%% php artisan COMMAND docker-compose exec %%REPO%% php artisan COMMAND
``` ```
@ -68,138 +68,133 @@ This version will use the apache image and add a mysql container. The volumes ar
Make sure to pass in values for `APP_KEY` variable 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 1. Create a `docker-compose.yml` file
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"
```yaml services:
version: "3.4" app:
image: monica
depends_on:
- db
ports:
- 8080:80
environment:
- APP_KEY=
- DB_HOST=db
volumes:
- data:/var/www/html/storage
restart: always
services: db:
app: image: mysql:5.7
image: monica environment:
depends_on: - MYSQL_RANDOM_ROOT_PASSWORD=true
- db - MYSQL_DATABASE=monica
ports: - MYSQL_USER=homestead
- 8080:80 - MYSQL_PASSWORD=secret
environment: volumes:
- APP_KEY= - mysql:/var/lib/mysql
- DB_HOST=db restart: always
volumes:
- data:/var/www/html/storage
restart: always
db: volumes:
image: mysql:5.7 data:
environment: name: data
- MYSQL_RANDOM_ROOT_PASSWORD=true mysql:
- MYSQL_DATABASE=monica name: mysql
- MYSQL_USER=homestead ```
- MYSQL_PASSWORD=secret
volumes:
- mysql:/var/lib/mysql
restart: always
volumes: 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:
data:
name: data
mysql:
name: mysql
```
2. Set a value for `APP_KEY` variable before you run this setup. ```console
It should be a random 32-character string. For example, if you have the `pwgen` utility installed, pwgen -s 32 1
you can copy and paste the output of ```
```sh
pwgen -s 32 1
```
3. Run 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. ```console
If this looks ok, add your first user account. docker-compose up -d
```
4. Run this command once: 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.
```sh
docker-compose exec app php artisan setup:production 4. Run this command once:
```
```console
docker-compose exec app php artisan setup:production
```
### FPM version ### FPM version
When using FPM image, you will need another container with a webserver to proxy http requests. In this example we use nginx with a basic container to do this. When using FPM image, you will need another container with a webserver to proxy http requests. In this example we use nginx with a basic container to do this.
1. Download `nginx.conf` and `Dockerfile` file for nginx image. An example can be found on the [`example section`](%%GITHUB-REPO%%/blob/master/.examples/supervisor/fpm/web/). 1. Download `nginx.conf` and `Dockerfile` file for nginx image. An example can be found on the [`example section`](%%GITHUB-REPO%%/blob/master/.examples/supervisor/fpm/web/). The `web` container image should be pre-build before each deploy with: `docker-compose build`
The `web` container image should be pre-build before each deploy with: `docker-compose build`
2. Create a `docker-compose.yml` file 2. Create a `docker-compose.yml` file
```yaml ```yaml
version: "3.4" version: "3.4"
services: services:
app: app:
image: monica:fpm image: monica:fpm
depends_on: depends_on:
- db - db
environment: environment:
- APP_KEY= - APP_KEY=
- DB_HOST=db - DB_HOST=db
volumes: volumes:
- data:/var/www/html/storage - data:/var/www/html/storage
restart: always restart: always
web:
build: ./web
ports:
- 8080:80
depends_on:
- app
volumes:
- data:/var/www/html/storage:ro
restart: always
db: web:
image: mysql:5.7 build: ./web
environment: ports:
- MYSQL_RANDOM_ROOT_PASSWORD=true - 8080:80
- MYSQL_DATABASE=monica depends_on:
- MYSQL_USER=homestead - app
- MYSQL_PASSWORD=secret volumes:
volumes: - data:/var/www/html/storage:ro
- mysql:/var/lib/mysql restart: always
restart: always
volumes: db:
data: image: mysql:5.7
name: data environment:
mysql: - MYSQL_RANDOM_ROOT_PASSWORD=true
name: mysql - MYSQL_DATABASE=monica
``` - MYSQL_USER=homestead
- MYSQL_PASSWORD=secret
volumes:
- mysql:/var/lib/mysql
restart: always
3. Set a value for `APP_KEY` variable before you run this setup. volumes:
It should be a random 32-character string. For example, if you have the `pwgen` utility installed, data:
you can copy and paste the output of name: data
```sh mysql:
pwgen -s 32 1 name: mysql
``` ```
4. Run 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
docker-compose up -d
```
Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. ```console
If this looks ok, add your first user account. pwgen -s 32 1
```
5. Run this command once: 4. Run
```sh
docker-compose exec app php artisan setup:production ```console
``` 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:
```console
docker-compose exec app php artisan setup:production
```
## Make Monica available from the internet ## Make Monica available from the internet