Skip to content

Instantly share code, notes, and snippets.

@lbroudoux
Last active January 20, 2023 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbroudoux/e167dcf046b9266781b61398e4256181 to your computer and use it in GitHub Desktop.
Save lbroudoux/e167dcf046b9266781b61398e4256181 to your computer and use it in GitHub Desktop.
[Run Microcks using Colima and docker-compose] Run Microcks using Colima and docker-compose

On Mac M1

Go to a temporary folder and remove previously downloaded latest images:

$ cd ~/Development/temp
$ docker rmi quay.io/microcks/microcks:latest

Clone a fresh copy of Microcks Git repository:

$ git clone https://github.com/microcks/microcks --depth 1
Cloning into 'microcks'...
remote: Enumerating objects: 883, done.
remote: Counting objects: 100% (883/883), done.
remote: Compressing objects: 100% (705/705), done.
remote: Total 883 (delta 292), reused 439 (delta 109), pack-reused 0
Receiving objects: 100% (883/883), 1.09 MiB | 10.88 MiB/s, done.
Resolving deltas: 100% (292/292), done.

Start a Colima virtual machine and retrieve created user id and group id.

$ colima version
colima version 0.5.2
git commit: 6b5b6fe0540e708f0c9d6e8919fab292c671fc72

$ colima start --cpu 4 --memory 8                                                                                                                                                                                                            ─╯
INFO[0000] starting colima                              
INFO[0000] runtime: docker                              
INFO[0000] preparing network ...                         context=vm
INFO[0000] creating and starting ...                     context=vm
INFO[0022] provisioning ...                              context=docker
INFO[0022] starting ...                                  context=docker
INFO[0028] done 

$ colima ssh
colima:/Users/lbroudoux/Development/temp/microcks/install/docker-compose$ id
uid=1024631(lbroudoux) gid=1000(lbroudoux) groups=101(docker),1000(lbroudoux)
colima:/Users/lbroudoux/Development/temp/microcks/install/docker-compose$ exit

Go to docker-compose folder and add a user line on mongo container, reusing the uid and gid retrieved previously:

version: '2'

services:
  mongo:
    image: mongo:3.4.23
    container_name: microcks-db
    volumes:
      - "~/tmp/microcks-data:/data/db"
    user: "1024631:1000"

  keycloak:
    image: wizzn/keycloak:14
    container_name: microcks-sso
    ports:
      - "18080:8080"
    environment:
      DB_VENDOR: "h2"
      KEYCLOAK_USER: "admin"
      KEYCLOAK_PASSWORD: "admin"
      KEYCLOAK_IMPORT: "/tmp/microcks-realm.json"
      KEYCLOAK_FRONTEND_URL: "http://localhost:18080/auth"
    volumes:
      - "./keycloak-realm/microcks-realm-sample.json:/tmp/microcks-realm.json"

  postman:
    image: quay.io/microcks/microcks-postman-runtime:latest
    container_name: microcks-postman-runtime

  app:
    depends_on:
      - mongo
      - keycloak
      - postman
    image: quay.io/microcks/microcks:latest
    container_name: microcks
    ports:
      - "8080:8080"
      - "9090:9090"
    environment:
      - SPRING_PROFILES_ACTIVE=prod
      - SPRING_DATA_MONGODB_URI=mongodb://mongo:27017
      - SPRING_DATA_MONGODB_DATABASE=microcks
      - POSTMAN_RUNNER_URL=http://postman:3000
      - TEST_CALLBACK_URL=http://microcks:8080
      - SERVICES_UPDATE_INTERVAL=0 0 0/2 * * *
      - KEYCLOAK_URL=http://keycloak:8080/auth
      - KEYCLOAK_PUBLIC_URL=http://localhost:18080/auth
      #- MAX_UPLOAD_FILE_SIZE=3MB
$ docker compose -f docker-compose-osx-m1.yml up -d
[+] Running 40/40
 ⠿ postman Pulled                                                                                                                                                                                                                          17.7s
   ⠿ 97518928ae5f Pull complete                                                                                                                                                                                                             9.2s
   ⠿ 468000513d90 Pull complete                                                                                                                                                                                                            11.2s
   ⠿ 7e4d2470b557 Pull complete                                                                                                                                                                                                            11.3s
   ⠿ 26993460ce45 Pull complete                                                                                                                                                                                                            11.4s
   ⠿ fd3482e687fa Pull complete                                                                                                                                                                                                            11.6s
   ⠿ 4f4fb700ef54 Pull complete                                                                                                                                                                                                            11.7s
   ⠿ 984c2e75c5e7 Pull complete                                                                                                                                                                                                            12.4s
   ⠿ 8d20bd2f8e5d Pull complete                                                                                                                                                                                                            12.4s
   ⠿ 5037e8bdb698 Pull complete                                                                                                                                                                                                            15.4s
 ⠿ app Pulled                                                                                                                                                                                                                              18.0s
   ⠿ a96e4e55e78a Pull complete                                                                                                                                                                                                             8.8s
   ⠿ 67d8ef478732 Pull complete                                                                                                                                                                                                             8.9s
   ⠿ f5ed33e9c00f Pull complete                                                                                                                                                                                                            13.7s
   ⠿ 949b6f0a5ab8 Pull complete                                                                                                                                                                                                            13.8s
   ⠿ 743f11984578 Pull complete                                                                                                                                                                                                            13.9s
   ⠿ 5a8e55f52b46 Pull complete                                                                                                                                                                                                            13.9s
   ⠿ 321024b3aec5 Pull complete                                                                                                                                                                                                            14.0s
   ⠿ c6f2d43dfbdd Pull complete                                                                                                                                                                                                            15.8s
 ⠿ keycloak Pulled                                                                                                                                                                                                                         17.9s
   ⠿ cac3f62e10a2 Pull complete                                                                                                                                                                                                             3.6s
   ⠿ 40ca02a06765 Pull complete                                                                                                                                                                                                             3.7s
   ⠿ 72479fde7da1 Pull complete                                                                                                                                                                                                             9.4s
   ⠿ 4f39170d1afd Pull complete                                                                                                                                                                                                             9.4s
   ⠿ c9e9a10e96b9 Pull complete                                                                                                                                                                                                            16.3s
 ⠿ mongo Pulled                                                                                                                                                                                                                            13.5s
   ⠿ 185661474c6b Pull complete                                                                                                                                                                                                             5.0s
   ⠿ 053aaa7a7ba3 Pull complete                                                                                                                                                                                                             5.1s
   ⠿ 80ccb1337bb9 Pull complete                                                                                                                                                                                                             5.2s
   ⠿ f6d1fb143b02 Pull complete                                                                                                                                                                                                             5.4s
   ⠿ 2bb5670f8b28 Pull complete                                                                                                                                                                                                             5.4s
   ⠿ b5dc4d732d9c Pull complete                                                                                                                                                                                                             5.8s
   ⠿ 9e5bf096d719 Pull complete                                                                                                                                                                                                             6.0s
   ⠿ a15e9a225ef3 Pull complete                                                                                                                                                                                                             6.1s
   ⠿ bb112d85d5fd Pull complete                                                                                                                                                                                                             6.2s
   ⠿ bd6337074027 Pull complete                                                                                                                                                                                                             6.5s
   ⠿ 146e63332e66 Pull complete                                                                                                                                                                                                            11.3s
   ⠿ 4308ecd8d844 Pull complete                                                                                                                                                                                                            11.4s
   ⠿ cdde960986c8 Pull complete                                                                                                                                                                                                            11.5s
   ⠿ 2f58766fbe4e Pull complete                                                                                                                                                                                                            11.5s
[+] Running 5/5
 ⠿ Network docker-compose_default      Created                                                                                                                                                                                              0.0s
 ⠿ Container microcks-db               Started                                                                                                                                                                                              1.5s
 ⠿ Container microcks-sso              Started                                                                                                                                                                                              1.4s
 ⠿ Container microcks-postman-runtime  Started                                                                                                                                                                                              1.2s
 ⠿ Container microcks                  Started                                                                                                                                                                                              1.5s

After some minutes, check everything is running. Microcks app is bound on localhost:8080, Keyclaok is bound on localhost:18080:

docker ps
CONTAINER ID   IMAGE                                              COMMAND                  CREATED          STATUS          PORTS                                                                                                      NAMES
c822cc67c7fb   quay.io/microcks/microcks:latest                   "/deployments/run-ja…"   21 seconds ago   Up 19 seconds   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 8778/tcp, 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 9779/tcp   microcks
a27f9cbeef0a   quay.io/microcks/microcks-postman-runtime:latest   "docker-entrypoint.s…"   21 seconds ago   Up 19 seconds   3000/tcp                                                                                                   microcks-postman-runtime
f678201de5c5   mongo:3.4.23                                       "docker-entrypoint.s…"   21 seconds ago   Up 19 seconds   27017/tcp                                                                                                  microcks-db
7c619990d699   wizzn/keycloak:14                                  "/opt/jboss/tools/do…"   21 seconds ago   Up 19 seconds   8443/tcp, 0.0.0.0:18080->8080/tcp, :::18080->8080/tcp                                                      microcks-sso

Now, follow the Getting Started guide. Then access Microcks on localhost:8080 from your browser and use admin/microcks123 to log in.

That's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment