Skip to content

Commit

Permalink
chore: upgrade rabbitmq and improve docker config
Browse files Browse the repository at this point in the history
- Upgrade rabbitmq version from 3.9 to 3.13
- Improve docker profiles
- Update readme to prefer using docker compose instead of docker-compose
- Add missing volumes
  • Loading branch information
philippechevieux authored and TdyP committed May 2, 2024
1 parent 616b7e5 commit 5c1d392
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
ports:
- "8529:8529"
rabbitmq:
image: rabbitmq:3-management-alpine
image: rabbitmq:3.13-management-alpine
ports:
- "5672:5672"
redis:
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
ports:
- "8529:8529"
rabbitmq:
image: rabbitmq:3-management-alpine
image: rabbitmq:3.13-management-alpine
ports:
- "5672:5672"
redis:
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
- install
services:
rabbitmq:
image: rabbitmq:3-management-alpine
image: rabbitmq:3.13-management-alpine
ports:
- "5672:5672"
steps:
Expand Down
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ curl -O https://raw.githubusercontent.com/leav-solutions/leav-engine/main/docker

3. Start the services:
```
docker-compose -f docker-compose.prod.yml up -d
docker compose -f docker-compose.prod.yml up -d
```

4. Once the install is done, you can access LEAV-Engine at http://core.leav.localhost. The initial start might take a while. During this time, you might encounter a `Bad gateway` error. Wait a few minutes and try to refresh the page. You can check the docker logs to see what's going on.
Expand Down Expand Up @@ -112,12 +112,44 @@ If you want to go deeper into LEAV-Engine or try out the latest features before
Then, all you have to do is:
```
cd docker
docker-compose up -d
docker compose up -d
```
This will start LEAV-Engine in development mode.

⚠️ **Docker v.20.10** or higher is required to run the core.

### Profiles

In development mode LEAV-Engine is started without certain services. To do so we use Docker profiles that allow us to define different configurations for your containers based on specific use cases or environments.

Here are some profiles that you can use:

#### Logs
This profile can be used to retrieve application logs.
Services concerned: `elasticsearch`, `logs-collector`

```bash
docker compose --profile logs up
```

#### Debug
This profile can be used if you need to get more infos about redis or elasticsearch
Services concerned: `redis-commander`, `kibana`.

```bash
docker compose --profile debug up
```

#### Automate
This profile can be used if you need all services related to the automate (events scan, previews generation).
Services concerned: `files-manager`, `preview-generator`, `automate-scan`, `sync-scan`

```bash
docker compose --profile automate up
```

More infos about profiles can be found [here](https://docs.docker.com/compose/profiles/)

# Contributing
We're glad you're interested in contributing to LEAV-Engine!
Giving us feedback or reporting bugs are already a great way to contribute to the project. Feel free to [open an issue](https://github.com/leav-solutions/leav-engine/issues) on this repo, we'll be happy to help you.
Expand Down Expand Up @@ -216,7 +248,7 @@ Default username is `root` with no password.
### ArangoDb Upgrade:
After an upgrade, ArangoDB might not start, saying it requires a db upgrade. Run this command to fix this:
```
docker-compose run arangodb arangod --database.auto-upgrade
docker compose run arangodb arangod --database.auto-upgrade
```


Expand All @@ -227,7 +259,7 @@ docker-compose run arangodb arangod --database.auto-upgrade
You can get into containers with a shell:

```bash
docker-compose exec <service_name> /bin/sh
docker compose exec <service_name> /bin/sh
```

---
Expand Down Expand Up @@ -318,7 +350,7 @@ GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

- Run the following command in docker folder:
```
docker-compose -f docker-compose.yml -f light.yml up -d
docker compose -f docker-compose.yml -f light.yml up -d
```
- Then you can access the core at http://core.leav.localhost

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.4"
# Check https://github.com/leav-solutions/leav-engine/wiki/Configuration for more details about services configuration

##### Common properties #####
x-message-broker-image: &message_broker_image "rabbitmq:3.9-management-alpine"
x-message-broker-image: &message_broker_image "rabbitmq:3.13-management-alpine"
x-traefik-image: &traefik_image "traefik:2.6"
x-redis-image: &redis_image "redis"
x-arango-image: &arango_image "arangodb:3.10"
Expand Down
29 changes: 20 additions & 9 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.4"

##### Common properties #####
x-node-image: &node_image node:18-alpine
x-message-broker-image: &message_broker_image "rabbitmq:3.9-management-alpine"
x-message-broker-image: &message_broker_image "rabbitmq:3.13-management-alpine"
x-traefik-image: &traefik_image "traefik:2.6"
x-redis-image: &redis_image "redis"
x-arango-image: &arango_image "arangodb:3.10"
Expand Down Expand Up @@ -246,7 +246,6 @@ services:

admin:
image: *node_image
user: node
labels:
- traefik.enable=true
- traefik.http.routers.admin.rule=(Host(`core.leav.localhost`) && Path(`/app/admin`, `/app/admin/{route:.*}`)) || Host(`admin.leav.localhost`)
Expand All @@ -272,7 +271,6 @@ services:

data-studio:
image: *node_image
user: node
stdin_open: true
labels:
- traefik.enable=true
Expand All @@ -299,7 +297,6 @@ services:

login:
image: *node_image
user: node
stdin_open: true
labels:
- traefik.enable=true
Expand All @@ -326,7 +323,6 @@ services:

portal:
image: *node_image
user: node
stdin_open: true
labels:
- traefik.enable=true
Expand Down Expand Up @@ -354,6 +350,7 @@ services:
]

automate-scan:
profiles: ["automate"]
image: *node_image
restart: always
environment:
Expand All @@ -374,6 +371,7 @@ services:
]

files-manager:
profiles: ["automate"]
build: *env-build-core
restart: always
environment:
Expand All @@ -395,6 +393,7 @@ services:
]

preview-generator:
profiles: ["automate"]
build:
context: ../apps/preview-generator
dockerfile: ../../docker/DOCKERFILES/PREVIEW_GENERATOR/Dockerfile
Expand All @@ -421,6 +420,7 @@ services:
# Run "docker-compose run --rm sync-scan yarn start" to make the scan
# You need to have a GRAPHQL_API_KEY defined as environment variables (eg. in a .env file)
sync-scan:
profiles: ["automate"]
image: *node_image
labels:
- traefik.enable=true
Expand All @@ -441,7 +441,7 @@ services:

# Feel free to comment out logs-collector and elasticsearch if don't need logs
logs-collector:
profiles: ["non-essential"]
profiles: ["logs"]
image: *node_image
labels:
- traefik.enable=true
Expand Down Expand Up @@ -490,6 +490,7 @@ services:
- traefik.http.services.arangodb.loadbalancer.server.port=8529
volumes:
- arango_data:/var/lib/arangodb3
- arango_data_apps:/var/lib/arangodb3-apps
- ./conf/arangodb/arangod.conf:/etc/arangodb3/arangod.conf
ports:
- "8529:8529"
Expand All @@ -506,16 +507,20 @@ services:
- traefik.enable=true
- traefik.http.routers.message-broker.rule=Host(`rabbitmq.leav.localhost`)
- traefik.http.services.message-broker.loadbalancer.server.port=5672
volumes:
- message-broker_data:/var/lib/rabbitmq

redis:
image: *redis_image
restart: always
labels:
- traefik.enable=true
- traefik.http.services.redis.loadbalancer.server.port=6379
volumes:
- redis_data:/data

redis-commander:
profiles: ["non-essential"]
profiles: ["debug"]
container_name: redis-commander
hostname: redis-commander
image: rediscommander/redis-commander:latest
Expand All @@ -533,7 +538,7 @@ services:
- redis

elasticsearch:
profiles: ["non-essential"]
profiles: ["logs"]
image: elasticsearch:8.10.2
environment:
- discovery.type=single-node
Expand All @@ -544,7 +549,7 @@ services:

## Kibana is used for debugging essentially. Uncommnent following lines if needed
kibana:
profiles: ["non-essential"]
profiles: ["debug"]
image: kibana:8.10.2
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
Expand All @@ -558,6 +563,8 @@ services:
volumes:
arango_data:
driver: local
arango_data_apps:
driver: local
elasticsearch_data:
driver: local
yarn_cache:
Expand Down Expand Up @@ -592,4 +599,8 @@ volumes:
driver: local
node_modules_message-broker:
driver: local
message-broker_data:
driver: local
redis_data:
driver: local

3 changes: 0 additions & 3 deletions docker/scripts/start-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ done

yarn run db:migrate:dev

# To avoid permissions issues later on, in particular during applications install
chown -R node:node /app

# Start the server
yarn run start:watch

0 comments on commit 5c1d392

Please sign in to comment.