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

Commit d20f02e

Browse files
committed
feature #4 Add customizable ports (jderusse)
This PR was merged into the master branch. Discussion ---------- Add customizable ports Commits ------- dd14ee0 Add customizable ports
2 parents a4e1514 + dd14ee0 commit d20f02e

File tree

3 files changed

+67
-16
lines changed

3 files changed

+67
-16
lines changed

Dockerfile

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,41 @@ RUN apt-get update \
99
mariadb-client-core-10.0 \
1010
nodejs \
1111
rsyslog \
12+
softhsm \
1213

1314
&& apt-get clean \
1415
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1516

1617
EXPOSE 4000
1718

18-
RUN go get github.com/jsha/listenbuddy
19-
RUN go get bitbucket.org/liamstask/goose/cmd/goose
20-
RUN go get -v github.com/golang/lint/golint
19+
RUN go get -v \
20+
github.com/jsha/listenbuddy \
21+
bitbucket.org/liamstask/goose/cmd/goose \
22+
github.com/golang/lint/golint
2123

22-
ENV BOULDER_CONFIG /go/src/github.com/letsencrypt/boulder/test/boulder-config.json
23-
ENV GOPATH /go/src/github.com/letsencrypt/boulder/Godeps/_workspace:$GOPATH
24+
ENV GO15VENDOREXPERIMENT 1
25+
WORKDIR /go/src/github.com/letsencrypt/boulder
2426

2527
RUN mkdir -p /go/src/github.com/letsencrypt \
2628
&& git clone --depth 1 --branch master https://github.com/letsencrypt/boulder.git /go/src/github.com/letsencrypt/boulder
2729

28-
WORKDIR /go/src/github.com/letsencrypt/boulder
29-
3030
# Warmup
3131
RUN service mysql start \
32-
&& service rabbitmq-server start \
33-
&& service rsyslog start \
3432

33+
&& sh -c 'echo "127.0.0.1 boulder boulder-mysql boulder-rabbitmq" >> /etc/hosts' \
3534
&& test/create_db.sh \
36-
&& GOBIN=/go/src/github.com/letsencrypt/boulder/bin go install ./... \
3735

38-
&& service rsyslog stop \
39-
&& service mysql stop \
40-
&& service rabbitmq-server stop
36+
&& service mysql stop
37+
38+
RUN GOBIN=/go/src/github.com/letsencrypt/boulder/bin go install ./...
39+
40+
ENV BOULDER_MYSQL_PORT=43306
41+
ENV BOULDER_AMQP_PORT=45672
42+
ENV BOULDER_PORT=4000
43+
ENV BOULDER_CALLBACK_PORT=8000
4144

42-
COPY bin/entrypoint.sh /usr/bin
4345
COPY config/rate-limit-policies.yml /go/src/github.com/letsencrypt/boulder/test
46+
COPY bin/entrypoint.sh /usr/bin
4447

4548
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]
4649
CMD [ "./start.py" ]

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,34 @@ Usage
1313

1414
Hosted on Docker Hub: https://hub.docker.com/r/acmephp/testing-ca/
1515

16+
Start the boulder container in background.
17+
18+
```bash
19+
docker run -d --net host acmephp/testing-ca
20+
```
21+
22+
> By design, to test the domain, boulder will resolve the domain to 127.0.0.1,
23+
and call the given URL `http://mydomain.com:5002/.well-known/acme-challenge/${TOKEN}`.
24+
That's why, You **MUST** use the flag `--net host` to run the boulder container
25+
in the same network than your application.
26+
27+
Configure your application to call the testing CA with the following endpoints
28+
29+
```yaml
30+
endpoint: http://127.0.0.1:4000
31+
agreement: http://boulder:4000/terms/v1
32+
```
33+
34+
Customization
35+
-------------
36+
37+
Because boulder use a MySQL and a RabbitMQ server and because boulder have to
38+
run with option `--net host` you may have port conflict. You can customize
39+
those ports with environments variables:
40+
1641
```
17-
docker pull acmephp/testing-ca
42+
BOULDER_MYSQL_PORT=43306 # MySQL server
43+
BOULDER_AMQP_PORT=45672 # RabbitMq server
44+
BOULDER_PORT=4000 # Boulder front
45+
BOULDER_CALLBACK_PORT=5002 # Application's challenge
1846
```

bin/entrypoint.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
#!/bin/bash
22

3+
echo "127.0.0.1 boulder boulder-mysql boulder-rabbitmq" >> /etc/hosts
4+
5+
# replace mysql ports
6+
sed -i 's/port\s*=\s*3306/port = '$BOULDER_MYSQL_PORT'/g' /etc/mysql/my.cnf
7+
sed -i 's/:3306/:'$BOULDER_MYSQL_PORT'/g' test/boulder-config.json
8+
sed -i 's/:3306/:'$BOULDER_MYSQL_PORT'/g' test/secrets/*
9+
10+
# replace rabbitmq ports
11+
echo "[{rabbit, [{tcp_listeners, [$BOULDER_AMQP_PORT]}]}]." > /etc/rabbitmq/rabbitmq.config
12+
sed -i 's/:567[23]/:'$BOULDER_AMQP_PORT'/g' test/boulder-config.json
13+
sed -i 's/:567[23]/:'$BOULDER_AMQP_PORT'/g' test/secrets/*
14+
sed -i '/listenbuddy/i\\n return' test/startservers.py
15+
16+
# replace boulder front port
17+
sed -i 's/:4000/:'$BOULDER_PORT'/g' test/boulder-config.json
18+
sed -i 's/4000/'$BOULDER_PORT'/g' test/startservers.py
19+
20+
# replace default callback port
21+
sed -i 's/5002/'$BOULDER_CALLBACK_PORT'/g' test/boulder-config.json
22+
323
service mysql start
424
service rabbitmq-server start
525
service rsyslog start
626

7-
go run cmd/rabbitmq-setup/main.go -server amqp://localhost
27+
go run cmd/rabbitmq-setup/main.go -server amqp://boulder-rabbitmq:$BOULDER_AMQP_PORT
828

929
exec "$@"

0 commit comments

Comments
 (0)