diff --git a/Makefile b/Makefile index d1e2d3f9f2..1b89af4226 100644 --- a/Makefile +++ b/Makefile @@ -339,6 +339,19 @@ else endif $(MAKE) wait-for-keycloak +# Start all Lagoon Services with mysql instead of mariadb +up-mysql: +ifeq ($(ARCH), darwin) + IMAGE_REPO=$(CI_BUILD_TAG) docker compose -p $(CI_BUILD_TAG) -f docker-compose.yaml -f docker-compose.local-dev-mysql.yaml -f docker-compose.local-dev.yaml --compatibility up -d +else + # once this docker issue is fixed we may be able to do away with this + # linux-specific workaround: https://github.com/docker/cli/issues/2290 + KEYCLOAK_URL=$$(docker network inspect -f '{{(index .IPAM.Config 0).Gateway}}' bridge):8088 \ + IMAGE_REPO=$(CI_BUILD_TAG) \ + docker compose -p $(CI_BUILD_TAG) -f docker-compose.yaml -f docker-compose.local-dev-mysql.yaml -f docker-compose.local-dev.yaml --compatibility up -d +endif + $(MAKE) wait-for-keycloak + down: IMAGE_REPO=$(CI_BUILD_TAG) docker compose -p $(CI_BUILD_TAG) --compatibility down -v --remove-orphans @@ -379,6 +392,15 @@ ui-logs-development: build-ui-logs-development api-logs-development: build-ui-logs-development IMAGE_REPO=$(CI_BUILD_TAG) COMPOSE_STACK_NAME=$(CI_BUILD_TAG) ADDITIONAL_FLAGS="-f docker-compose.yaml -f docker-compose.local-dev.yaml" ADDITIONAL_SERVICES="" $(MAKE) compose-api-logs-development +# MySQL specific targets for local dev +.PHONY: ui-logs-development-mysql +ui-logs-development-mysql: build-ui-logs-development + IMAGE_REPO=$(CI_BUILD_TAG) COMPOSE_STACK_NAME=$(CI_BUILD_TAG) ADDITIONAL_FLAGS="-f docker-compose.yaml -f docker-compose.local-dev-mysql.yaml -f docker-compose.local-dev.yaml" ADDITIONAL_SERVICES="ui" $(MAKE) compose-api-logs-development + +.PHONY: api-logs-development-mysql +api-logs-development-mysql: build-ui-logs-development + IMAGE_REPO=$(CI_BUILD_TAG) COMPOSE_STACK_NAME=$(CI_BUILD_TAG) ADDITIONAL_FLAGS="-f docker-compose.yaml -f docker-compose.local-dev-mysql.yaml -f docker-compose.local-dev.yaml" ADDITIONAL_SERVICES="" $(MAKE) compose-api-logs-development + # compose-api-logs-development can be consumed by other repositories to start a local api # supported make variable passthrough are # IMAGE_REPO - the docker repostory to use (uselagoon, testlagoon, other) diff --git a/docker-compose.local-dev-mysql.yaml b/docker-compose.local-dev-mysql.yaml new file mode 100644 index 0000000000..d60c44cedc --- /dev/null +++ b/docker-compose.local-dev-mysql.yaml @@ -0,0 +1,23 @@ +version: '3.2' + +volumes: + broker: {} + +services: + api-db: + image: uselagoon/mysql-8.0:latest + command: mysqld --sql_mode="" + environment: + - MYSQL_USER=api + - MYSQL_PASSWORD=api + - MYSQL_DATABASE=infrastructure + keycloak: + environment: + - DB_VENDOR=mysql + - LAGOON_DB_VENDOR=mysql + keycloak-db: + image: uselagoon/mysql-8.0:latest + environment: + - MYSQL_USER=keycloak + - MYSQL_PASSWORD=keycloak + - MYSQL_DATABASE=keycloak \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 87ac0a6143..8b2aad5bbd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,14 +5,9 @@ volumes: services: api-db: - image: uselagoon/mysql-8.0:latest + image: ${IMAGE_REPO:-lagoon}/api-db:${IMAGE_REPO_API_DB_TAG:-${IMAGE_REPO_TAG:-latest}} ports: - '3366:3306' - command: mysqld --sql_mode="" - environment: - - MYSQL_USER=api - - MYSQL_PASSWORD=api - - MYSQL_DATABASE=infrastructure webhook-handler: image: ${IMAGE_REPO:-lagoon}/webhook-handler:${IMAGE_REPO_WEBHOOK_HANDLER_TAG:-${IMAGE_REPO_TAG:-latest}} ports: @@ -161,19 +156,13 @@ services: environment: - KEYCLOAK_FRONTEND_URL=http://localhost:8088/auth/ - KEYCLOAK_ADMIN_EMAIL=admin@example.com - - DB_VENDOR=mysql - - LAGOON_DB_VENDOR=mysql # Uncomment for local new relic tracking # - NEW_RELIC_LICENSE_KEY= # - NEW_RELIC_APP_NAME=keycloak-local keycloak-db: - image: uselagoon/mysql-8.0:latest + image: ${IMAGE_REPO:-lagoon}/keycloak-db:${IMAGE_REPO_KEYCLOAK_DB_TAG:-${IMAGE_REPO_TAG:-latest}} ports: - '3336:3306' - environment: - - MYSQL_USER=keycloak - - MYSQL_PASSWORD=keycloak - - MYSQL_DATABASE=keycloak tests-kubernetes: image: ${IMAGE_REPO:-lagoon}/tests:${IMAGE_REPO_TESTS_TAG:-${IMAGE_REPO_TAG:-latest}} environment: