Install WordPress dan Mysql pada container mikrotik

we will using mikrotik terminal. Silahkan dirubah sesuai kebutuhan jika perlu.

jika belum mengaktifkan container, gunakan perintah berikut

/system/device-mode/update container=yes
lalu restart mikrotik anda

/system/device-mode/print
mode: enterprise
container: yes

 

/interface/veth/
add address=172.1.0.3/24 gateway=172.1.0.1 name=MYSQL
add address=172.1.0.4/24 gateway=172.1.0.1 name=PHPMYADMIN
add address=172.1.0.5/24 gateway=172.1.0.1 name=WORDPRESS

/interface/bridge/
add name=docker
/interface/bridge/port/
add bridge=docker interface=WORDPRESS
add bridge=docker interface=MYSQL
add bridge=docker interface=PHPMYADMIN

/ip/address/
add address=172.1.0.1/24 interface=docker network=172.1.0.0
/ip/firewall/nat/
add action=masquerade chain=srcnat src-address=172.1.0.0/24
add action=dst-nat chain=dstnat dst-port=82 protocol=tcp to-addresses=172.1.0.3 to-ports=80
add action=dst-nat chain=dstnat dst-port=83 protocol=tcp to-addresses=172.1.0.4 to-ports=80
add action=dst-nat chain=dstnat dst-port=84 protocol=tcp to-addresses=172.1.0.5 to-ports=80

/container/config/
set registry-url=https://registry-1.docker.io tmpdir=pull

 

/container/mounts/
add dst=/docker-entrypoint-initdb.d name=mysql_dump src=/docker/MYSQL/dump
add dst=/var/lib/mysql name=mysql_data src=/docker/MYSQL/data

/container/envs/
add name=MYSQL key=MYSQL_DATABASE value=wordpress
add name=MYSQL key=MYSQL_ROOT_PASSWORD value=root123
add name=MYSQL key=MYSQL_USER value=user
add name=MYSQL key=MYSQL_PASSWORD value=user123
add name=WORDPRESS key=WORDPRESS_DB_HOST value=172.1.0.3
add name=WORDPRESS key=WORDPRESS_DB_USER value=user
add name=WORDPRESS key=WORDPRESS_DB_PASSWORD value=user123
add name=WORDPRESS key=WORDPRESS_DB_NAME value=wordpress
add name=WORDPRESS key=WORDPRESS_TABLE_PREFIX value=wp_
add name=PHPMYADMIN key=PMA_HOST value=172.1.0.3
add name=PHPMYADMIN key=UPLOAD_LIMIT value=500M

 

/container
add remote-image=wordpress:latest envlist=WORDPRESS hostname=wordpress interface=WORDPRESS root-dir=docker/WORDPRESS
add remote-image=phpmyadmin:latest envlist=PHPMYADMIN hostname=phpmyadmin interface=PHPMYADMIN root-dir=docker/PHPMYADMIN
add remote-image=mysql:latest envlist=MYSQL hostname=mysql interface=MYSQL mounts=mysql_data,mysql_dump root-dir=docker/MYSQL

 

setelah semuanya selesai, bisa di start.

WARNING!!!
untuk PHPMYADMIN, WORDPRESS kemungkinan akan gagal start pada awal. untuk mengatasinya:

gunakan ftp/ssh atau shell pada container mikrotik untuk menghapus 2 file

mpm_event.conf dan mpm_event.load

/docker/(PHPMYADMIN, WORDPRESS)/etc/apache2/mods-enabled/mpm_event.load

/docker/(PHPMYADMIN, WORDPRESS)/etc/apache2/mods-enabled/mpm_event.conf