Skip to content

Commit 480febc

Browse files
author
Kamil Trzcinski
committed
Added Travis-CI and Wercker support
1 parent 9f232f7 commit 480febc

49 files changed

Lines changed: 402 additions & 260 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.travis.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
sudo: false
3+
env:
4+
global:
5+
- USE_VHOST=1
6+
matrix:
7+
- APP_NAME=acl
8+
- APP_NAME=htpasswd
9+
- APP_NAME=mariadb
10+
- APP_NAME=mongodb
11+
- APP_NAME=config
12+
- APP_NAME=dockerfile
13+
- APP_NAME=gitsubmodules
14+
- APP_NAME=go
15+
- APP_NAME=java
16+
- APP_NAME=multi
17+
- APP_NAME=nodejs-express
18+
- APP_NAME=php
19+
- APP_NAME=postgresql
20+
- APP_NAME=python-flask
21+
- APP_NAME=static
22+
- APP_NAME=static USE_VHOST=0
23+
matrix:
24+
fast_finish: true
25+
install:
26+
- contrib/install_docker_and_uml.sh
27+
script:
28+
- sed -i 's/linux-image-extra-virtual, //g' deb/dokku-alt/DEBIAN/control
29+
- sudo make install
30+
- contrib/start_docker_and_uml.sh APP_NAME=$APP_NAME USE_VHOST=$USE_VHOST

‎Dockerfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN apt-get update && \
77
curl software-properties-common \
88
nginx dnsutils aufs-tools \
99
dpkg-dev openssh-server man-db
10+
RUN apt-get install -y apache2-utils
1011
RUN chmod ugo+s /usr/bin/sudo
1112

1213
# Configure environment
@@ -30,5 +31,7 @@ WORKDIR /srv/dokku-alt
3031
RUN sed -i 's/linux-image-extra-virtual, //g' deb/dokku-alt/DEBIAN/control
3132
RUN make install
3233

34+
EXPOSE 22 80 443
35+
3336
# Start all services
3437
CMD ["/srv/dokku-alt/start-services.sh"]

‎Makefile‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ docker_run: docker_build
100100
docker run --privileged --rm -i -t \
101101
-v /home/dokku -v /var/lib/docker \
102102
--hostname="dokku.me" \
103-
ayufan/dokku-alt \
104-
/bin/bash
103+
ayufan/dokku-alt
105104

106-
docker_tests: docker_build
107-
docker run --privileged --rm -t \
108-
-v /home/dokku -v /var/lib/docker \
105+
docker_tests:
106+
-docker run -v /var/lib/docker --name="dokku-alt-docker-volume-data" busybox:latest true
107+
docker run --privileged --rm -i -t \
108+
--volumes-from dokku-alt-docker-volume-data \
109109
--hostname="dokku.me" \
110110
ayufan/dokku-alt \
111-
/srv/dokku-alt/tests/run_localhost
111+
/srv/dokku-alt/tests/run_localhost $(TESTS)
112112

113113
pull:
114114
rsync -av dokku.home:/srv/dokku-alt/ dokku

‎contrib/install_docker_and_uml.sh‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
sudo add-apt-repository ppa:nginx/stable -y
6+
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
7+
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
8+
sudo apt-get update
9+
sudo mkdir -p /var/lib/docker
10+
echo exit 101 | sudo tee /usr/sbin/policy-rc.d
11+
sudo chmod +x /usr/sbin/policy-rc.d
12+
sudo apt-get install -y slirp lxc-docker aufs-tools cgroup-lite \
13+
apt-transport-https locales git make \
14+
curl software-properties-common \
15+
nginx dnsutils aufs-tools \
16+
dpkg-dev openssh-server man-db \
17+
apache2-utils
18+
curl -sLo linux https://github.com/jpetazzo/sekexe/raw/master/uml
19+
chmod +x linux
20+
21+
if mount | grep /dev/shm | grep noexec; then
22+
sudo mount -o remount,exec /dev/shm
23+
fi

‎contrib/start_docker_and_uml.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
sudo ./linux quiet mem=2500M \
4+
rootfstype=hostfs rw \
5+
eth0=slirp,,/usr/bin/slirp-fullbolt \
6+
init=$(pwd)/contrib/uml_init.sh \
7+
WORKDIR=$(pwd) \
8+
HOME=/root \
9+
"$@"
10+
11+
if [[ -f /uml_exit_code ]]; then
12+
exit $(cat /uml_exit_code)
13+
fi

‎contrib/uml_init.sh‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#!/bin/bash
2+
3+
# Exit on first error
4+
set -e
5+
6+
save_and_shutdown() {
7+
# save built for host result
8+
# force clean shutdown
9+
echo $? > /uml_exit_code
10+
halt -f
11+
}
12+
13+
# remove old uml_exit_code
14+
rm -f /uml_exit_code
15+
16+
# make sure we shut down cleanly
17+
trap save_and_shutdown EXIT SIGINT SIGTERM
18+
19+
# go back to where we were invoked
20+
cd $WORKDIR
21+
22+
# configure hostname
23+
hostname dokku.me
24+
25+
# configure path to include /usr/local
26+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
27+
28+
# can't do much without proc!
29+
mount -t proc none /proc
30+
31+
# pseudo-terminal devices
32+
mkdir -p /dev/pts
33+
mount -t devpts none /dev/pts
34+
35+
# shared memory a good idea
36+
mkdir -p /dev/shm
37+
mount -t tmpfs none /dev/shm
38+
39+
# fd sometimes is usefull
40+
ln -sf /proc/self/fd /dev/fd
41+
42+
# sysfs a good idea
43+
mount -t sysfs none /sys
44+
45+
# mount home
46+
mount -t tmpfs none /home
47+
48+
# pidfiles and such like
49+
mkdir -p /var/run
50+
mount -t tmpfs none /var/run
51+
mkdir /var/run/sshd
52+
53+
# tmpfs
54+
mount -t tmpfs none /tmp
55+
chmod 777 /tmp
56+
57+
# docker
58+
mount -t tmpfs -o size=2000m none /var/lib/docker
59+
60+
# logfiles and such like
61+
mkdir -p /var/log
62+
mount -t tmpfs none /var/log
63+
mkdir -p /var/log/nginx
64+
chmod -R 777 /var/log
65+
66+
# some nginx files
67+
mkdir -p /var/lib/nginx
68+
mount -t tmpfs none /var/lib/nginx
69+
chown -R www-data:www-data /var/lib/nginx
70+
71+
# takes the pain out of cgroups
72+
cgroups-mount
73+
74+
# enable ipv4 forwarding for docker
75+
echo 1 > /proc/sys/net/ipv4/ip_forward
76+
77+
# configure networking
78+
ip addr add 127.0.0.1 dev lo
79+
ip link set lo up
80+
ip addr add 10.1.1.1/24 dev eth0
81+
ip link set eth0 up
82+
ip route add default via 10.1.1.254
83+
84+
# configure dns (google public)
85+
mkdir -p /run/resolvconf
86+
echo 'nameserver 8.8.8.8' > /run/resolvconf/resolv.conf
87+
mount --bind /run/resolvconf/resolv.conf /etc/resolv.conf
88+
89+
# show mounts
90+
echo "========================================"
91+
echo "=====> Mounted disks..."
92+
df -h || true
93+
94+
# RUN TESTS
95+
echo "========================================"
96+
echo "=====> Starting nginx..."
97+
nginx -c /etc/nginx/nginx.conf
98+
99+
echo "=====> Starting sshd..."
100+
/usr/sbin/sshd
101+
102+
echo "=====> Starting docker..."
103+
docker -d >/tmp/docker.log 2>&1 &
104+
sleep 5s
105+
106+
echo "========================================"
107+
echo "=====> Configuring dokku..."
108+
109+
export HOME=/root
110+
sshcommand create dokku /usr/local/bin/dokku
111+
dokku plugins-install
112+
113+
echo "=====> Adding ssh-key..."
114+
mkdir -p /root/.ssh
115+
[[ -f ~/.ssh/id_rsa ]] || ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa
116+
cat <<EOF >> ~/.ssh/config
117+
Host *
118+
StrictHostKeyChecking no
119+
EOF
120+
cat ~/.ssh/id_rsa.pub | dokku access:add
121+
122+
echo "=====> Veryfing connectivity..."
123+
ssh dokku@localhost version
124+
125+
echo "========================================"
126+
127+
if [[ "$USE_VHOST" == "1" ]]; then
128+
echo "-----> Setting VHOST..."
129+
echo "dokku.me" > /home/dokku/VHOST
130+
fi
131+
132+
echo "----------------------------------------"
133+
echo "-----> Running test deploy of $APP_NAME..."
134+
echo "----------------------------------------"
135+
echo ""
136+
137+
tests/test_deploy apps/$APP_NAME localhost
138+
139+
echo "=====> DONE!"

‎docs/advanced-installation.md‎

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

‎docs/index.md‎

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

‎plugins/dokku-rebuild/commands‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ case "$1" in
9797
return
9898
fi
9999

100-
dokku_build_app_from_git "$APP" "$REF" | sed -u "s/^/"$'\e[1G'"/"
100+
dokku_build_app_from_git "$APP" "$REF"
101101
;;
102102

103103
rebuild:all)

‎start-services.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ echo "root:$PASSWORD" | chpasswd
1717
echo "SSH Login:"
1818
echo " user: root"
1919
echo " password: $PASSWORD"
20-
wait
20+
echo " ip: $(hostname -I)"
21+
22+
while true; do sleep 1h; done

0 commit comments

Comments
 (0)