Sign inSign up

dr4g0nsr/dbs-npr-stack

By dr4g0nsr

Updated 8 months ago

Fully automatic docker container with nginx php redis stack integrated

Image
0

2.4K

dr4g0nsr/dbs-npr-stack repository overview

Fully automatic docker container with nginx php redis stack integrated.

Supports turning on/off components of the image and automatic deployment od Wordpress.

Recommended method is to use boot script:

wget https://gist.githubusercontent.com/dr4g0nsr/dd134080cc07e2d0e505cdd08e84a5a4/raw/f974f75a903ef306c2856d602993cab75513a560/boot.sh
bash boot.sh

It will ask you a few things, similar like in docker-compose fields below.

Basic docker-compose:

version: '3.5'
services:
 npr:
   image: dr4g0nsr/dbs-npr-stack:latest
   restart: always
   container_name: npr
   hostname: npr
   ports:
     - 8080:80
     - 8443:443
   volumes:
     - ./data/log/nginx:/var/log/nginx
     - ./data/web:/var/www/html
     - ./data/sites-enabled:/etc/nginx/sites-enabled
     - ./data/ssl:/etc/nginx/ssl
     - /etc/letsencrypt:/etc/letsencrypt
   environment:
     NGINX_ENABLED: "true"
     PHP_ENABLED: "true"
     REDIS_ENABLED: "false"
     CRON_ENABLED: "false"
     COMPOSER: "false"
     NPM: "false"
     SITES: "https://www.example.com,https://www.example1.com,http://test.com"
     PROXY: "http://test.com-http://proxyto"
     LE: "test.com"
     EMAIL: "[email protected]"
     SELFSIGNED: "www.example1.com"
     WORDPRESS: "www.example.com"
     DATABASE_HOST: "db"
     DATABASE_USER: "wordpress"
     DATABASE_PASSWORD: "wordpress"
     DATABASE_NAME: "wordpress"
   stdin_open: true
   tty: true

 proxyto:
   image: nginx
   hostname: proxyto
   container_name: proxyto

 db:
   image: mysql:5.7
   container_name: db
   hostname: db
   restart: always
   environment:
      MYSQL_DATABASE: 'wordpress'
      MYSQL_USER: 'wordpress'
      MYSQL_PASSWORD: 'wordpress'
      MYSQL_ROOT_PASSWORD: 'root'
   volumes:
      - ./data/mysql:/var/lib/mysql

Here you can setup next things:

  • PHP: Do you want it to run PHP, false if not
  • NGINX: Do you want it to run NGINX, false if not
  • REDIS: Do you want it to run REDIS, false if not
  • CRON: If you want cron enabled
  • COMPOSER: If there's composer file in project
  • NPM: Should npm run on project
  • SITES: list of sites you want vh for, separated with coma. For site1.example.com and site2.example com you specify http://site1.example.com,http://site2.example.com
  • PROXY: where to proxy if you want reverse proxy, NGINX must be enabled. You specify in format from-to, for example http://from-http://to.
  • LE: get let's encrypt for this domains
  • EMAIL: email for LE
  • SELFSIGNED: self signed (generated) SSL certificate
  • WORDPRESS: Install wordpress on this sites automatically, if alreay installed it will just skip it
  • DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME: Wordpress DB credentials, need to exist for autodeploy to work

Super-simple example that should work:

version: '3.5'
services:
 npr:
   image: dr4g0nsr/dbs-npr-stack:latest
   restart: always
   container_name: npr
   hostname: npr
   ports:
     - 80:80
     - 443:443
   volumes:
     - ./data/log/nginx:/var/log/nginx
     - ./data/web:/var/www/html
     - ./data/sites-enabled:/etc/nginx/sites-enabled
     - ./data/ssl:/etc/nginx/ssl
     - /etc/letsencrypt:/etc/letsencrypt
   environment:
     NGINX_ENABLED: "true"
     PHP_ENABLED: "true"
     REDIS_ENABLED: "false"
     CRON_ENABLED: "false"
     COMPOSER: "false"
     NPM: "false"
     SITES: "https://domain.com"
     LE: "domain.com"
     EMAIL: "[email protected]"
     WORDPRESS: "domain.com"
     DATABASE_HOST: "db"
     DATABASE_USER: "wordpress"
     DATABASE_PASSWORD: "wordpress"
     DATABASE_NAME: "wordpress"
   stdin_open: true
   tty: true

 db:
   image: mysql:5.7
   container_name: db
   hostname: db
   restart: always
   environment:
      MYSQL_ROOT_PASSWORD: 'root'
   volumes:
      - ./data/mysql:/var/lib/mysql

Tag summary

Content type

Image

Digest

sha256:281281985

Size

285 MB

Last updated

8 months ago

docker pull dr4g0nsr/dbs-npr-stack