Skip to content

Commit eeaaa5a

Browse files
committed
first commit
Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
0 parents  commit eeaaa5a

6 files changed

Lines changed: 169 additions & 0 deletions

File tree

0001-devstack-disable-ovs.patch

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
diff --git a/lib/databases/mysql b/lib/databases/mysql
2+
index d4969d71..fd26b2bc 100644
3+
--- a/lib/databases/mysql
4+
+++ b/lib/databases/mysql
5+
@@ -84,7 +84,7 @@ function configure_database_mysql {
6+
fi
7+
8+
# Start mysql-server
9+
- if is_fedora || is_suse; then
10+
+ if is_fedora || is_suse || is_ubuntu; then
11+
# service is not started by default
12+
start_service $MYSQL_SERVICE_NAME
13+
fi
14+
diff --git a/lib/neutron_plugins/ovs_base b/lib/neutron_plugins/ovs_base
15+
index 2e63fe3c..493a7d04 100644
16+
--- a/lib/neutron_plugins/ovs_base
17+
+++ b/lib/neutron_plugins/ovs_base
18+
@@ -55,7 +55,7 @@ function _neutron_ovs_base_install_ubuntu_dkms {
19+
kernel_major_minor=`echo $kernel_version | cut -d. -f1-2`
20+
# From kernel 3.13 on, openvswitch-datapath-dkms is not needed
21+
if vercmp "$kernel_major_minor" "<" "3.13" ; then
22+
- install_package "dkms openvswitch-datapath-dkms linux-headers-$kernel_version"
23+
+ true
24+
fi
25+
}
26+
27+
diff --git a/lib/nova b/lib/nova
28+
index 930529a4..ebc50970 100644
29+
--- a/lib/nova
30+
31+
...skipping 1 line
32+
@@ -318,7 +318,7 @@ EOF
33+
fi
34+
35+
# ensure that iscsid is started, even when disabled by default
36+
- restart_service iscsid
37+
+ # restart_service iscsid
38+
fi
39+
40+
# Rebuild the config file from scratch

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
init=1.57 \
17+
&& apt-get -y clean \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
RUN useradd -s /bin/bash -d /opt/stack -m stack \
21+
&& mkdir -p /etc/sudoers.d/ \
22+
&& echo "stack ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/stack
23+
24+
WORKDIR /opt/stack
25+
RUN git clone https://github.com/openstack/devstack.git \
26+
&& git -C ./devstack checkout $DEVSTACK_COMMIT \
27+
&& chown -R stack:stack ./devstack
28+
29+
COPY local.conf /opt/stack/devstack/
30+
COPY devstack.service /etc/systemd/system/
31+
COPY 0001-devstack-disable-ovs.patch /opt/stack/
32+
33+
RUN patch -d ./devstack -p1 < 0001-devstack-disable-ovs.patch
34+
RUN systemctl enable devstack
35+
36+
STOPSIGNAL SIGRTMIN+3
37+
CMD [ "/sbin/init" ]

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# containerized-devstack
2+
3+
This project easily deploys OpenStack in docker & docker-compose.
4+
This is mainly for development purpose.
5+
6+
# Usage
7+
8+
`docker-compose` will execute the initialization process of the
9+
devstack and automatically launch the major OpenStack components.
10+
This will take about 30 minutes.
11+
12+
```bash
13+
$ sudo docker-compose up -d
14+
15+
$ 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
29+
```
30+
31+
You can use the OpenStack CLI in the container.
32+
33+
```bash
34+
$ sudo docker-compose exec \
35+
--user stack \
36+
devstack \
37+
/bin/bash -c 'source devstack/openrc admin admin; exec /bin/bash'
38+
39+
stack@538b06c0fc0b:~$ openstack endpoint list
40+
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+
41+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
42+
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+
43+
| 3f865729db974cae886b8e29cbbb91ed | RegionOne | nova_legacy | compute_legacy | True | public | http://172.28.0.2/compute/v2/$(project_id)s |
44+
| 5b4723017af2441dbd7bbccc7f196d49 | RegionOne | keystone | identity | True | admin | http://172.28.0.2/identity |
45+
| 5cfe0eae065c47bbb649937036021f6b | RegionOne | keystone | identity | True | public | http://172.28.0.2/identity |
46+
| 67c0675c2898463b8d0284206bf58ba9 | RegionOne | glance | image | True | public | http://172.28.0.2/image |
47+
| b8181b82dc124c089e8cd38fc23e58e8 | RegionOne | placement | placement | True | public | http://172.28.0.2/placement |
48+
| e17fe28cb31d478c81a3d9b597850ad5 | RegionOne | nova | compute | True | public | http://172.28.0.2/compute/v2.1 |
49+
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+
50+
```
51+
52+
# Reference
53+
54+
- https://github.com/janmattfeld/DockStack
55+
- https://github.com/bodenr/docker-devstack
56+
- https://github.com/ewindisch/dockenstack

devstack.service

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

docker-compose.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3'
2+
services:
3+
devstack:
4+
build: .
5+
privileged: true
6+
tty: true

local.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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=rabbit,mysql,key
13+
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,placement-api,placement-client
14+
ENABLED_SERVICES+=,g-api,g-reg
15+
ENABLED_SERVICES+=,horizon
16+
17+
[[post-config|$NOVA_CONF]]

0 commit comments

Comments
 (0)