Skip to content

Commit dda9f25

Browse files
author
Tim Pouyer
committed
Lots of fixes:
- removed heat from devstack installation (not used so want to save space) - setup docker to use zfs for backing store - setup docker to bind to port 192.168.27.100:2375 (now you can use your local docker install to execute commands on stackinabox) - setup docker to allow ipv4 port forwarding - setup docker to use 192.168.27.100 as default for all port bindings - setup docker to use lxd's lxdbr0 network bridge by default - comment out custimizations to dhclient.conf (not sure if they were even being used) - updated vagrant/build.sh file to expect execution from the vagrant folder (previously it expected to be called from the root folder which I found to be confusing so I changed it) - add a new disk to hold the /var/lib/docker zfs backing store (dynamic disk that will grow as needed up to 500GB)
1 parent d78d02f commit dda9f25

File tree

9 files changed

+181
-137
lines changed

9 files changed

+181
-137
lines changed

lxc-cloud-images/import-images.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ glance image-create --name 'ubuntu-1404-server-cloudimg-amd64' \
1212
--property os_version=14.04 \
1313
--property vm_mode=exe < trusty-server-cloudimg-amd64-root.tar.xz
1414

15-
echo "downloading xenial-server-cloudimg-amd64-root.tar.xz image archive for import"
16-
wget -Nv https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-root.tar.xz
17-
glance image-create --name 'ubuntu-1604-server-cloudimg-amd64' \
18-
--container-format bare \
19-
--disk-format raw \
20-
--visibility public \
21-
--min-disk 1 \
22-
--property architecture=x86_64 \
23-
--property hypervisor_type=lxc \
24-
--property os_distro=ubuntu \
25-
--property os_version=16.04 \
26-
--property vm_mode=exe < xenial-server-cloudimg-amd64-root.tar.xz
15+
# echo "downloading xenial-server-cloudimg-amd64-root.tar.xz image archive for import"
16+
# wget -Nv https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-root.tar.xz
17+
# glance image-create --name 'ubuntu-1604-server-cloudimg-amd64' \
18+
# --container-format bare \
19+
# --disk-format raw \
20+
# --visibility public \
21+
# --min-disk 1 \
22+
# --property architecture=x86_64 \
23+
# --property hypervisor_type=lxc \
24+
# --property os_distro=ubuntu \
25+
# --property os_version=16.04 \
26+
# --property vm_mode=exe < xenial-server-cloudimg-amd64-root.tar.xz
2727

28-
echo "downloading xenial-server-cloudimg-amd64-heat-cfntools-root.tar.xz image archive for import"
28+
# echo "downloading xenial-server-cloudimg-amd64-heat-cfntools-root.tar.xz image archive for import"
2929
#wget -Nv https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-root.tar.xz
30-
glance image-create --name 'ubuntu-1604-server-cloudimg-amd64-heat-cfntools' \
31-
--container-format bare \
32-
--disk-format raw \
33-
--visibility public \
34-
--min-disk 1 \
35-
--property architecture=x86_64 \
36-
--property hypervisor_type=lxc \
37-
--property os_distro=ubuntu \
38-
--property os_version=16.04 \
39-
--property vm_mode=exe < ubuntu-1604-amd64-heat-cfntools.tar.xz
30+
# glance image-create --name 'ubuntu-1604-server-cloudimg-amd64-heat-cfntools' \
31+
# --container-format bare \
32+
# --disk-format raw \
33+
# --visibility public \
34+
# --min-disk 1 \
35+
# --property architecture=x86_64 \
36+
# --property hypervisor_type=lxc \
37+
# --property os_distro=ubuntu \
38+
# --property os_version=16.04 \
39+
# --property vm_mode=exe < ubuntu-1604-amd64-heat-cfntools.tar.xz

scripts/docker/heat.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
# set release branch to retrieve from git
44
RELEASE_BRANCH=${1:-master}
55

6-
cd /tmp
7-
git clone -b $RELEASE_BRANCH https://github.com/openstack/heat.git
8-
cd heat/contrib/heat_docker/
9-
sudo pip install -r requirements.txt
10-
sudo mkdir -p /var/lib/heat
11-
sudo cp -r heat_docker/ /var/lib/heat
12-
sudo chown -R vagrant:vagrant /var/lib/heat
13-
sudo sed -i 's|rpc_backend = rabbit|rpc_backend = rabbit \
14-
plugin_dirs = /var/lib/heat|g' /etc/heat/heat.conf
15-
sudo chown -R vagrant:vagrant /var/lib/heat
6+
# cd /tmp
7+
# git clone -b $RELEASE_BRANCH https://github.com/openstack/heat.git
8+
# cd heat/contrib/heat_docker/
9+
# sudo pip install -r requirements.txt
10+
# sudo mkdir -p /var/lib/heat
11+
# sudo cp -r heat_docker/ /var/lib/heat
12+
# sudo chown -R vagrant:vagrant /var/lib/heat
13+
# sudo sed -i 's|rpc_backend = rabbit|rpc_backend = rabbit \
14+
# plugin_dirs = /var/lib/heat|g' /etc/heat/heat.conf
15+
# sudo chown -R vagrant:vagrant /var/lib/heat
1616

1717
source /home/vagrant/admin-openrc.sh labstack
1818
nova flavor-key m1.tiny set lxd_docker_allowed=true

scripts/minimize/clean.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
#!/bin/bash -ux
22

33
# delete all linux headers
4-
#dpkg --list | awk '{ print $2 }' | grep linux-headers | xargs apt-get -y purge
4+
#dpkg --list | awk '{ print $2 }' | grep linux-headers-4*- | grep -v `uname -r` | xargs apt-get -y purge
5+
sudo dpkg --list | awk '{ print $2 }' | grep linux-headers-4-* | grep -v 4.4.0-36 | sudo xargs apt-get purge
56

67
# this removes specific linux kernels, such as
78
# linux-image-3.11.0-15-generic but
89
# * keeps the current kernel
910
# * does not touch the virtual packages, e.g.'linux-image-generic', etc.
1011
#
11-
#dpkg --list | awk '{ print $2 }' | grep 'linux-image-3.*-generic' | grep -v `uname -r` | xargs apt-get -y purge
12+
dpkg --list | awk '{ print $2 }' | grep 'linux-image-4.*-generic' | grep -v `uname -r` | sudo xargs apt-get -y purge
1213

1314
# delete linux source
14-
#dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge
15+
dpkg --list | awk '{ print $2 }' | grep linux-source | sudo xargs apt-get -y purge
1516

1617
# delete development packages
17-
sudo dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs sudo apt-get -qqy purge
18+
sudo dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | sudo xargs apt-get -qqy purge
1819

19-
# delete compilers and other development tools
20-
#apt-get -y purge cpp gcc g++
20+
# delete compilers and other development tools (can't do this otherwise dkms* dynamic kernel modules will be removed')
21+
#sudo apt-get -y purge cpp gcc g++
2122

2223
# delete X11 libraries
23-
sudo apt-get -qqy purge libx11-data libxmuu1 libx11-6 libxext6
24+
sudo apt-get -qqy purge libx11-data x11-common
2425

2526
# delete obsolete networking
2627
sudo apt-get -qqy purge ppp pppconfig pppoeconf
2728

29+
# clean up other stuff
30+
sudo apt-get -qqy man xkb-data libx11-data eject locales radvd
31+
2832
# delete oddities
2933
sudo apt-get -qqy purge popularity-contest
3034

scripts/stackinabox/init.sh

Lines changed: 102 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,25 @@ echo ""
1616
# Disable interactive options when installing with apt-get
1717
export DEBIAN_FRONTEND=noninteractive
1818

19-
echo export LC_ALL=en_US.UTF-8 >> ~/.bash_profile
20-
echo export LANG=en_US.UTF-8 >> ~/.bash_profile
19+
echo export LC_ALL=C.UTF-8 >> ~/.bash_profile
20+
echo export LANG=C.UTF-8 >> ~/.bash_profile
21+
22+
sudo bash -c 'cat > /etc/apt/apt.conf.d/01lean' <<'EOF'
23+
APT::Install-Suggests "0";
24+
APT::Install-Recommends "0";
25+
APT::AutoRemove::SuggestsImportant "false";
26+
APT::AutoRemove::RecommendsImportant "false";
27+
EOF
2128

2229
echo Updating...
30+
sudo apt-get -qqy update
31+
sudo apt-get install -qqy linux-headers-$(uname -r) \
32+
linux-headers-generic \
33+
linux-image-extra-$(uname -r) \
34+
linux-image-extra-virtual
35+
2336
sudo apt-get -y update
24-
sudo apt-get install -y zfsutils-linux git
37+
sudo apt-get -qqy install zfsutils-linux git
2538

2639
echo "Creating ZFS for lxd"
2740
sudo zpool create -m /var/lib/lxd -f lxd sdb
@@ -31,8 +44,14 @@ sudo touch /etc/init/zpool-import.conf
3144
sudo sed -i 's/modprobe zfs zfs_autoimport_disable=1/modprobe zfs zfs_autoimport_disable=0/g' /etc/init/zpool-import.conf
3245
sudo sed -i 's/# By default this script does nothing./zfs mount -a/g' /etc/rc.local
3346

47+
echo "Creating ZFS for docker"
48+
sudo zpool create -m /var/lib/docker -f docker sdc
49+
sudo zpool set feature@lz4_compress=enabled docker
50+
sudo zfs set compression=lz4 docker
51+
sudo touch /etc/init/zpool-import.conf
52+
3453
echo "Install LXD and initialize with ZFS storage-pool 'lxd' for backend"
35-
sudo apt-get install -y lxd
54+
sudo apt-get install -y lxd lxd-client
3655
sudo lxd init --auto --storage-backend zfs --storage-pool lxd
3756

3857
# flip the module parameters to enable user namespace mounts for fuse and/or ext4 within lxd containers
@@ -84,28 +103,28 @@ EOF
84103

85104
sudo hostname openstack
86105

87-
# speed up DNS resolution
88-
sudo bash -c 'cat > /etc/dhcp/dhclient.conf' <<EOF
89-
timeout 30;
90-
retry 10;
91-
reboot 0;
92-
select-timeout 0;
93-
initial-interval 1;
94-
backoff-cutoff 2;
95-
interface "enp0s3"
96-
{
97-
prepend domain-name-servers 8.8.8.8, 8.8.4.4;
98-
request subnet-mask,
99-
broadcast-address,
100-
time-offset,
101-
routers,
102-
domain-name,
103-
domain-name-servers,
104-
host-name,
105-
netbios-name-servers,
106-
netbios-scope;
107-
}
108-
EOF
106+
# # speed up DNS resolution
107+
# sudo bash -c 'cat > /etc/dhcp/dhclient.conf' <<EOF
108+
# timeout 30;
109+
# retry 10;
110+
# reboot 0;
111+
# select-timeout 0;
112+
# initial-interval 1;
113+
# backoff-cutoff 2;
114+
# interface "enp0s3"
115+
# {
116+
# prepend domain-name-servers 8.8.8.8, 8.8.4.4;
117+
# request subnet-mask,
118+
# broadcast-address,
119+
# time-offset,
120+
# routers,
121+
# domain-name,
122+
# domain-name-servers,
123+
# host-name,
124+
# netbios-name-servers,
125+
# netbios-scope;
126+
# }
127+
# EOF
109128

110129
echo enable cgroup memory limits
111130
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 /g' /etc/default/grub
@@ -180,11 +199,19 @@ sudo update-rc.d devstack start 98 2 3 4 5 . stop 02 0 1 6 .
180199
# Script only works if sudo caches the password for a few minutes
181200
sudo true
182201

183-
# Install kernel extra's to enable docker aufs support
184-
sudo apt-get -y install linux-image-extra-$(uname -r)
185-
186202
# install docker
187-
wget -qO- https://get.docker.com/ | sh
203+
sudo apt-get update
204+
sudo apt-get install -qqy apt-transport-https ca-certificates
205+
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
206+
207+
sudo touch /etc/apt/sources.list.d/docker.list
208+
sudo bash -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list'
209+
210+
sudo apt-get update
211+
sudo apt-get purge lxc-docker
212+
213+
sudo apt-get update
214+
sudo apt-get install -qqy docker-engine
188215

189216
# Install docker-compose
190217
COMPOSE_VERSION=`git ls-remote https://github.com/docker/compose | grep refs/tags | grep -oP "[0-9]+\.[0-9]+\.[0-9]+$" | tail -n 1`
@@ -198,6 +225,51 @@ sudo chmod +x /usr/local/bin/docker-cleanup
198225

199226
# add vagrant user to docker group
200227
sudo usermod -aG docker vagrant
228+
newgrp docker
229+
230+
# have docker listen on a port instead of a unix socket for remote administration
231+
sudo bash -c 'cat > /etc/systemd/system/docker.socket' <<'EOF'
232+
[Socket]
233+
ListenStream=0.0.0.0:2375
234+
EOF
235+
236+
sudo mkdir -p /etc/systemd/system/docker.service.d
237+
238+
# have docker utilze lxc to launch containers
239+
sudo bash -c 'cat > /etc/systemd/system/docker.service.d/lxc.conf' <<'EOF'
240+
[Service]
241+
ExecStart=
242+
ExecStart=/usr/bin/dockerd -H fd:// --ip 192.168.27.100 -b lxdbr0
243+
EOF
244+
245+
# Docker enables IP forwarding by itself, but by default systemd overrides
246+
# the respective sysctl setting. The following disables this override (for all interfaces):
247+
sudo bash -c 'cat > /etc/systemd/network/ipforward.network' <<'EOF'
248+
[Network]
249+
IPForward=ipv4
250+
EOF
251+
252+
sudo bash -c 'cat > /etc/sysctl.d/99-docker.conf' <<'EOF'
253+
net.ipv4.ip_forward = 1
254+
EOF
255+
256+
sudo sysctl -w net.ipv4.ip_forward=1
257+
258+
# adjust the number of processes allowed by systemd
259+
sudo bash -c 'cat > /etc/systemd/system/docker.service.d/tasks.conf' <<'EOF'
260+
[Service]
261+
TasksMax=infinity
262+
EOF
263+
264+
sudo bash -c 'cat >> /home/vagrant/.bash_profile' <<'EOF'
265+
export DOCKER_HOST=192.168.27.100
266+
EOF
267+
268+
sudo systemctl daemon-reload
269+
sudo systemctl restart systemd-networkd
270+
sudo systemctl restart docker.service
271+
272+
# sysctl -w net.ipv4.ip_forward=1
201273

202274
# install kuryr
203275
# sudo git clone https://git.openstack.org/openstack/kuryr.git /opt/stack/kuryr

scripts/stackinabox/local.conf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ enable_service n-cpu
100100
enable_service n-cond
101101
enable_service n-sch
102102
enable_service n-cauth
103-
enable_service n-spice
103+
disable_service n-spice
104104
disable_service n-novnc
105105
disable_service n-xvnc
106106
#disable_service n-api-meta
107-
enable_service n-sproxy
107+
disable_service n-sproxy
108108

109109

110110

@@ -159,11 +159,11 @@ enable_service g-reg
159159
#
160160
# Enable Heat (orchestration) Service
161161
#
162-
enable_service heat
163-
enable_service h-eng
164-
enable_service h-api
165-
enable_service h-api-cfn
166-
enable_service h-api-cw
162+
#enable_service heat
163+
#enable_service h-eng
164+
#enable_service h-api
165+
#enable_service h-api-cfn
166+
#enable_service h-api-cw
167167

168168
#
169169
# Enable Horizon - OpenStack Dashboard Service

scripts/stackinabox/stack-noscreenrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040

4141
/usr/local/bin/cinder-volume --config-file /etc/cinder/cinder.conf >> /opt/stack/logs/c-vol.log 2>&1 &
4242

43-
/usr/local/bin/heat-engine --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-eng.log 2>&1 &
43+
# /usr/local/bin/heat-engine --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-eng.log 2>&1 &
4444

45-
/usr/local/bin/heat-api --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api.log 2>&1 &
45+
# /usr/local/bin/heat-api --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api.log 2>&1 &
4646

47-
/usr/local/bin/heat-api-cfn --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api-cfn.log 2>&1 &
47+
# /usr/local/bin/heat-api-cfn --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api-cfn.log 2>&1 &
4848

49-
/usr/local/bin/heat-api-cloudwatch --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api-cw.log 2>&1 &
49+
# /usr/local/bin/heat-api-cloudwatch --config-file=/etc/heat/heat.conf >> /opt/stack/logs/h-api-cw.log 2>&1 &
5050

5151
# /usr/local/bin/designate-central --config-file=/etc/designate/designate.conf >> /opt/stack/logs/designate-central.log 2>&1 &
5252

vagrant/Personalization.dist

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
# Use NFS? (won't work on windows)
2-
$use_nfs = false
3-
4-
# Configure MTU on VM interfaces. Also requires manually configuring the same MTU on
5-
# the equivalent 'vboxnet' interfaces on the host. i.e. sudo ip link set dev vboxnet0 mtu $MTU
6-
$mtu = 1500
7-
8-
# Box name
9-
$box = "bento/ubuntu-16.04"
10-
11-
# Box url
12-
$box_url = "https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04"
13-
14-
# Number of CPU's (min 2, recommend 4) adjust to your machine
15-
$cpus = 4
16-
17-
# Amount of RAM (min 4096, recommed 8192) adjust to your machine
18-
$memory = 8192
19-
20-
# Which release branch should we build? ( stable/juno | stable/kilo | stable/liberty | master )
21-
$release_branch = "stable/mitaka"
22-
#Set to where second disk should be created
23-
$disk = "/home/freddy/VirtualBox VMs/stackinabox/box-disk2.vmdk"
24-
251

262
# Use NFS? (won't work on windows)
273
$use_nfs = false
@@ -47,3 +23,6 @@ $release_branch = "stable/mitaka"
4723

4824
# Second Disk (used for lxd backing store)
4925
$disk = '$HOME/VirtualBox VMs/stackinabox/ubuntu-16.04-amd64-disk2.vmdk'
26+
27+
# Third Disk (used for local docker image storage)
28+
$disk_docker = '$HOME/VirtualBox VMs/stackinabox/ubuntu-16.04-amd64-disk3.vmdk'

0 commit comments

Comments
 (0)