Skip to content

Commit a2632fa

Browse files
committed
change run-docker.sh to use bash not docker-compose
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
1 parent 53ca4a1 commit a2632fa

File tree

3 files changed

+62
-11
lines changed

3 files changed

+62
-11
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ in a Docker container, run:
1717

1818
./test/run-docker.sh
1919

20-
**NOTE:** You will need to have `docker-compose` installed locally. Directions
21-
for installing can be found at [docs.docker.com/compose/install](https://docs.docker.com/compose/install/).
22-
2320
Slow start
2421
----------
2522

test/entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
55
# start rsyslog
66
service rsyslog start &&
77

8-
# wait until the mysql instance has started fully
9-
# this is awful
10-
sleep 5
8+
# make sure we can reach the mysqldb
9+
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
10+
while ! exec 6<>/dev/tcp/0.0.0.0/3306; do
11+
echo "$(date) - still trying to connect to mysql at 0.0.0.0:3306"
12+
sleep 1
13+
done
14+
15+
exec 6>&-
16+
exec 6<&-
1117

1218
# create the database
1319
source $DIR/create_db.sh

test/run-docker.sh

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,66 @@
1313
set -o errexit
1414
cd $(dirname $0)/..
1515

16+
# helper function to return the state of the container (true if running, false if not)
17+
is_running(){
18+
local name=$1
19+
local state=$(docker inspect --format "{{.State.Running}}" $name 2>/dev/null)
20+
21+
if [[ "$state" == "false" ]]; then
22+
# the container is up but not running
23+
# we should remove it so we can bring up another
24+
docker rm $name
25+
fi
26+
echo $state
27+
}
28+
29+
# helper function to get boot2docker ip if we are on a mac
30+
hostip=0.0.0.0
31+
if command -v boot2docker >/dev/null 2>&1 ; then
32+
hostip="$(boot2docker ip)"
33+
fi
34+
# if the DOCKER_HOST variable exists, lets get the host ip from that
35+
if [[ ! -z "$DOCKER_HOST" ]]; then
36+
hostip="$(echo $DOCKER_HOST | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')"
37+
fi
38+
1639
# In order to talk to a letsencrypt client running on the host, the fake DNS
1740
# client used in Boulder's start.py needs to know what the host's IP is from the
1841
# perspective of the container. We try to figure it out automatically. If you'd
1942
# like your Boulder instance to always talk to some other host, you can set
2043
# FAKE_DNS to that host's IP address.
2144
if [ -z "${FAKE_DNS}" ] ; then
22-
FAKE_DNS=$(ifconfig docker0 | sed -n 's/ *inet addr:\([0-9.]\+\).*/\1/p')
45+
FAKE_DNS=$(/sbin/ifconfig docker0 | sed -n 's/ *inet addr:\([0-9.]\+\).*/\1/p')
46+
fi
47+
48+
if [[ "$(is_running boulder-mysql)" != "true" ]]; then
49+
# bring up mysql mariadb container
50+
docker run -d \
51+
--net host \
52+
-p 3306:3306 \
53+
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
54+
--name boulder-mysql \
55+
mariadb:10
56+
fi
57+
58+
if [[ "$(is_running boulder-rabbitmq)" != "true" ]]; then
59+
# bring up rabbitmq container
60+
docker run -d \
61+
--net host \
62+
-p 5672:5672 \
63+
--name boulder-rabbitmq \
64+
rabbitmq:3
2365
fi
2466

25-
# build the docker images
26-
docker-compose build
67+
# build the boulder docker image
68+
docker build --rm --force-rm -t letsencrypt/boulder .
2769

70+
# run the boulder container
2871
# The excluding `-d` command makes the instance interactive, so you can kill
29-
# all containers with Ctrl-C.
30-
docker-compose up
72+
# the boulder container with Ctrl-C.
73+
docker run --rm -it \
74+
--net host \
75+
-p 4000:4000 \
76+
-e MYSQL_CONTAINER=yes \
77+
--name boulder \
78+
letsencrypt/boulder

0 commit comments

Comments
 (0)