Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix docker compose distribution #2167

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions distro/docker-compose/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@ APICURIO_UI_VERSION=latest-release
HOST=$HOST

#KEYCLOAK

KC_MYSQL_DATABASE=keycloak
KC_MYSQL_ROOT_PASSWORD=$KC_ROOT_DB_PASSWORD
KC_MYSQL_USER=keycloak
KC_MYSQL_PASSWORD=$KC_DB_PASSWORD

KEYCLOAK_USER=admin
KEYCLOAK_PASSWORD=$KC_PASSWORD

DB_VENDOR=mysql
DB_ADDR=jboss-keycloak-mysql
DB_USER=keycloak
DB_PASSWORD=$KC_DB_PASSWORD

QUARKUS_PROFILE=prod

#APICURIO-STUDIO
Expand All @@ -29,8 +18,8 @@ AS_DATABASE=apicuriodb
AS_DB_USER=apicurio
AS_DB_PASSWORD=$AS_DB_PASSWORD

APICURIO_KC_AUTH_URL=https://studio-auth.apicur.io/auth
APICURIO_KC_REALM=apicurio-local
APICURIO_KC_AUTH_URL=http://localhost:8080
APICURIO_KC_REALM=apicurio

APICURIO_DB_TYPE=$DB_TYPE
APICURIO_DB_DRIVER_NAME=$DB_DRIVER
Expand All @@ -47,8 +36,8 @@ APICURIO_GITLAB_API_URL=
APICURIO_BITBUCKET_API_URL=

APICURIO_UI_KC_CLIENT_ID=apicurio-studio
APICURIO_UI_HUB_API_URL=http://$HOST:8091
APICURIO_UI_EDITING_URL=ws://$HOST:8092
APICURIO_UI_HUB_API_URL=http://localhost:8091
APICURIO_UI_EDITING_URL=ws://localhost:8092
APICURIO_UI_FEATURE_MICROCKS=true
APICURIO_UI_VALIDATION_CHANNELNAME_REGEXP='([^\x00-\x20\x7f"'\''%<>\\^`{|}]|%[0-9A-Fa-f]{2}|\{[+#./;?&=,!@|]?((\w|%[0-9A-Fa-f]{2})(\.?(\w|%[0-9A-Fa-f]{2}))*(:[1-9]\d{0,3}|\*)?)(,((\w|%[0-9A-Fa-f]{2})(\.?(\w|%[0-9A-Fa-f]{2}))*(:[1-9]\d{0,3}|\*)?))*\})*'

Expand Down
47 changes: 5 additions & 42 deletions distro/docker-compose/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,6 @@ The scripts will create 3 files:
Supported databases:
- postgresql

### Docker based setup

The easiest way is to open a terminal or PowerShell, and navigate into distro/quarkus-docker-compose folder. In this folder enter the command below. On Windows please make sure, that your drives shares are enabled!

```
On Linux/Mac:

docker run -v $(pwd):/apicurio carnalca/apicurio-setup-image:latest bash /apicurio/setup.sh {IP_OF_YOUR_HOST}

For example:
docker run -v $(pwd):/apicurio carnalca/apicurio-setup-image:latest bash /apicurio/setup.sh 192.168.1.231
```

```
On Windows:

docker run -v ${PWD}:/apicurio chriske/apicurio-setup-image:latest bash /apicurio/setup.sh {IP_OF_YOUR_HOST}

For example:
docker run -v ${PWD}:/apicurio chriske/apicurio-setup-image:latest bash /apicurio/setup.sh 192.168.1.231
```

This command will pull a minimal alpine linux based image, mount the current folder to it, and it will run the setup script. At the end of the run, it will print the admin password for Keycloak, and the URLs for the services. Like this:

```
Keycloak username: admin
Keycloak password: op4oUQ

Keycloak URL: 192.168.1.231:8090
Apicurio URL: 192.168.1.231:8093
Microcks URL: 192.168.1.231:8900

```

Please copy these values somewhere where you can find them easily!

### Script based setup

If you're using NIX based OS, you can run the setup script without the docker wrapper. The only dependency is "util-linux" package which contains a tool called uuidgen.
Expand Down Expand Up @@ -99,12 +63,11 @@ For PostgreSQL config:

### Recommended Approach due to a bug in Quarkus

If you want to do it manually, here are the commands. You will need to start Keycloak, then wait and then start the Quarkus apps:
If you want to do it manually, here is the command:

```
docker-compose -f docker-compose.keycloak.yml build && docker-compose -f docker-compose.keycloak.yml up

docker-compose -f docker-compose.microcks.yml -f docker-compose.apicurio.yml -f docker-compose-as-postgre.yml up
docker-compose -f docker-compose.microcks.yml -f docker-compose.apicurio.yml up

```

Expand All @@ -120,7 +83,7 @@ docker system prune --volumes
The Keycloak instance is already configured, you don't have to create the realms manually.

At the first start there are no default users added to Keycloak. Please navigate to:
`http://YOUR_IP:8090`
`http://localhost:8090`

The default credentials for Keycloak are: `admin` and the password can be found in the previously generated `.env` file, under `KEYCLOAK_PASSWORD`.

Expand All @@ -129,5 +92,5 @@ Select Apicurio realm and add a user to it. After this, you have to do this with

## Login to Apicurio and Microcks

Apicurio URL: `http://YOUR_IP:8093`
Microcks URL: `http://YOUR_IP:8900`
Apicurio URL: `http://localhost:8093`
Microcks URL: `http://localhost:8900`
11 changes: 0 additions & 11 deletions distro/docker-compose/docker-compose-as-postgre.yml

This file was deleted.

42 changes: 32 additions & 10 deletions distro/docker-compose/docker-compose.apicurio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@ volumes:
services:

apicurio-studio-db:

image: 'postgres:15.2'
environment:
POSTGRES_DB: ${AS_DATABASE}
POSTGRES_USER: ${AS_DB_USER}
POSTGRES_PASSWORD: ${AS_DB_PASSWORD}
volumes:
- 'postgre_apicurio:/var/lib/postgresql/data'
network_mode: host

apicurio-studio-ws:
image: 'apicurio/apicurio-studio-ws:${APICURIO_WS_VERSION}'
depends_on:
- apicurio-studio-db
ports:
- '8092:8080'
environment:
JAVA_TOOL_OPTIONS: '-Djava.net.preferIPv4Stack=true'

QUARKUS_PROFILE: ${QUARKUS_PROFILE}

QUARKUS_HTTP_PORT: 8092
APICURIO_HUB_STORAGE_JDBC_TYPE: ${APICURIO_DB_TYPE}
APICURIO_DB_DRIVER_NAME: ${APICURIO_DB_DRIVER_NAME}
APICURIO_DB_CONNECTION_URL: ${APICURIO_DB_CONNECTION_URL}
APICURIO_DB_USER_NAME: ${APICURIO_DB_USER_NAME}
APICURIO_DB_PASSWORD: ${APICURIO_DB_PASSWORD}
APICURIO_DB_INITIALIZE: ${WS_APICURIO_DB_INITIALIZE}
APICURIO_SHARE_FOR_EVERYONE: ${APICURIO_SHARE_FOR_EVERYONE}
network_mode: host


apicurio-studio-api:
Expand All @@ -34,13 +40,12 @@ services:
depends_on:
- apicurio-studio-db
- apicurio-studio-ws
ports:
- '8091:8080'
- keycloak-server
environment:
JAVA_TOOL_OPTIONS: '-Djava.net.preferIPv4Stack=true'

QUARKUS_PROFILE: ${QUARKUS_PROFILE}

QUARKUS_HTTP_PORT: 8091
APICURIO_KC_AUTH_URL: ${APICURIO_KC_AUTH_URL}
APICURIO_KC_REALM: ${APICURIO_KC_REALM}
APICURIO_KC_CLIENT_ID: ${API_APICURIO_KC_CLIENT_ID}
Expand All @@ -56,6 +61,7 @@ services:
APICURIO_GITLAB_API_URL: ${APICURIO_GITLAB_API_URL}
APICURIO_BITBUCKET_API_URL: ${APICURIO_BITBUCKET_API_URL}
APICURIO_SHARE_FOR_EVERYONE: ${APICURIO_SHARE_FOR_EVERYONE}
network_mode: host


apicurio-studio-ui:
Expand All @@ -64,11 +70,10 @@ services:
depends_on:
- apicurio-studio-api
- apicurio-studio-ws
ports:
- '8093:8080'
- keycloak-server
environment:
JAVA_TOOL_OPTIONS: '-Djava.net.preferIPv4Stack=true'

QUARKUS_HTTP_PORT: 8093
QUARKUS_PROFILE: ${QUARKUS_PROFILE}

APICURIO_KC_CLIENT_ID: ${APICURIO_UI_KC_CLIENT_ID}
Expand All @@ -80,3 +85,20 @@ services:
APICURIO_UI_FEATURE_SHARE_WITH_EVERYONE: ${APICURIO_UI_FEATURE_SHARE_WITH_EVERYONE}
APICURIO_UI_LOGOUT_REDIRECT_URI: /
APICURIO_UI_VALIDATION_CHANNELNAME_REGEXP: ${APICURIO_UI_VALIDATION_CHANNELNAME_REGEXP}
APICURIO_OIDC_REDIRECT_HTTPS: "false"
network_mode: host

keycloak-server:
image: quay.io/keycloak/keycloak:19.0.2
environment:
KEYCLOAK_ADMIN: ${KEYCLOAK_USER}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_PASSWORD}
KEYCLOAK_IMPORT: /microcks-keycloak-config/apicurio-realm.json,/microcks-keycloak-config/microcks-realm.json
command:
- start-dev
- --import-realm
volumes:
- ./config/keycloak/apicurio-realm.json:/opt/keycloak/data/import/apicurio-realm.json
- ./config/keycloak/microcks-realm.json:/opt/keycloak/data/import/microcks-realm.json
network_mode: host

36 changes: 36 additions & 0 deletions distro/docker-compose/docker-compose.microcks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: '3'

volumes:
mongo_data2: {}

networks:
main:
services:
mongo:
image: mongo:3.4.23
container_name: microcks-mongo
volumes:
- "mongo_data2:/data/db"

postman:
image: microcks/microcks-postman-runtime:latest
container_name: microcks-postman-runtime

microcks:
depends_on:
- mongo
- postman
- keycloak-server
image: microcks/microcks:latest
container_name: microcks
volumes:
- ./config:/deployments/config
ports:
- "8900:8080"
environment:
SPRING_PROFILES_ACTIVE: ${MR_SPRING_PROFILES_ACTIVE}
SPRING_DATA_MONGODB_URI: ${MR_SPRING_DATA_MONGODB_URI}
SPRING_DATA_MONGODB_DATABASE: ${MR_SPRING_DATA_MONGODB_DATABASE}
POSTMAN_RUNNER_URL: ${MR_POSTMAN_RUNNER_URL}
TEST_CALLBACK_URL: ${MR_TEST_CALLBACK_URL}
KEYCLOAK_URL: ${MR_KEYCLOAK_URL}
3 changes: 0 additions & 3 deletions distro/docker-compose/keycloak/Dockerfile

This file was deleted.

Loading