Created
June 20, 2023 16:18
-
-
Save iperdomo/7acee48029600c1ff0bbe13c3d5f3c0a to your computer and use it in GitHub Desktop.
LiteFarm local setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docker-compose.override.yml b/docker-compose.override.yml | |
new file mode 100644 | |
index 000000000..af804c70e | |
--- /dev/null | |
+++ b/docker-compose.override.yml | |
@@ -0,0 +1,41 @@ | |
+version: "3.7" | |
+ | |
+services: | |
+ api: | |
+ container_name: litefarm-api | |
+ image: node:16.15.0 | |
+ volumes: | |
+ - ./packages/shared:/shared | |
+ - ./packages/api:/api | |
+ working_dir: /api | |
+ entrypoint: ./dev.sh | |
+ user: node | |
+ restart: unless-stopped | |
+ environment: | |
+ - DEV_DATABASE_HOST=db | |
+ - DEV_DATABASE=pg-litefarm | |
+ - DEV_DATABASE_USER=postgres | |
+ - DEV_DATABASE_PASSWORD=postgres | |
+ - TEST_DATABASE_HOST=db | |
+ - TEST_DATABASE=test_farm | |
+ - TEST_DATABASE_USER=postgres | |
+ - TEST_DATABASE_PASSWORD=postgres | |
+ - WAIT_HOSTS=db:5432 | |
+ - NODE_ENV=development | |
+ - PORT=5000 | |
+ depends_on: | |
+ - db | |
+ ports: | |
+ - "5000:5000" | |
+ webapp: | |
+ container_name: litefarm-webapp | |
+ image: node:16.15.0 | |
+ volumes: | |
+ - ./packages/shared:/shared | |
+ - ./packages/webapp:/webapp | |
+ working_dir: /webapp | |
+ entrypoint: ./dev.sh | |
+ restart: unless-stopped | |
+ ports: | |
+ - "3000:3000" | |
+ - "6006:6006" | |
diff --git a/packages/api/dev.sh b/packages/api/dev.sh | |
new file mode 100755 | |
index 000000000..e92ea07d1 | |
--- /dev/null | |
+++ b/packages/api/dev.sh | |
@@ -0,0 +1,9 @@ | |
+#!/usr/bin/env bash | |
+ | |
+set -eu | |
+ | |
+# We assume we're running using `node` user | |
+[[ ! -d "node_modules" ]] && { echo "Installing modules..."; npm install; } | |
+ | |
+npm run migrate:dev:db | |
+npm run nodemon | |
diff --git a/packages/webapp/dev.sh b/packages/webapp/dev.sh | |
new file mode 100755 | |
index 000000000..ec857427a | |
--- /dev/null | |
+++ b/packages/webapp/dev.sh | |
@@ -0,0 +1,12 @@ | |
+#!/usr/bin/env bash | |
+ | |
+set -eu | |
+ | |
+# We assume we're running as `root` user | |
+# Install pnpm globally | |
+command -v pnpm > /dev/null 2>&1 || { echo "Installing pnpm..."; npm install -g pnpm; } | |
+ | |
+# Install node modules as `node` user | |
+[[ ! -d "node_modules" ]] && { echo "Installing modules"; su node -c "pnpm install"; } | |
+ | |
+su node -c "pnpm dev" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment