Skip to content

Commit

Permalink
Merge pull request #14 from mintopia/develop
Browse files Browse the repository at this point in the history
Fix development containers
  • Loading branch information
mintopia authored Nov 20, 2023
2 parents 9c758a3 + 76b1409 commit bb6419f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,23 @@ You would then a docker-compose something like this:
version: '3'
services:
nginx:
image: ghcr.io/mintopia/musicparty-nginx:develop
image: ghcr.io/mintopia/musicparty-nginx:latest
ports:
- ${PORT}:80
restart: unless-stopped
depends_on:
- php-fpm

php-fpm:
image: ghcr.io/mintopia/musicparty-php-fpm:develop
image: ghcr.io/mintopia/musicparty-php-fpm:latest
env_file: .env
restart: unless-stopped
depends_on:
- db
- redis

scheduler:
image: ghcr.io/mintopia/musicparty-php-fpm:develop
image: ghcr.io/mintopia/musicparty-php-fpm:latest
entrypoint: [ "php" ]
command: "artisan schedule:work"
user: "1000"
Expand All @@ -105,7 +105,7 @@ services:
- redis

worker:
image: ghcr.io/mintopia/musicparty-php-fpm:develop
image: ghcr.io/mintopia/musicparty-php-fpm:latest
entrypoint: [ "php" ]
command: "artisan queue:work"
user: "1000"
Expand All @@ -117,7 +117,7 @@ services:
- redis

websockets:
image: ghcr.io/mintopia/musicparty-php-fpm:develop
image: ghcr.io/mintopia/musicparty-php-fpm:latest
ports:
- 6001:6001
entrypoint: [ "php" ]
Expand All @@ -130,7 +130,7 @@ services:
- redis

artisan:
image: ghcr.io/mintopia/musicparty-php-fpm:develop
image: ghcr.io/mintopia/musicparty-php-fpm:latest
entrypoint: [ "php", "artisan" ]
user: "1000"
env_file: .env
Expand All @@ -141,7 +141,7 @@ services:
- artisan

redis:
image: redis:6.0
image: redis:6.2.6
restart: unless-stopped

db:
Expand All @@ -162,6 +162,23 @@ volumes:
Run the stack with `docker-compose up -d` and the DB migrations using `docker-compose run --rm artisan migrate`.

### Performance

By default the production containers run using nginx and php-fpm with a very conservative number of workers. You can control the number with the following environment variables in `.env` or directly on the `php-fpm` container:

```
FPM_PM_MAX_CHILDREN=50
FPM_PM_START_SERVERS=10
FPM_PM_MIN_SPARE_SERVERS=5
FPM_PM_MAX_SPARE_SERVERS=10
```

These are used in the FPM configuration file, you can find more on configuring it in the php-fpm documentation.

### Performance Monitoring

You can monitor the nginx and php-fpm status using `/nginx-status` and `/fpm-status` HTTP endpoints. By default these are only allowed to be used by localhost and they shouldn't be exposed to the internet. You can control the IP range allowed to access them using the `STATUS_ALLOW` environment variable on the nginx container. It supports anything available for an `allow` command in nginx config.

## Usage

When it's running, it will create a managed Spotify playlist called something like `Spotify Party - ABCD`. Start playing this playlist and it'll handle the rest.
Expand Down
1 change: 0 additions & 1 deletion docker/develop/Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM ghcr.io/mintopia/php-docker-nginx:latest
LABEL maintainer="jess@mintopia.net"

RUN rm /etc/nginx/conf.d/default.conf
COPY docker/default.conf /etc/nginx/templates/conf.d/default.conf.template
2 changes: 1 addition & 1 deletion docker/develop/Dockerfile.php-fpm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ RUN apk update \
&& docker-php-ext-enable xdebug \
&& rm -rf /tmp/pear \
&& apk del --no-cache ${PHPIZE_DEPS} \
&& rm -vrf /tmp/pear /var/cache/apk/* \
&& rm -vrf /tmp/pear /var/cache/apk/*

USER 1000
1 change: 0 additions & 1 deletion docker/production/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ LABEL maintainer="jess@mintopia.net"

COPY --from=build --chown=1000:1000 /app/ /var/www

RUN rm /etc/nginx/conf.d/default.conf
COPY docker/default.conf /etc/nginx/templates/conf.d/default.conf.template

0 comments on commit bb6419f

Please sign in to comment.