In a VPS I have created a structure using docker where there is an NGINX Proxy Manager to handle the incoming requests and with a docker-compose.yaml I have 5-6 simple sites (no eCommerce) running. My problem is that the site after a long period of let's say inactivity it is like it's sleeping. It takes much time to do the first "loading". After that, on any device/network, the site is loading normally. The docker-compose.yaml I am using is the following
version: "3.9"
services:
db:
image: mariadb:latest
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: arootpassword
MYSQL_DATABASE: sitedb
MYSQL_USER: asiteuser
MYSQL_PASSWORD: asitepassword
deploy:
resources:
limits:
cpus: '0.5'
memory: 300M
reservations:
cpus: '0.25'
memory: 128M
networks:
- backend
redis:
image: 'redis:alpine'
restart: always
networks:
- backend
wordpress-site:
depends_on:
- db
image: wordpress:php8.2-apache
volumes:
- wordpress_data:/var/www/html
expose:
- "80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: asiteuser
WORDPRESS_DB_PASSWORD: asitepassword
WORDPRESS_DB_NAME: sitedb
deploy:
resources:
limits:
memory: 800M
reservations:
memory: 128M
networks:
- nginx-proxy
- backend
volumes:
db_data: {}
wordpress_data: {}
networks:
nginx-proxy:
name: nginx-proxy
external: true
backend:
external: false
While the NPM compose file I am using is the following
version: '3.8'
services:
npm:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
# - '81:81'
- '443:443'
expose:
- '81'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
deploy:
resources:
limits:
cpus: '0.50'
memory: 200M
reservations:
cpus: '0.25'
memory: 128M
networks:
default:
name: nginx-proxy
external: true
Any ideas? Is there any kind of configuration that I could allow docker to use 100% of the host or something to increase the performance? Is healthcheck something that I should consider?