Skip to content
This repository was archived by the owner on Dec 15, 2017. It is now read-only.

Commit 1c0c006

Browse files
committed
Multiple changes to save on disk and memory usage
1 parent 73228ec commit 1c0c006

File tree

14 files changed

+151
-73
lines changed

14 files changed

+151
-73
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
6+
## [Unreleased]
7+
8+
### Changed
9+
- Image is now based on Ubuntu Xenial 16.04 LTS
10+
- Image download is much smaller, around 1.1G (was ~2G)
11+
- VM runs on less memory (minimum 4G, recommended 6G)
12+
- Default user is now ubuntu, password is openstack
13+
- HexChat instead of XChat
14+
- Project renamed to Upstream Institute ;-)
15+
16+
### Added
17+
- `cleanup.sh` script that helps shrinking the image
18+
19+
### Fixed
20+
- There's no need to fiddle with network settings anymore
21+
22+
23+
[Unreleased]: https://github.com/kmarc/openstack-training-virtual-environment/compare/v2016.02...HEAD
24+

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ right place.
1717

1818
### What do I need?
1919

20-
* 6GB of **free** RAM (so at least 8GB in your laptop)
20+
* 5GB of **free** RAM (so at least 8GB in your laptop)
2121
* Recent CPU with at least 4 cores
2222
* 10GB disk space
2323
* [VirtualBox](https://www.virtualbox.org/)
@@ -73,6 +73,19 @@ then can be distributed and easily import into VirtualBox
7373
`./create-training-box.sh` is a handy tool that sets up everything with Vagrant
7474
and then creates the distributable box file.
7575

76+
#### Requirements
77+
78+
* `sudo apt install libguestfs-tools`
79+
* [libssl098:i386] is required for vmware vdiskmanager (shrink disks)
80+
81+
```bash
82+
wget http://security.ubuntu.com/ubuntu/ubuntu/pool/universe/o/openssl098/libssl0.9.8_0.9.8o-7ubuntu4_i386.deb
83+
sudo dpkg -i libssl0.9.8_0.9.8o-7ubuntu4_i386.deb
84+
```
85+
86+
[vmvare-vdiskmanager]: https://kb.vmware.com/selfservice/viewAttachment.do?attachID=1023856-vdiskmanager-linux.7.0.1.zip&documentID=1023856
87+
[libssl098:i386]: http://security.ubuntu.com/ubuntu/ubuntu/pool/universe/o/openssl098/
88+
7689
### Learn how to easily set up devstack
7790

7891
* [install-base.sh](install-base.sh) and
@@ -86,8 +99,11 @@ After booting up the virtual machine, start setting up devstack. It takes around
8699
10 minutes to finish, until then you can get familiar with the environment the
87100
VM provides you with.
88101

89-
Open up a terminal and run `/opt/devstack/stack.sh`. To reduce memory usage in
90-
your VM, also run `optimize-memory`.
102+
To set up an OpenStack installation with devstack, open a terminal and run:
103+
104+
```bash
105+
/opt/devstack/stack.sh && optimize-memory
106+
```
91107

92108
The four main software you will be using from the desktop during the training
93109
are
@@ -116,7 +132,7 @@ default security groups are not modified, so if you want to ping or SSH into
116132
your VM, you need to add the correct security rules (ICMP In/Egress from all,
117133
SSH ingress from all). Also beware that sometimes Horizon logs you in into the
118134
wrong project. To use the private networking by default, you need to log in as
119-
the default `demo` user (password: `admin`) and select `demo` as project.
135+
the default `demo` user (password: `openstack`) and select `demo` as project.
120136

121137
Screenshots
122138
-----------

Vagrantfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ Vagrant.configure(2) do |config|
22
config.vm.hostname = "upstream-training"
33
config.vm.box = "ubuntu/xenial64"
44
config.vm.provider "virtualbox" do |vb|
5-
vb.memory = "4608"
5+
vb.memory = "4096"
66
vb.cpus = 2
77
vb.name = "upstream-training"
88
vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
99
vb.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]
1010
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
1111
vb.customize ["modifyvm", :id, "--vram", "32"]
1212
vb.customize ["modifyvm", :id, "--natnet1", "192.168.10/24"]
13+
# Xenial COM1 port logging
14+
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
1315
end
1416
config.vm.provision :shell, inline: "/vagrant/install-base.sh",
1517
privileged: false, keep_color: true
@@ -22,6 +24,7 @@ Vagrant.configure(2) do |config|
2224
config.vm.provision :shell, inline: "/vagrant/cleanup.sh",
2325
privileged: false, keep_color: true
2426
config.vm.box_check_update = true
27+
config.vm.graceful_halt_timeout = 180
2528
config.ssh.forward_x11 = true
2629
config.ssh.forward_agent = true
2730
end

cleanup.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
#!/usr/bin/env bash
22

3-
# Empty packages cache
4-
sudo apt clean
3+
# Remove older kernels
4+
OLDS=$(dpkg -l | awk '/linux-image-[0-9]/{ print $2 }' \
5+
| sort -r \
6+
| sed 's/linux-image-\(.*\)-generic/\1/g' \
7+
| tail -n +2)
8+
for old in $OLDS; do
9+
sudo apt autoremove --purge -y ".*$old.*"
10+
done
11+
12+
# Empty user caches
13+
rm -rf ~/.cache
14+
sudo rm -rf /root/.cache
515

616
# Remove compiled pyc files
717
sudo updatedb
8-
for pyc in $(locate *.pyc); do
9-
sudo rm -rf $pyc
18+
for pyc in $(locate -- *.pyc); do
19+
sudo rm -rf "$pyc"
1020
done
21+
sudo updatedb
1122

12-
# Empty user caches
13-
rm -rf ~/.cache/*
23+
# Remove unused packages
24+
sudo apt autoremove --purge -y humanity-icon-theme snapd
25+
26+
# Empty packages cache
27+
sudo apt clean
28+
29+
# Zero out unused space
30+
dd if=/dev/zero of=~/ZERO bs=1M status=progress
31+
rm -rf ~/ZERO

create-training-box.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
#!/usr/bin/env bash
22

3+
VDISKMANAGER_DOWNLOAD='https://kb.vmware.com/selfservice/viewAttachment.do?attachID=1023856-vdiskmanager-linux.7.0.1.zip&documentID=1023856'
4+
35
vagrant up
46
vagrant halt
57

8+
if [[ ! -e dist/vmware-vdiskmanager ]]; then
9+
wget "$VDISKMANAGER_DOWNLOAD" -O /tmp/vmware-vdiskmanager.zip
10+
unzip /tmp/vmware-vdiskmanager.zip -d dist/
11+
mv dist/*vmware-vdiskmanager* dist/vmware-vdiskmanager
12+
fi
13+
14+
VMDK=$(vboxmanage showvminfo upstream-training --machinereadable \
15+
| grep SCSI-0-0 \
16+
| cut -d'"' -f4)
17+
18+
echo "Schrinking image..."
19+
./dist/vmware-vdiskmanager -k "$VMDK"
20+
621
echo "Creating Virtual Appliance..."
722
vboxmanage sharedfolder remove upstream-training --name vagrant
823
vboxmanage export upstream-training \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APT::Install-Suggests "0";
2+
APT::Install-Recommends "0";

files/etc/rc.local

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# By default this script does nothing.
1313

14-
dd if=/dev/zero of=/swap.img bs=1M count=2048 >> /tmp/rc.local.log 2>&1
15-
mkswap /swap.img >> /tmp/rc.local.log 2>&1
16-
swapon /swap.img >> /tmp/rc.local.log 2>&1
14+
dd if=/dev/zero of=/swap.img bs=1M count=2048
15+
mkswap /swap.img
16+
swapon /swap.img
1717
exit 0

files/etc/rc6.d/K99remove-swap

Lines changed: 0 additions & 4 deletions
This file was deleted.

files/home/ubuntu/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<channel name="xsettings" version="1.0">
44
<property name="Net" type="empty">
5-
<property name="ThemeName" type="string" value="Xfce"/>
6-
<property name="IconThemeName" type="string" value="Tango"/>
5+
<property name="ThemeName" type="string" value="Adwaita"/>
6+
<property name="IconThemeName" type="string" value="Adwaita"/>
77
<property name="DoubleClickTime" type="empty"/>
88
<property name="DoubleClickDistance" type="empty"/>
99
<property name="DndDragThreshold" type="empty"/>

files/opt/devstack/local.conf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44
# packages
55
#OFFLINE=True
66

7-
ADMIN_PASSWORD=admin
7+
ADMIN_PASSWORD=openstack
88
DATABASE_PASSWORD=$ADMIN_PASSWORD
99
RABBIT_PASSWORD=$ADMIN_PASSWORD
1010
SERVICE_PASSWORD=$ADMIN_PASSWORD
11+
12+
# Git fine tuning. HTTPS is usually enabled on firewalls.
13+
# Depth should be only one for upstream training purposes
14+
GIT_DEPTH=1
15+
GIT_BASE=https://git.openstack.org
16+
17+
# Let's save some memory
18+
API_WORKERS=1
19+

0 commit comments

Comments
 (0)