/wp-hosting

Manage your wordpress hosting

Primary LanguageShell

wp-hosting

Set of scripts to manage virtual wordpress servers for different clients.

Each server consists in a wordpress installation, phpmyadmin, mysql and an automated backup tool.

Architecture

All sites are in subdirectories of the wp-hosting directories. I generally like to call them wp.<client>.<domain> (example: wp.microsoft.live.com).

In each directory:

  • backups
  • config
  • docker-compose.yml
  • nginx-site
  • php.ini
  • ssl/nginx.crt ssl/nginx.key

config contains the high level informations used to generate all other files.

  • DOMAIN is a list of domain names.
  • *_PORT different ports to use for the services.
  • ROOT_PASSWORD database superuser password.
  • ADMIN_PASSWORD normal user and wordpress admin password.
  • SALT wordpress authentication salt.

When you create a project, the config file is generated.

When you initialize a project, the other files are generated.

When you start a project, service are started using the configuration files in the project folder. You can also customize them before if needed.

Tasks

Deploy a new site

We need to create, initialize then start a new project.

The project is for client albert that want to start a website for domain hellokitty.com. So we call the project wp.albert.hellokitty.com.

./create.sh wp.albert.hellokitty.com hellokitty.com

It'll generate a self-generated ssl certificate, you can fill real information of just go with the defaults. (ENTER ENTER ENTER...)

Let's check the configuration with cat wp.albert.hellokitty.com/config. Seems good, we can initialize the project.

./initialize.sh wp.albert.hellokitty.com

This will take a bit more than a minute to complete. Hopefully everything went fine. The project directory now contains a handful of new config files.

You might want to edit the nginx-site file if your website has additional domain names (see the server_name options).

We can now start the services.

./start.sh wp.albert.hellokitty.com

Once started, we need to reload the nginx configuration.

sudo service nginx reload

Last thing last, send the configuration details to the appropriate IT department.

./info.sh wp.albert.hellokitty

Send it by email!

Scripts

For the most up-to-date documentation, use --help options.

create.sh <project>

Generate a new project with a config file.

Use the first available port and generate random passwords.

initialize.sh <project>

Initialize a server from its config file.

Generates a docker-compose.yml file, prepare the database.

start.sh <project>

Starts the server.

stop.sh <project>

Stops the server.

cleanup.sh <project>

Delete a server. All run-time files will be deleted.

Backups will not be removed.

backup.sh <project>

Force a new backup.

Note that when a server is running, daily backups are performed.

restore.sh <project> <date>

Restore a backup.

logs.sh <project>

Display server logs.

import.sh <project> <date>

Import a project just copied from another host.

Will update the config file to use available port on this host and restore the specified backup.

Import an existing website

Migrate a website to another server

Troubleshooting

AIO-related error when starting mysql..

http://johanlouwers.blogspot.com/2010/02/aio-max-nr-parameter-for-oracle.html

echo 1048576 > /proc/sys/fs/aio-max-nr