Skip to content

Commit 90aa517

Browse files
authored
Merge pull request #116 from metacpan/oalders/profiles
Use compose profiles
2 parents c33e644 + a21ea70 commit 90aa517

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

.circleci/config.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
1+
---
2+
# Use the latest 2.1 version of CircleCI pipeline process engine. See:
3+
# https://circleci.com/docs/2.0/configuration-reference
24
version: 2.1
35
# Orchestrate or schedule a set of jobs
46
workflows:
@@ -8,25 +10,16 @@ workflows:
810
jobs:
911
build-and-test:
1012
machine: true
11-
resource_class: medium
13+
resource_class: large
1214
steps:
13-
# CircleCI has its own docker-compose already installed, but as of this writing, their version is too old to understand our docker-compose.yml
14-
- run:
15-
name: Install Docker Compose
16-
command: |
17-
set -x
18-
curl -L https://github.com/docker/compose/releases/download/1.26.2/docker-compose-`uname -s`-`uname -m` > /home/circleci/bin/docker-compose
19-
sudo chmod +x /home/circleci/bin/docker-compose
20-
which docker-compose
21-
docker-compose --version
2215
- checkout
2316
- run:
2417
command: |
2518
./bin/metacpan-docker init
2619
name: clone missing repositories
2720
- run:
2821
command: |
29-
docker-compose --verbose up -d api_test
22+
docker-compose --verbose --profile test up -d
3023
name: compose up
3124
# Since we're running docker-compose -d, we don't actually know if
3225
# Elasticsearch is available at the time this build step begins. We
@@ -38,12 +31,12 @@ jobs:
3831
- run:
3932
name: Run complete MetaCPAN API Test Suite
4033
command: |
41-
docker-compose exec -T api_test prove -lr --jobs 2 t
42-
docker-compose down
34+
docker-compose --profile test exec -T api_test prove -lr --jobs 4 t
35+
docker-compose --profile test down
4336
- run:
4437
name: Show Docker container logs on Error
4538
command: |
46-
docker-compose logs
39+
docker-compose --profile test logs
4740
docker stats --no-stream
4841
docker ps -a | head
4942
when: on_fail

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ These repositories are automatically mounted into the appropriate docker
101101
containers allowing the developer to use their preferred tools to work with the
102102
source code.
103103

104-
The `docker compose up` command on its own will bring up the entire stack in the
105-
foreground (logs will be displayed).
104+
The `docker compose --profile dev up` command on its own will bring up the
105+
entire stack in the foreground (logs will be displayed).
106106

107-
The `docker compose up` command will also fetch the official container images
108-
from [MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list)
107+
The `docker compose --profile dev up` command will also fetch the official
108+
container images from
109+
[MetaCPAN Docker Hub](https://cloud.docker.com/u/metacpan/repository/list)
109110
repositories.
110111

111112
This will build the Docker containers for MetaCPAN, PostgreSQL and Elasticsearch
@@ -128,7 +129,7 @@ elsewhere.
128129
Alternatively, if you just want to hack on the web frontend, you can run this
129130
instead of all the above:
130131

131-
docker compose up web
132+
docker compose up web-server
132133

133134
From here, you can proceed and hack on the MetaCPAN code at `src/metacpan-api`
134135
and/or `src/metacpan-web` directories, and saving edits will reload the
@@ -137,7 +138,7 @@ corresponding apps automatically!
137138
When done hacking (or, more likely, when you need to rebuild/refresh your Docker
138139
environment) you can then run
139140

140-
docker compose down
141+
docker compose --profile dev down
141142

142143
in another terminal to stop all MetaCPAN services and remove the containers.
143144

docker-compose.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ services:
2323
#
2424

2525
api:
26+
profiles:
27+
- dev
2628
depends_on:
2729
- elasticsearch
2830
- pghost
@@ -34,8 +36,8 @@ services:
3436
env_file:
3537
- .env
3638
command: >
37-
/metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" --
3839
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
40+
/metacpan-api/wait-for-es.sh http://elasticsearch:9200 "" --
3941
${API_SERVER} ./bin/api.pl
4042
volumes:
4143
- type: volume
@@ -60,6 +62,8 @@ services:
6062
- web-network
6163

6264
api_test:
65+
profiles:
66+
- test
6367
depends_on:
6468
- elasticsearch_test
6569
- pghost
@@ -69,8 +73,8 @@ services:
6973
env_file:
7074
- localapi_test.env
7175
command: >
72-
/metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" --
7376
/metacpan-api/wait-for-it.sh -t 15 -s -h ${PG_HOST} -p ${PG_PORT} --
77+
/metacpan-api/wait-for-es.sh http://elasticsearch_test:9200 "" --
7478
${API_SERVER} ./bin/api.pl
7579
volumes:
7680
- type: volume
@@ -94,6 +98,9 @@ services:
9498
- elasticsearch
9599

96100
ingest:
101+
profiles:
102+
- dev
103+
- ingest
97104
image: metacpan/metacpan-ingest:latest
98105
volumes:
99106
- type: volume
@@ -116,6 +123,8 @@ services:
116123
# |___/ |_|
117124

118125
grep:
126+
profiles:
127+
- grep
119128
image: metacpan/metacpan-grep-front-end:latest
120129
build:
121130
context: ./src/metacpan-grep-front-end
@@ -146,6 +155,9 @@ services:
146155
#
147156

148157
elasticsearch:
158+
profiles:
159+
- dev
160+
- ingest
149161
image: elasticsearch:2.4
150162
volumes:
151163
- type: volume
@@ -178,6 +190,8 @@ services:
178190
#
179191

180192
elasticsearch_test:
193+
profiles:
194+
- test
181195
image: elasticsearch:2.4
182196
volumes:
183197
- type: volume
@@ -204,6 +218,9 @@ services:
204218
#
205219

206220
pghost:
221+
profiles:
222+
- dev
223+
- test
207224
hostname: pghost
208225
image: "postgres:${PG_VERSION_TAG:-9.6-alpine}"
209226
build:

0 commit comments

Comments
 (0)