From aff248eb9b24dfedd67c0198acb0b96048d33494 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Mon, 13 May 2024 10:52:42 +1000 Subject: [PATCH] chore: update services and add readme --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++ TESTING_dockercompose.md | 16 +++++----- docker-compose.yml | 10 +++---- 3 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f5c67da --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# Lagoon Internal Services Test + +This project was designed to perform a functional test on a given native Lagoon service. + +It works by +* taking a service type (e.g. solr, redis, postgres etc) +* taking a service name (e.g. solr-9, redis-6, postgres-15) that matches the docker compose service name +* writing a set of predefined variables into the selected services data store +* reading this data back to a web page for easy validation + +## Supported services + +Internal Services Test currently supports +* [MariaDB](https://docs.lagoon.sh/docker-images/mariadb/) - use `mariadb` +* [MongoDB](https://docs.lagoon.sh/docker-images/mongodb/) - use `mongodb` +* [OpenSearch](https://docs.lagoon.sh/docker-images/opensearch/) - use `opensearch` +* [PostgreSQL](https://docs.lagoon.sh/docker-images/postgres/) - use `postgres` +* [Redis](https://docs.lagoon.sh/docker-images/redis/) - use `redis` +* [Solr](https://docs.lagoon.sh/docker-images/solr/) - use `solr` +* [Persistent Storage](https://docs.lagoon.sh/concepts-basics/docker-compose-yml/#persistent-storage/) - use `storage` + +As we add more service types to Lagoon, this list may expand + +## Usage in Docker Compose locally + +This project can be cloned, and the services started with: + +``` +docker compose build +docker compose up -d +``` + +You can then access the main test interface at `http://0.0.0.0:3000/` - note that there is no default page (yet) + +To check a service, use this format http://0.0.0.0:3000/{service-type}?service={service-name} + +``` +internal-services-test$ curl -kL http://0.0.0.0:3000/opensearch?service=opensearch-2 +"SERVICE_HOST=opensearch-2" +"LAGOON_ENVIRONMENT_TYPE=development" +"LAGOON_GIT_SHA=SHA256" +"LAGOON_TEST_VAR=internal-services-test" +``` +and to check a storage path +``` +internal-services-test$ curl -kL http://0.0.0.0:3000/storage?path=/app/files +"STORAGE_PATH=/app/files/storage.txt" +"LAGOON_GIT_SHA=SHA256" +"LAGOON_ENVIRONMENT_TYPE=development" +"LAGOON_TEST_VAR=internal-services-test" +``` + +### Additional or custom variables + +In the docker-compose.yml file, you can update the environment variables in the `web` service and restart the docker-compose service. This will provide the updated variables to the service next time it is called. + +## Usage in Lagoon + +This project can also be cloned and deployed into a Lagoon cluster, using the same patterns as above for verification. + +Note that by default, all services in the docker-compose.yml will be deployed + + + diff --git a/TESTING_dockercompose.md b/TESTING_dockercompose.md index 433b73c..7f7eb95 100644 --- a/TESTING_dockercompose.md +++ b/TESTING_dockercompose.md @@ -25,8 +25,8 @@ Run the following commands to validate things are rolling as they should. # Ensure services are ready to connect 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://postgres-12:5432 -timeout 1m +docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://postgres-16: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-6:6379 -timeout 1m @@ -45,13 +45,13 @@ docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?servic 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?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-12 should be able to read/write data +docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-12" | grep "SERVICE_HOST=PostgreSQL 12" +docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-12" | 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?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" +# postgres-16 should be able to read/write data +docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-16" | grep "SERVICE_HOST=PostgreSQL 16" +docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-16" | 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?service=opensearch-2" | grep "SERVICE_HOST=opensearch-2" diff --git a/docker-compose.yml b/docker-compose.yml index e4a9ad6..c29c69a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,16 +42,16 @@ services: ports: - '3306' - postgres-11: - image: uselagoon/postgres-11:latest + postgres-12: + image: uselagoon/postgres-12:latest labels: lagoon.type: postgres-single lagoon.persistent.size: 100Mi ports: - '5432' - postgres-15: - image: uselagoon/postgres-15:latest + postgres-16: + image: uselagoon/postgres-16:latest labels: lagoon.type: postgres ports: @@ -116,7 +116,7 @@ services: - mycore solr-9: - image: testlagoon/solr-9:pr-963 + image: uselagoon/solr-9:latest labels: lagoon.type: solr lagoon.persistent.size: 100Mi