|
| 1 | +# Docker Container for Apache CloudStack Management Server |
| 2 | + |
| 3 | +This repository maintains the Dockerfile and scripts to build docker image for Apache CloudStack Management Server. |
| 4 | + |
| 5 | +## Steps |
| 6 | + |
| 7 | +### (Optional) Build docker image |
| 8 | + |
| 9 | + docker build -f Dockerfile -t ustcweizhou/cloudstack-management . |
| 10 | + |
| 11 | +### Update docker-compose configuration |
| 12 | + |
| 13 | +Edit cloudstack-mgt01.yaml and update to proper configuration |
| 14 | + |
| 15 | +### Install docker-compose |
| 16 | + |
| 17 | + apt install docker-compose -y |
| 18 | + |
| 19 | +### Create the containers |
| 20 | + |
| 21 | + docker-compose -f cloudstack-mgt01.yaml up -d |
| 22 | + |
| 23 | +### List the containers |
| 24 | + |
| 25 | + docker-compose -f cloudstack-mgt01.yaml ps |
| 26 | + |
| 27 | +## Advanced steps |
| 28 | + |
| 29 | +### Access the containers via docker-compose |
| 30 | + |
| 31 | + docker-compose -f cloudstack-mgt01.yaml exec mgt01 bash |
| 32 | + |
| 33 | +### Access the containers via IP (from container host) |
| 34 | + |
| 35 | +The container IP is accessible from other hosts, except the container host. |
| 36 | + |
| 37 | +To access container IP from the container host, or vice versa: |
| 38 | + |
| 39 | + ip link add cloudstack-nic link eth0 type macvlan mode bridge |
| 40 | + ip addr add 10.0.33.6/20 dev cloudstack-nic (only if the host IP is in different range as container IP) |
| 41 | + ip link set cloudstack-nic up |
| 42 | + ip route add 10.0.34.217/32 dev cloudstack-nic |
| 43 | + |
| 44 | +### Install CloudStack database |
| 45 | + |
| 46 | +You need to install mysql server in advance. |
| 47 | +You can create a mariadb galera cluster, refer to https://github.com/ustcweizhou/docker-mariadb-cluster |
| 48 | + |
| 49 | +Please note, GET_LOCK is not supported if WSREP_ON is ON. |
| 50 | + |
| 51 | + mysql> SELECT GET_LOCK('lock',10); |
| 52 | + ERROR 1235 (42000): This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)' |
| 53 | + |
| 54 | +To fix it, make the following change in the containers and restart them. |
| 55 | + |
| 56 | + sed -i "s/wsrep_on = ON/wsrep_on = OFF/g" /etc/mysql/conf.d/90-galera.cnf |
| 57 | + |
| 58 | +### Setup CloudStack database |
| 59 | + |
| 60 | + cloudstack-setup-databases cloud:cloud@10.0.34.213:13306 \ |
| 61 | + --deploy-as=root:cloudstack \ |
| 62 | + -e file -m mgtkey -k dbkey -i 10.0.34.217 |
| 63 | + |
| 64 | +### Manage CloudStack services |
| 65 | + |
| 66 | +To manage cloudstack management service: |
| 67 | + |
| 68 | + /usr/bin/cloudstack-management status/start/stop/restart |
| 69 | + |
| 70 | +To manage cloudstack usage service: |
| 71 | + |
| 72 | + /usr/bin/cloudstack-usage status/start/stop/restart |
| 73 | + |
0 commit comments