Oracle Cloud Arm Virtual Machine with Portainer Lets Encrypt
Appreciate Oracle Cloud provides a nice free tier virtual machine with 4 CPUs and 24 GB RAM.
This article documents how to setup WordPress + Let's encrypt + Portainer on Oracle Cloud free tier plan.
Oracle Cloud Signup
- Signup for Oracle Cloud Free Tier
- Login oracle cloud
- Create a VM instance
- On Image section, select the image you are comfortable with. Select image shape, choose
Ampere, and configure CPU to 4 and RAM to 24GB - Download ssh key and create the VM
Docker Setup
- Login into the VM with ssh key
-
Install Docker and Docker Compose, here I use oracle linux as an example
Please update the version accordingly for docker-compose from release page
sudo yum install docker-engine
Don't forget to perform docker post installation steps
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-aarch64" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
Get a domain
You can prepare your domain or get a free one from freenom.com.
Update domains DNS to point to the created VM machine
eg: create the following and all point to VM machine's public IP
portainer.domain.com
www.domain.com
domain.com
wordpress.domain.com
test.domain.com
Portainer With Lets encrypt Setup
Here is the fun part, with these 2 github repositories, we can get a SSL and load balancer for free
-
Follow nginx-proxy-automation to setup let's encrypt.
you should be able to access portainer.domain.com with https if you run this test cmd, this will generate cert on cert and key/home/opc/proxy/data/certs/portainer.domain.com.crt, which will be used in next step
./ssl_test.sh portainer.domain.com -
Follow docker-portainer-letse ncrypt
- set one domain in
DOMAINS=portainer.domain.comas we will use main domain for wordpress - set
NETWORK=proxy, notwebproxy, sincenginx-proxy-automationproject createdproxynetwork - run
docker-compose up -d, put a password for portainer - access
portainer.domain.comsee if portainer works
- set one domain in
MariaDB Setup
Setup maria db as it use much less memory (100MB) vs MySQL(400MB), and have arm64 docker image
- Login portainer, go to
App templates - Select
MariaDB - Enter root password
- Click
Advanced Settings, enter a port - In volume mapping, bind a host data folder to
/var/lib/mysql. this prevents database persisted if the container is removed. - In host name, type a name, we will use this name for wordpress to access DB, eg:
mairadb - In Network, select
proxy - Create container and login to create a wordpress db
WordPress Setup
- Create a container, not from
App templates - Image type
wordpress:latest - Env type the following, these are required so let's encrypt container and generate ssl for wordpress
LETSENCRYPT_EMAIL [email protected] LETSENCRYPT_HOST wordpress.domain.com,www.domain.com,domain.com VIRTUAL_HOST wordpress.domain.com,www.domain.com,domain.com VIRTUAL_PORT 8080 WORDPRESS_DB_HOST mariadb WORDPRESS_DB_NAME wordpress WORDPRESS_DB_PASSWORD your_db_password WORDPRESS_DB_USER root - Network select
proxy - Restart policy select
always - Hostname
wordpress - Port mapping
8080->80 - Volume mapping, bind
/home/opc/your_wordpress_data_folderto/var/www/html - Create container and wait for few seconds, access
www.domain.comyou can see wordpress.
All these comes from memory done few days ago, if something is wrong or outdated, please comment
