Skip to content

Commit

Permalink
feat(lba-2282): maj infra mongodb (#1679)
Browse files Browse the repository at this point in the history
* feat: copie pr

* feat: nettoyage
  • Loading branch information
alanlr authored Dec 2, 2024
1 parent 57716db commit 4e2700e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
12 changes: 0 additions & 12 deletions .bin/scripts/setup-local-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ echo "NEXT_PUBLIC_VERSION=0.0.0-local" >> "${ROOT_DIR}/ui/.env"
echo "NEXT_PUBLIC_API_PORT=5001" >> "${ROOT_DIR}/ui/.env"

yarn

if [ "$OS_NAME" == "Linux" ]; then
chmod 440 "${ROOT_DIR}/.infra/local/mongo_keyfile"
chown 999:999 "${ROOT_DIR}/.infra/local/mongo_keyfile"
elif [ "$OS_NAME" == "Darwin" ]; then
chmod 400 "${ROOT_DIR}/.infra/local/mongo_keyfile"
else
echo "Système d'exploitation non pris en charge : $OS_NAME"
fi

yarn
chmod 400 "${ROOT_DIR}/.infra/local/mongo_keyfile"
yarn services:start
yarn setup:mongodb
yarn build:dev
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ jobs:

- name: start mongodb service
run: |
chmod 400 .infra/local/mongo_keyfile
sudo chown 999:999 .infra/local/mongo_keyfile
docker compose up -d --wait mongodb
docker compose up --build -d --wait mongodb
yarn setup:mongodb
- name: test
Expand Down
8 changes: 8 additions & 0 deletions .infra/local/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mongo:7
COPY ./mongo_keyfile /tmp/mongo_keyfile
COPY ./mongod.conf /etc/mongod.conf
RUN chown mongodb:mongodb /etc/mongod.conf
RUN chown mongodb:mongodb /tmp/mongo_keyfile
RUN chmod 400 /tmp/mongo_keyfile

CMD ["mongod", "--config", "/etc/mongod.conf"]
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
services:
mongodb:
image: mongo:6.0.11 # locked by OVH production version
build: ./.infra/local/
restart: unless-stopped
hostname: mongodb
mem_limit: 5g
ports:
- "127.0.0.1:27017:27017"
command: ["-f", "/etc/mongod.conf"]
volumes:
- lba_mongodb_data:/data
- ./.infra/local/mongo_keyfile:/tmp/mongo_keyfile
- ./.infra/local/mongod.conf:/etc/mongod.conf
healthcheck:
test: ["CMD", "mongosh", "--eval", '''db.runCommand("ping").ok''', "--quiet"]
interval: 10s
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"migration:create": "yarn cli migrations:create",
"server:dev": "yarn workspace server dev",
"ui:dev": "yarn workspace ui dev",
"services:start": "docker compose up --remove-orphans -d",
"services:start": "docker compose up --build --remove-orphans -d --wait",
"services:stop": "docker compose down",
"services:clean": "yarn services:stop; docker system prune --volumes",
"seed:update": "./.bin/mna-lba seed:update",
Expand Down

0 comments on commit 4e2700e

Please sign in to comment.