Skip to content

Commit

Permalink
Merge pull request #16 from uselagoon/update-mux-handling
Browse files Browse the repository at this point in the history
Change: Updated URL format to improve readability
  • Loading branch information
tobybellwood authored Nov 6, 2023
2 parents b44b8d5 + 1476b63 commit 80c360e
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/images-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: "0"
- name: Pull all images
run: |
docker-compose pull --ignore-pull-failures
docker compose pull --ignore-pull-failures
- name: Install test harness
run: |
yarn add leia-parser mocha chai command-line-test
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM golang:alpine
FROM golang:1.21-alpine

WORKDIR /go-dbaas
WORKDIR /internal-services-test

ADD . .

RUN go get github.com/joho/godotenv

RUN go build && chmod +x ./go-dbaas
RUN go build && chmod +x ./internal-services-test

ENV SOLR_HOST=solr \
REDIS_HOST=redis \
OPENSEARCH_HOST=opensearch-2

EXPOSE 3000

CMD sleep 10 && ./go-dbaas
CMD sleep 10 && ./internal-services-test
62 changes: 31 additions & 31 deletions TESTING_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Run the following commands to get up and running with this example.

```bash
# should remove any previous runs and poweroff
docker-compose down --volumes --remove-orphans
docker compose down --volumes --remove-orphans

# should start up our services successfully
docker-compose build && docker-compose up -d
docker compose build && docker compose up -d
```

Verification commands
Expand All @@ -23,59 +23,59 @@ Run the following commands to validate things are rolling as they should.

```bash
# Ensure services are ready to connect
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-4:3306 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-6:3306 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-5:3306 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-11:3306 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://postgres-11:5432 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://postgres-15:5432 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://opensearch-2:9200 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mongo-4:27017 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://redis-5:6379 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://redis-6:6379 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://redis-7:6379 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://solr-7:8983 -timeout 1m
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://solr-8:8983 -timeout 1m

# commons should be running Alpine Linux
docker-compose exec -T commons sh -c "cat /etc/os-release" | grep "Alpine Linux"
docker compose exec -T commons sh -c "cat /etc/os-release" | grep "Alpine Linux"

# mariadb-10-4 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb-10-4" | grep "SERVICE_HOST=10.4"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb-10-4" | grep "LAGOON_TEST_VAR=internal-services-test"
# mariadb-10-5 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-5" | grep "SERVICE_HOST=10.5"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-5" | grep "LAGOON_TEST_VAR=internal-services-test"

# mariadb-10-6 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb-10-6" | grep "SERVICE_HOST=10.6"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb-10-6" | grep "LAGOON_TEST_VAR=internal-services-test"
# mariadb-10-11 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "SERVICE_HOST=10.11"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "LAGOON_TEST_VAR=internal-services-test"

# postgres-11 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres-11" | grep "SERVICE_HOST=PostgreSQL 11"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres-11" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-11" | grep "SERVICE_HOST=PostgreSQL 11"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-11" | grep "LAGOON_TEST_VAR=internal-services-test"

# postgres-15 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres-15" | grep "SERVICE_HOST=PostgreSQL 15"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres-15" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-15" | grep "SERVICE_HOST=PostgreSQL 15"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-15" | grep "LAGOON_TEST_VAR=internal-services-test"

# opensearch-2 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch-2" | grep "SERVICE_HOST=opensearch-2"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch-2" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch?service=opensearch-2" | grep "SERVICE_HOST=opensearch-2"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch?service=opensearch-2" | grep "LAGOON_TEST_VAR=internal-services-test"

# mongo-4 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo-4" | grep "SERVICE_HOST="
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo-4" | grep "LAGOON_TEST_VAR=internal-services-test"

# redis-5 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/redis-5" | grep "SERVICE_HOST=redis-5"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/redis-5" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo?service=mongo-4" | grep "SERVICE_HOST="
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo?service=mongo-4" | grep "LAGOON_TEST_VAR=internal-services-test"

# redis-6 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/redis-6" | grep "SERVICE_HOST=redis-6"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/redis-6" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-6" | grep "SERVICE_HOST=redis-6"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-6" | grep "LAGOON_TEST_VAR=internal-services-test"

# redis-7 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-7" | grep "SERVICE_HOST=redis-7"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-7" | grep "LAGOON_TEST_VAR=internal-services-test"

# solr-7 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/solr-7" | grep "SERVICE_HOST=solr-7"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/solr-7" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-7" | grep "SERVICE_HOST=solr-7"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-7" | grep "LAGOON_TEST_VAR=internal-services-test"

# solr-8 should be able to read/write data
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/solr-8" | grep "SERVICE_HOST=solr-8"
docker-compose exec -T commons sh -c "curl -kL http://go-web:3000/solr-8" | grep "LAGOON_TEST_VAR=internal-services-test"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-8" | grep "SERVICE_HOST=solr-8"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-8" | grep "LAGOON_TEST_VAR=internal-services-test"
```

Destroy tests
Expand All @@ -85,5 +85,5 @@ Run the following commands to trash this app like nothing ever happened.

```bash
# should be able to destroy our services with success
docker-compose down --volumes --remove-orphans
docker compose down --volumes --remove-orphans
```
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ services:
- LAGOON_GIT_SHA=SHA256
- LAGOON_ENVIRONMENT_TYPE=development

mariadb-10-4:
image: uselagoon/mariadb-10.4:latest
mariadb-10-5:
image: uselagoon/mariadb-10.5:latest
labels:
lagoon.type: mariadb-single
ports:
- '3306'

mariadb-10-6:
image: uselagoon/mariadb-10.6:latest
mariadb-10-11:
image: uselagoon/mariadb-10.11:latest
labels:
lagoon.type: mariadb
ports:
Expand Down Expand Up @@ -78,14 +78,14 @@ services:
ports:
- '27017'

redis-5:
redis-6:
image: uselagoon/redis-5:latest
labels:
lagoon.type: redis
ports:
- '6379'

redis-6:
redis-7:
image: uselagoon/redis-6:latest
labels:
lagoon.type: redis
Expand Down
48 changes: 25 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
module go-dbaas
module internal-services-test

go 1.19
go 1.21

require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/go-redis/redis/v8 v8.11.5
github.com/go-sql-driver/mysql v1.7.1
github.com/gorilla/mux v1.8.1
github.com/lib/pq v1.10.9
github.com/opensearch-project/opensearch-go v1.1.0
github.com/vanng822/go-solr v0.10.0
go.mongodb.org/mongo-driver v1.12.1
)

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/opensearch-project/opensearch-go v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/stevenferrer/solr-go v0.3.2 // indirect
github.com/vanng822/go-solr v0.10.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/onsi/gomega v1.21.1 // indirect
github.com/stretchr/testify v1.8.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.mongodb.org/mongo-driver v1.11.0 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/text v0.3.7 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/text v0.14.0 // indirect
)
Loading

0 comments on commit 80c360e

Please sign in to comment.