Moving to AWS (?) – Part 7

Previous parts: 12, 34, 5 and 6.

It has been a slow week in regards to our AWS migration. Data transfers to S3 have been running for a few days, with many more to go. Because we are streaming the security camera footage we have to reserve some bandwidth for the stream data, which in turn slows down our upload speed. It might have been a better approach to start uploading data first, before migrating the security server. However in this case we are not under any time constraints.

Today we should try to migrate the web server currently hosting this very blog. Because the server hosting this website will also be used to host other services such as Subsonic we are going to use Docker. To get Docker installed we just need to run a few commands:

We will also install Docker Compose so that we can read in simple config files with settings for our containers. Docker Compose, along with up to date installation instructions can be found here.

To be able to run multiple websites on the same server, each in its own Docker container, we need something like this nginx proxy. We create a simple Docker Compose file called “nginx-proxy.yaml” (name does not matter) to launch the proxy:

The container is launched using:

We can now see our container is up and running:

OK, so now it is time to get a WordPress container added. Lucky for us there is a guide we can use to get started. Borrowing the Docker Compose settings from the guide we can add this to our nginx proxy file from earlier.

The Worpress data was then migrated from the old host to the new by using this plugin. Our final task will be to get HTTPS re-enabled using letsencrypt. We are in luck once again as this is easy to get configured since we are using the nginx-proxy Docker container. We will use the letsencrypt-nginx-proxy-companion container to get this working. Time for more Docker Compose file tweaking, adding on our WordPress container, its database, and the certificate generating container.

Some troubleshooting was had to get everything working, but we are now fully migrated and this post is being served from our new AWS EC2 instance. As a final task we update the Trello board:

Coming up in part 8 we will finish up our migrations by moving our Subsonic server to a Docker container. Once that is done we just need to wait for our file transfers to S3 to finish, after which we can shut off our last server.