Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(backend): update mongodb conf #383

Merged
merged 3 commits into from
Dec 12, 2024
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
8 changes: 6 additions & 2 deletions .bin/scripts/setup-local-env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

OS_NAME=$(uname -s)

ansible_extra_opts+=("--vault-password-file" "${SCRIPT_DIR}/get-vault-password-client.sh")
readonly VAULT_FILE="${ROOT_DIR}/.infra/vault/vault.yml"

echo "Updating local server/.env & ui/.env"
ANSIBLE_CONFIG="${ROOT_DIR}/.infra/ansible/ansible.cfg" ansible all \
--limit "local" \
Expand All @@ -16,14 +21,13 @@ ANSIBLE_CONFIG="${ROOT_DIR}/.infra/ansible/ansible.cfg" ansible all \
--vault-password-file="${SCRIPT_DIR}/get-vault-password-client.sh"

echo "PUBLIC_VERSION=0.0.0-local" >> "${ROOT_DIR}/server/.env"
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> "${ROOT_DIR}/server/.env"

echo "NEXT_PUBLIC_ENV=local" >> "${ROOT_DIR}/ui/.env"
echo "NEXT_PUBLIC_VERSION=0.0.0-local" >> "${ROOT_DIR}/ui/.env"
echo "NEXT_PUBLIC_API_PORT=5001" >> "${ROOT_DIR}/ui/.env"


yarn
chmod 400 "${ROOT_DIR}/.infra/local/mongo_keyfile"
yarn services:start
yarn setup:mongodb
yarn build:dev
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"]
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fileignoreconfig:
- filename: .bin/scripts/get-vault-password-client.sh
checksum: 51d7feb20247935b41b622a3c4221231719ca2bb8b178dffa03d44b993087c9c
- filename: .bin/scripts/setup-local-env.sh
checksum: 54fd4e752443d273eefcc0cd03e8e19e373607a1d2d7d3b3e1b52114ebe86f5f
checksum: 72cf1ee4c73d59010fe1faf035aa4c775064c88e67a3d9c11639ac2ba3be527b
- filename: .github/workflows/_deploy.yml
checksum: bfbfdbf9032949561988a0961dce57f2e786716de5fa5b7e937d5d3a6e5a7aad
- filename: .github/workflows/deploy_preview.yml
Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
services:
mongodb:
image: mongo:6.0.2-focal
build: ./.infra/local
restart: unless-stopped
hostname: mongodb
ports:
- "127.0.0.1:27017:27017"
command: ["-f", "/etc/mongod.conf"]
volumes:
- bal_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 @@ -35,7 +35,7 @@
"migrations: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 --wait",
"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-bal seed:update",
Expand Down
Loading