mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Docker compose deploys use the correct passenger workers
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
#!/bin/bash
|
||||
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
||||
RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||
RAM_MB=$(expr $RAM_KB / 1024)
|
||||
RAM_GB=$(expr $RAM_MB / 1024)
|
||||
RAM_WITHOUT_OTHER_SERVICES=$(expr $RAM_MB - 1024) # other services use ~1024MB of RAM
|
||||
PASSENGER_POOL_FACTOR=$(expr $RAM_WITHOUT_OTHER_SERVICES / 256) # 2 pool workers use ~256MB of RAM
|
||||
PASSENGER_POOL_SIZE=$(expr $PASSENGER_POOL_FACTOR * 2)
|
||||
|
||||
#docker build -t wrestlingdev:test -f ${project_dir}/deploy/rails-prod-Dockerfile ${project_dir}
|
||||
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml kill
|
||||
|
||||
@@ -28,6 +28,7 @@ services:
|
||||
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
|
||||
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
|
||||
- WRESTLINGDEV_INFLUXDB_PORT=8086
|
||||
- PASSENGER_POOL_SIZE=${PASSENGER_POOL_SIZE}
|
||||
networks:
|
||||
database:
|
||||
caching:
|
||||
@@ -67,6 +68,7 @@ services:
|
||||
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
|
||||
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
|
||||
- WRESTLINGDEV_INFLUXDB_PORT=8086
|
||||
- PASSENGER_POOL_SIZE=${PASSENGER_POOL_SIZE}
|
||||
networks:
|
||||
database:
|
||||
caching:
|
||||
|
||||
@@ -34,12 +34,14 @@ spec:
|
||||
image: jcwimer/wrestlingdev:prod
|
||||
imagePullPolicy: Always
|
||||
command: ["bundle"]
|
||||
args: ["exec", "passenger", "start", "-p", "80", "--max-pool-size", "3","--environment", "production"]
|
||||
args: ["exec", "passenger", "start", "-p", "80", "--max-pool-size", "2","--environment", "production"]
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: RAILS_ENV
|
||||
value: production
|
||||
- name: PASSENGER_POOL_SIZE
|
||||
value: "2"
|
||||
- name: WRESTLINGDEV_DB_NAME
|
||||
value: wrestlingdev
|
||||
- name: WRESTLINGDEV_DB_USR
|
||||
|
||||
@@ -52,7 +52,7 @@ EXPOSE 443
|
||||
# Tini solves the zombie PID problem
|
||||
ENTRYPOINT ["/tini", "--"]
|
||||
|
||||
CMD bundle exec passenger start --max-pool-size 2 --min-instances 2 --environment production -p 80
|
||||
CMD bundle exec passenger start --max-pool-size ${PASSENGER_POOL_SIZE} --min-instances ${PASSENGER_POOL_SIZE} --environment production -p 80
|
||||
# Higher max pool uses more ram
|
||||
# Followed recommendation from: https://blog.phusion.nl/2015/11/10/heroku-and-passenger-focus-on-the-app-performance/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user