Skip to content

Commit ffd2978

Browse files
committed
support multi node
Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
1 parent ec2fb11 commit ffd2978

9 files changed

Lines changed: 136 additions & 22 deletions

File tree

.github/workflows/action.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ jobs:
55
runs-on: ubuntu-20.04
66
steps:
77
- uses: actions/checkout@v2
8-
- name: hadolint
9-
run: docker run --rm -i hadolint/hadolint < Dockerfile
8+
- name: hadolint for controller
9+
run: docker run --rm -i hadolint/hadolint < controller/Dockerfile
10+
- name: hadolint for compute
11+
run: docker run --rm -i hadolint/hadolint < compute/Dockerfile
1012
test:
1113
runs-on: ubuntu-20.04
1214
steps:
@@ -18,4 +20,4 @@ jobs:
1820
- name: Exec OpenStack CLI
1921
run: |
2022
docker-compose logs -t --tail=100
21-
docker-compose exec -T --user stack devstack /bin/bash -c 'source devstack/openrc admin admin; openstack compute service list'
23+
docker-compose exec -T --user stack controller /bin/bash -c 'source devstack/openrc admin admin; openstack compute service list'

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ This will take about 30 minutes.
1313
$ sudo docker-compose up -d
1414

1515
$ sudo docker-compose logs -f
16-
devstack_1 | This is your host IP address: 172.28.0.2
17-
devstack_1 | Horizon is now available at http://172.28.0.2/dashboard
18-
devstack_1 | Keystone is serving at http://172.28.0.2/identity/
19-
devstack_1 | The default users are: admin and demo
20-
devstack_1 | The password: nomoresecret
21-
devstack_1 |
22-
devstack_1 | Services are running under systemd unit files.
23-
devstack_1 | For more information see:
24-
devstack_1 | https://docs.openstack.org/devstack/latest/systemd.html
25-
devstack_1 |
26-
devstack_1 | DevStack Version: wallaby
27-
devstack_1 | Change:
28-
devstack_1 | OS Version: Ubuntu 20.04 focal
16+
controller | This is your host IP address: 172.28.0.2
17+
controller | Horizon is now available at http://172.28.0.2/dashboard
18+
controller | Keystone is serving at http://172.28.0.2/identity/
19+
controller | The default users are: admin and demo
20+
controller | The password: nomoresecret
21+
controller |
22+
controller | Services are running under systemd unit files.
23+
controller | For more information see:
24+
controller | https://docs.openstack.org/devstack/latest/systemd.html
25+
controller |
26+
controller | DevStack Version: wallaby
27+
controller | Change:
28+
controller | OS Version: Ubuntu 20.04 focal
2929
```
3030

3131
You can use the OpenStack CLI in the container.
3232

3333
```bash
3434
$ sudo docker-compose exec \
3535
--user stack \
36-
devstack \
36+
controller \
3737
/bin/bash -c 'source devstack/openrc admin admin; exec /bin/bash'
3838

3939
stack@538b06c0fc0b:~$ openstack endpoint list

Dockerfile renamed to compute/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ RUN apt-get update \
1313
iproute2=5.5.0-1ubuntu1 \
1414
lsb=11.1.0ubuntu2 \
1515
git=1:2.25.1-1ubuntu3.1 \
16+
curl=7.68.0-1ubuntu2.5 \
1617
init=1.57 \
1718
&& apt-get -y clean \
1819
&& rm -rf /var/lib/apt/lists/*
20+
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for-it.sh \
21+
&& chmod a+x /bin/wait-for-it.sh
1922

2023
RUN useradd -s /bin/bash -d /opt/stack -m stack \
2124
&& mkdir -p /etc/sudoers.d/ \
@@ -26,8 +29,8 @@ RUN git clone https://github.com/openstack/devstack.git \
2629
&& git -C ./devstack checkout $DEVSTACK_COMMIT \
2730
&& chown -R stack:stack ./devstack
2831

29-
COPY local.conf /opt/stack/devstack/
30-
COPY devstack.service /etc/systemd/system/
32+
COPY compute/local.conf /opt/stack/devstack/
33+
COPY compute/devstack.service /etc/systemd/system/
3134
COPY 0001-devstack-disable-ovs.patch /opt/stack/
3235

3336
RUN patch -d ./devstack -p1 < 0001-devstack-disable-ovs.patch

compute/devstack.service

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=devstack
3+
4+
[Service]
5+
User=stack
6+
Type=oneshot
7+
ExecStartPre=/bin/wait-for-it.sh -h 172.28.0.2 -p 80 -t 3600
8+
ExecStart=/opt/stack/devstack/stack.sh
9+
ExecReload = /usr/bin/kill -HUP $MAINPID
10+
KillMode = process
11+
StandardOutput=tty
12+
13+
[Install]
14+
WantedBy=multi-user.target

compute/local.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[[local|localrc]]
2+
ADMIN_PASSWORD=nomoresecret
3+
DATABASE_PASSWORD=stackdb
4+
RABBIT_PASSWORD=stackqueue
5+
SERVICE_PASSWORD=$ADMIN_PASSWORD
6+
LOGFILE=$DEST/logs/stack.sh.log
7+
LOGDAYS=2
8+
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
9+
SWIFT_REPLICAS=1
10+
SWIFT_DATA_DIR=$DEST/data
11+
12+
ENABLED_SERVICES=n-cpu,placement-client
13+
14+
SERVICE_HOST=172.28.0.2
15+
MYSQL_HOST=$SERVICE_HOST
16+
RABBIT_HOST=$SERVICE_HOST
17+
GLANCE_HOSTPORT=$SERVICE_HOST:9292
18+
19+
[[post-config|$NOVA_CONF]]

controller/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM ubuntu:20.04
2+
3+
EXPOSE 80 5000 8773 8774 8775 8776 9292
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV DEVSTACK_COMMIT=83821a11ac1d6738b63cb10878b8aaa02e153374
6+
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends \
9+
ca-certificates=20210119~20.04.1 \
10+
patch=2.7.6-6 \
11+
systemd=245.4-4ubuntu3.5 \
12+
sudo=1.8.31-1ubuntu1.2 \
13+
iproute2=5.5.0-1ubuntu1 \
14+
lsb=11.1.0ubuntu2 \
15+
git=1:2.25.1-1ubuntu3.1 \
16+
curl=7.68.0-1ubuntu2.5 \
17+
init=1.57 \
18+
&& apt-get -y clean \
19+
&& rm -rf /var/lib/apt/lists/*
20+
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for-it.sh \
21+
&& chmod a+x /bin/wait-for-it.sh
22+
23+
RUN useradd -s /bin/bash -d /opt/stack -m stack \
24+
&& mkdir -p /etc/sudoers.d/ \
25+
&& echo "stack ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/stack
26+
27+
WORKDIR /opt/stack
28+
RUN git clone https://github.com/openstack/devstack.git \
29+
&& git -C ./devstack checkout $DEVSTACK_COMMIT \
30+
&& chown -R stack:stack ./devstack
31+
32+
COPY controller/local.conf /opt/stack/devstack/
33+
COPY controller/devstack.service /etc/systemd/system/
34+
COPY 0001-devstack-disable-ovs.patch /opt/stack/
35+
36+
RUN patch -d ./devstack -p1 < 0001-devstack-disable-ovs.patch
37+
RUN systemctl enable devstack
38+
39+
STOPSIGNAL SIGRTMIN+3
40+
CMD [ "/sbin/init" ]

local.conf renamed to controller/local.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SWIFT_REPLICAS=1
1010
SWIFT_DATA_DIR=$DEST/data
1111

1212
ENABLED_SERVICES=rabbit,mysql,key
13-
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,placement-api,placement-client
13+
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cond,n-sch,placement-api,placement-client
1414
ENABLED_SERVICES+=,g-api,g-reg
1515
ENABLED_SERVICES+=,horizon
1616

docker-compose.yaml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
version: '3'
22
services:
3-
devstack:
4-
build: .
3+
controller:
4+
container_name: controller
5+
hostname: controller
6+
build:
7+
context: .
8+
dockerfile: controller/Dockerfile
59
privileged: true
610
tty: true
11+
networks:
12+
management_network:
13+
ipv4_address: 172.28.0.2
14+
compute-1:
15+
container_name: compute-1
16+
hostname: compute-1
17+
build:
18+
context: .
19+
dockerfile: compute/Dockerfile
20+
privileged: true
21+
tty: true
22+
networks:
23+
management_network:
24+
ipv4_address: 172.28.0.3
25+
compute-2:
26+
container_name: compute-2
27+
hostname: compute-2
28+
build:
29+
context: .
30+
dockerfile: compute/Dockerfile
31+
privileged: true
32+
tty: true
33+
networks:
34+
management_network:
35+
ipv4_address: 172.28.0.4
36+
networks:
37+
management_network:
38+
driver: bridge
39+
ipam:
40+
driver: default
41+
config:
42+
- subnet: 172.28.0.0/24

0 commit comments

Comments
 (0)