-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docker tests; upgrade to docker compose
- Loading branch information
1 parent
568fd48
commit 346fdf2
Showing
6 changed files
with
40 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
DOCKER_EXEC = docker exec | ||
CONTAINER = docker_debsources_1 | ||
MAKE = make -C /opt/debsources/ | ||
TEST_TARGETS = test test-all test-fast test-slow test-coverage | ||
SRC_TARGETS = all doc check clean test-online-app | ||
|
||
.PHONY: build update-db run attach init-db $(SRC_TARGETS) $(TEST_TARGETS) | ||
|
||
build: | ||
docker-compose build --pull | ||
docker compose build --pull | ||
|
||
update-db: | ||
docker-compose run debsources /opt/db-update | ||
docker compose run app /opt/db-update | ||
|
||
run: | ||
docker-compose up -d | ||
docker compose up -d | ||
|
||
logs: | ||
docker logs -f docker_debsources_1 | ||
docker compose logs app | ||
|
||
stop: | ||
docker-compose stop | ||
docker compose stop | ||
|
||
start-apache: | ||
$(DOCKER_EXEC) -it $(CONTAINER) apache2ctl start | ||
docker compose exec -it app apache2ctl start | ||
|
||
attach: | ||
$(DOCKER_EXEC) -it $(CONTAINER) /bin/bash | ||
docker compose exec -it app /bin/bash | ||
|
||
init-db: | ||
$(DOCKER_EXEC) $(CONTAINER) /opt/db-init | ||
docker compose exec app /opt/db-init | ||
|
||
$(SRC_TARGETS): | ||
$(DOCKER_EXEC) $(CONTAINER) $(MAKE) $@ | ||
docker compose exec app $(MAKE) $@ | ||
|
||
$(TEST_TARGETS): run init-db | ||
$(DOCKER_EXEC) $(CONTAINER) $(MAKE) $@ | ||
docker compose exec app $(MAKE) $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
db: | ||
image: postgres:11 | ||
environment: | ||
POSTGRES_USER: docker | ||
POSTGRES_PASSWORD: docker | ||
POSTGRES_DB: debsources | ||
name: debsources | ||
|
||
debsources: | ||
build: . | ||
ports: | ||
- "5000:5000" | ||
- "5001:80" | ||
volumes: | ||
- "../../:/opt/debsources" | ||
links: | ||
- db | ||
environment: | ||
PGUSER: docker | ||
PGPASSWORD: docker | ||
PGHOST: db_1 | ||
working_dir: /opt/debsources | ||
command: /opt/run-web | ||
services: | ||
db: | ||
image: postgres:11 | ||
environment: | ||
POSTGRES_USER: docker | ||
POSTGRES_PASSWORD: docker | ||
POSTGRES_DB: debsources | ||
|
||
app: | ||
build: . | ||
ports: | ||
- "5000:5000" | ||
- "5001:80" | ||
volumes: | ||
- "../../:/opt/debsources" | ||
environment: | ||
PGUSER: docker | ||
PGPASSWORD: docker | ||
PGHOST: db | ||
PGPORT: 5432 | ||
working_dir: /opt/debsources | ||
command: /opt/run-web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/bin/bash | ||
|
||
echo "Waiting for PostgreSQL to launch on 5432..." | ||
while ! nc -z db_1 5432; do | ||
while ! nc -z ${PGHOST} ${PGPORT}; do | ||
sleep 0.1 | ||
done | ||
echo "PostgreSQL launched" | ||
|
||
echo "Creating Debsources DB schema..." | ||
/opt/debsources/bin/debsources-dbadmin --createdb postgresql://docker:docker@db_1:5432/debsources | ||
/opt/debsources/bin/debsources-dbadmin --createdb postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/debsources | ||
echo "Debsources DB schema created" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters