Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variables #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Next, navigate in your terminal to the directory you cloned this, and spin up th

After that completes, follow the steps from the [src/README.md](src/README.md) file to get your WordPress installation added in (or create a new blank one).

Copy env.sample to .env and setup your secrets there.

Bringing up the Docker Compose network with `site` instead of just using `up`, ensures that only our site's containers are brought up at the start, instead of all of the command containers as well. The following are built for our web server, with their exposed ports detailed:

- **nginx** - `:80`
Expand Down
17 changes: 9 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
build:
context: .
dockerfile: nginx.dockerfile
container_name: nginx
container_name: nginx${PROJECT_NAME}
Kos-M marked this conversation as resolved.
Show resolved Hide resolved
ports:
- 80:80
- 443:443
Expand All @@ -22,15 +22,15 @@ services:

mysql:
image: mysql:5.7.29
container_name: mysql
container_name: mysql${PROJECT_NAME}
Kos-M marked this conversation as resolved.
Show resolved Hide resolved
restart: always
ports:
- 3306:3306
environment:
MYSQL_DATABASE: wp
MYSQL_USER: wp
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
SERVICE_TAGS: dev
SERVICE_NAME: mysql
networks:
Expand All @@ -40,17 +40,18 @@ services:
build:
context: .
dockerfile: php.dockerfile
container_name: php
container_name: php_${PROJECT_NAME}
volumes:
- ./wordpress:/var/www/html:delegated
- ./php/php.ini:/usr/local/etc/php/php.ini
networks:
- wordpress

wp:
build:
context: .
dockerfile: php.dockerfile
container_name: wp
container_name: wp${PROJECT_NAME}
Kos-M marked this conversation as resolved.
Show resolved Hide resolved
entrypoint: ['wp', '--allow-root']
volumes:
- ./wordpress:/var/www/html:delegated
Expand Down
5 changes: 5 additions & 0 deletions env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PROJECT_NAME=project1
DB_NAME=db_name
DB_USER=wp
DB_PASSWORD=secret
DB_ROOT_PASSWORD=secret
11 changes: 9 additions & 2 deletions nginx/certs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Add local certificates here to enable https

I personally like using [mkcert]() for this.
I personally like using [mkcert](https://github.com/FiloSottile/mkcert) for this.

Follow the installation instructions, then `cd` to this directory and use `mkcert` with the local domain name of your choosing.
Follow the installation instructions, then `cd` to this directory and use `mkcert` with the local domain name of your choosing.

After installation of mkcert

```
cd ./nginx/certs
mkcert -key-file wordpress-docker.test-key.pem -cert-file wordpress-docker.test.pem localhost *.localhost
```
3 changes: 3 additions & 0 deletions php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
upload_max_filesize = 132M
post_max_size = 64M
memory_limit = 128M