Skip to content

Production Environment

Diego Juliao edited this page Mar 11, 2018 · 3 revisions

Features

  • 🔥🔒 HTTPS Free HTTPS
  • 🔥 Wp-CLI WordPress Command Line Tool, useful to manage your WordPress site by console
  • 🔥 phpMyAdmin Database Administrator, useful to manage your database in graphic mode
  • Nginx HTTP Server
  • MariaDB DataBase, same as MySQL but opensource
  • Change the PHP version. You can change with ease the PHP version

Steps to Deploy your Site

  1. Pull and Build Docker Images
    • docker-compose --file docker-compose-production.yml pull
    • docker-compose --file docker-compose-production.yml build
  2. Just run docker network create nginx-proxy
  3. Create the user and a DB using phpMyAdmin
    • export DB_PASS=YOUR_SUPER_SECURE_PASSWORD && docker-compose --file docker-compose-production.yml up phpmyadmin
      • Replace YOUR_SUPER_SECURE_PASSWORD with the password that you want to use for the root user in your DB
    • Create an User and a Database with the same name and all privileges
      • Access to phpMyAdmin through YOUR_DOMAIN:8888
      • When creation the user make sure to allow connection from any host
  4. Change permission on the WordPress folder to allow our container add files to it
    • chown -R 82:root www/wp_files/
  5. Download the WordPress core
    • docker-compose --file docker-compose-production.yml run --rm --user=82 wp_server wp core download
  6. Create your wp-config file
    • docker-compose --file docker-compose-production.yml run --rm --user=82 wp_server wp core config --prompt
      • 1/12 --dbname=<dbname>: YOUR_DB_NAME
      • 2/12 --dbuser=<dbuser>: USER_CREATED_AT_1
      • 3/12 [--dbpass=<dbpass>]: PASS_CREATED_AT_1
      • 4/12 [--dbhost=<dbhost>]: mariadb
      • 5...12 - Default values set by enter
  7. Install WordPress
    • docker-compose run --rm --user=82 wp_server wp core install --prompt
      • 1/6 --url=<url>: localhost
      • 2...6 - Your personal configuration
  8. Up and Running You need to pass several arguments such as:
  • DB_PASS When the DB is raised this will be its root password
  • DOMAIN Put your domain your-domain.com. This is needed to the https set up.
  • EMAIL Put your email domain [email protected]. This is needed to the https set up.
    • export DB_PASS=YOUR_SUPER_SECURE_PASSWORD && export DOMAIN=your-domain.com && export [email protected] && docker-compose --file docker-compose-production.yml up -d && docker-compose --file docker-compose-production.yml stop wp_phpmyadmin
      • Visit YOUR_DOMAIN and enjoy

      This will stop the phpmyadmin service for security reasons, if you want to run it just docker-compose --file docker-compose-production.yml start phpmyadmin

Deployment Diagram

docker deployment diagram

Clone this wiki locally