fotografeer.nl

fotografeer.nl

  • Overzicht
  • Fotografeer tips
  • Blog
  • Albums
  • Categorieën
  • Sets
  • Aanvraag
Home / Categories / Blog / Essays / WordPress in Docker on ReadyNAS OS VM
Share
2018/12/26

WordPress in Docker on ReadyNAS OS VM

Abstract

This blog post describes how to setup a virtualized ReadyNAS OS. Docker is then installed and configured to run Wordpress and MySQL in this environment.

Disclaimers

THIS HOWTO IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THIS HOWTO OR THE USE OR OTHER DEALINGS IN THIS HOWTO.

Netgear states: "Access by SSH is not discouraged, but is recommended for advanced users only. As such, using SSH is at the user's own risk."

This is how it worked in the situation of the baseline described below. Use it at your own risk.

Prerequisites

  • PC with Windows 7 SP1 with VirtualBox installed
  • Terminal emulation software
Prior Knowledge
  • ReadyNAS OS 6
  • WordPress installation procedure
  • Debian Linux command line syntax

Baseline

Even-though several combinations of items with other versions may be able to utilize this setup, this has only been tested on the baseline mentioned here:

  • Windows 7 SP1
  • VirtualBox 5.2.22 r126460 (Qt5.6.2)
  • VMDK disk image ReadyNASOS-6.6.0-x86_64.vmdk
  • WordPress 5.0.2
  • Putty 0.63

Please note that VirtualBox 6.0 is recently released.

References

This how-to builds on great work by others. Many thanks! See the links to their respective pages.

https://en.wikipedia.org/wiki/PuTTY
https://www.virtualbox.org/
https://www.virtualbox.org/wiki/Downloads
https://www.virtualbox.org/manual/ch03.html#installation_windows
https://gilsmethod.com/how-to-edit-the-default-virtual-machine-directories-in-virtualbox
https://github.com/ReadyNAS/sdk/wiki/Setup-ReadyNAS-OS-on-VirtualBox
https://www.docker.com/why-docker
https://hub.docker.com/_/wordpress/
https://docs.docker.com/compose/wordpress/
http://powareverb.github.io/Docker-on-ReadyNAS-OS6/

Background

After spending a lot of time of setting up 2 physical ReadyNAS machines to run this website, I'm reluctant to make changes to any settings, as it can potential break current functionality. Having a VM of the ReadyNAS OS is a great alternative to be able to experiment with new settings.

Since Koken CMS seems no longer being developed further, an alternative CMS is needed. Wordpress seems to be the obvious choice here.

With some hacking, Wordpress can be installed on the native ReadyNAS OS. While doing that, some issues popped up. E.g. getting the Wordpress .htaccess (mod_rewrite) to work proved difficult. And the versions of MySQL and PHP used in ReadyNAS OS are never the latest versions, since Netgear needs to deliver a stable OS for all it's customers, I guess. Latest versions of WordPress plugins may have requirements on MySQL that cannot be met.

WordPress runs on 3 main components:

  • Server-side scripting language: PHP
  • Web server: Apache (NGINX)
  • Database: MySQL (MariaDB)

Using Docker containers allows for a free choice of make and version for these 3 components without having to make changes to the ReadyNAS OS.

Below you can find the steps to come to a setup of Wordpress in Docker on ReadyNAS OS VM. Three product are used to enable this setup:

  • VMM: Virtual Box (to run ReadyNAS OS in a virtual machine on Windows)
  • Containerization: Docker (to run WordPress inside containers on the virtualized ReadyNAS OS)
  • CMS: WordPress (to create and manage your website)

VirtualBox

A Hypervisor (VMM) is needed to run the ReadyNAS OS Virtual Machine. First download VirtualBox. Then follow the installation instructions.

Set your default location to a disk with ample available space, so the VM for ReadyNAS OS that we are about to create can grow in size.

Now setup the ReadyNAS OS on VirtualBox.

There are several ways to setup the network connections for the virtual machine. Here we use NAT. Make sure to configure some NAT port translation to be able to connect to the VM from your Windows applications. In the VirtualBox Manager, select Network -> Adapter 1 -> Port forwarding.
Use the + button on the right to add rules for:

  • SSH 22 -> 22
  • HTTP 80 -> 80
  • HTTPS 433 -> 433
  • MySQL 3306 -> 3306
  • WordPress (on Docker) 8000 -> 8000
  • ReadyNAS OS configuration

    Browse to http://localhost/ to access the ReadyNAS Admin Page.

    Authenticate with default ReadyNAS Admin username and password:
    admin
    password

    Follow the instructions on screen as if you were setting up a physical ReadyNAS. Note the provided Hostname nas-XX-XX-XX. You might need it later on. Part of the procedure is to change your default admin password.

    Authenticate again with the admin username and (new) password.

    A pop-up window will alert you of the availability of new firmware. Upgrade to the new firmware version. When the progress bar almost reaches the far right, normally it would auto-refresh once the installation is complete. I needed to refresh the browser to see the admin page again.

    Go to "Settings" and enable "SSH".

    Docker

    Got to "Apps" -> "Available Apps".

    Click the Install button below the Docker CLI logo. Wait for the installation to finish.The Docker CLI will show up in the "Installed Apps" with the switch set to on.

    Now switch to your terminal emulator on Windows and login as root to localhost:22. In the terminal window, find the docker version and run the hello-world container to verify correct installation.You should see the text "Hello from Docker!" as part of the output.

    # docker -v
    Docker version 18.06.1-ce, build e68fc7a
    # docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    d1725b59e92d: Pull complete
    Digest: sha256:b3a26e22bf55e4a5232b391281fc1673f18462b75cdc76aa103e6d3a2bce5e77
    Status: Downloaded newer image for hello-world:latest
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    

    Wordpress

    First create a location where your Docker project for Wordpress can live. In the ReadyNAS Admin page, go to the Shares tab.

    Click the "New share" button in the top right corner to create a new share called e.g. "Projects". In the terminal emulator, create the project.

    # cd /data/Projects/
    # mkdir my_wordpress_project

    The latest version of Compose can be found on https://github.com/docker/compose/releases. E.g. 1.23.2. Use this version number in the URL of the curl command. Install and test the Docker Composer.

    # curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    # chmod +x /usr/local/bin/docker-compose
    # docker-compose --version
    docker-compose version 1.23.1, build b02f1306

    Next, go to the new project folder in the "Projects" share and follow the instructions below (based on the "Quickstart: Compose and WordPress" page) to create a YAML file that can be use by Docker Compose to retrieve and start the needed containers.

    # cd my_wordpress_project/
    # vi docker-compose.yml
    version: '3.3'
    services:
       db:
         image: mysql:5.7
         volumes:
           - db_data:/var/lib/mysql
         restart: always
         environment:
           MYSQL_ROOT_PASSWORD: somewordpress
           MYSQL_DATABASE: wordpress
           MYSQL_USER: wordpress
           MYSQL_PASSWORD: wordpress
       wordpress:
         depends_on:
           - db
         image: wordpress:latest
         ports:
           - "8000:80"
         restart: always
         environment:
           WORDPRESS_DB_HOST: db:3306
           WORDPRESS_DB_USER: wordpress
           WORDPRESS_DB_PASSWORD: wordpress
    volumes:
        db_data: {}
    # docker-compose up -d
    Creating network "my_first_project_default" with the default driver
    Creating volume "my_first_project_db_data" with default driver
    Pulling db (mysql:5.7)...
    5.7: Pulling from library/mysql
    a5a6f2f73cd8: Pull complete
    936836019e67: Pull complete
    283fa4c95fb4: Pull complete
    1f212fb371f9: Pull complete
    e2ae0d063e89: Pull complete
    5ed0ae805b65: Pull complete
    0283dc49ef4e: Pull complete
    a7905d9fbbea: Pull complete
    cd2a65837235: Pull complete
    5f906b8da5fe: Pull complete
    e81e51815567: Pull complete
    Pulling wordpress (wordpress:latest)...
    latest: Pulling from library/wordpress
    a5a6f2f73cd8: Already exists
    633e0d1cd2a3: Pull complete
    fcdfdf7118ba: Pull complete
    4e7dc76b1769: Pull complete
    c425447c8835: Pull complete
    75780b7b9977: Pull complete
    33ed51bc30e8: Pull complete
    7c4215700bc4: Pull complete
    d4f613c1e621: Pull complete
    de5465a3fde0: Pull complete
    6d373ffaf200: Pull complete
    991bff14f001: Pull complete
    d0a8c1ecf326: Pull complete
    aa3627a535bb: Pull complete
    a36be75bb622: Pull complete
    98ebddb8e6ca: Pull complete
    ed6e19b74de1: Pull complete
    18b9cc4a2286: Pull complete
    dfe625c958ac: Pull complete
    Creating my_first_project_db_1_d278ded39132 ... done
    Creating my_first_project_wordpress_1_e65d5f77183a ... done
    
    # docker ps
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
    993c01433ea9        wordpress:latest    "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        0.0.0.0:8000->80/tcp   my_first_project_wordpress_1_2762b868a024
    f9ba1041050d        mysql:5.7           "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        3306/tcp, 33060/tcp    my_first_project_db_1_923ac948ded6
    


    Browse to http://localhost:8000 to see the WordPress setup pages. Follow the instructions on screen.

    On the "Success!" page, select the "Log In" button. This will take you to the Wordpress Dashboard.

    Browse to http://localhost:8000/ to see the "My First Project" pages.

    Your setup is now ready and you are running WordPress in Docker on ReadyNAS OS VM!

Read more in Blog

Compile and Upload .ino file to Aruduino b… Digitaal Tijdperk
View all essays by month
View all essays by category
  1. 14

    Blog

  2. 13

    Fotografeer tips

  3. 6

    Portret

  4. 6

    Elfia

Links
  • Fotografeer tips
  • Tips - Introductie
  • Tips - Beelduitsnede
  • Tips - Scherpstellen
  • Tips - Compositie
  • Tips - Perspectief
  • Tips - Objectief categoriën
  • Tips - Objectief eigenschappen
  • Tips - Objectief beeldhoeken
  • Blog
  • Twitter
  • Facebook
Tweet
  • Overzicht
  • Fotografeer tips
  • Blog
  • Essays
  • Albums
  • Inhoud
  • Twitter
  • Facebook
© 1979-2025 Peter van Loon - fotografeer.nl - since 2003 | Built with Koken