[WEB-3991] chore: local dev improvements (#6991)

* chore: local dev improvements

* chore: pr feedback

* chore: fix setup

* fix: env variables updated in .env.example files

* fix(local): sign in to admin and web

* chore: update minio deployment to create an bucket automatically on startup.

* chore: resolve merge conflict

* chore: updated api env with live base path

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
This commit is contained in:
Aaron Heckmann
2025-04-30 09:16:59 -07:00
committed by GitHub
parent 1e46290727
commit 28f9733d1b
17 changed files with 234 additions and 166 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
node_modules
.next
.yarn
### NextJS ###
# Dependencies

1
.yarnrc.yml Normal file
View File

@@ -0,0 +1 @@
nodeLinker: node-modules

View File

@@ -35,7 +35,8 @@ This helps us triage and manage issues more efficiently.
### Requirements
- Node.js version v16.18.0
- Docker Engine installed and running
- Node.js version 20+ [LTS version](https://nodejs.org/en/about/previous-releases)
- Python version 3.8+
- Postgres version v14
- Redis version v6.2.7
@@ -68,6 +69,17 @@ chmod +x setup.sh
docker compose -f docker-compose-local.yml up
```
5. Start web apps:
```bash
yarn dev
```
6. Open your browser to http://localhost:3001/god-mode/ and register yourself as instance admin
7. Open up your browser to http://localhost:3000 then log in using the same credentials from the previous step
Thats it! Youre all set to begin coding. Remember to refresh your browser if changes dont auto-reload. Happy contributing! 🎉
## Missing a Feature?
If a feature is missing, you can directly _request_ a new one [here](https://github.com/makeplane/plane/issues/new?assignees=&labels=feature&template=feature_request.yml&title=%F0%9F%9A%80+Feature%3A+). You also can do the same by choosing "🚀 Feature" when raising a [New Issue](https://github.com/makeplane/plane/issues/new/choose) on our GitHub Repository.

View File

@@ -85,38 +85,7 @@ Access real-time insights across all your Plane data. Visualize trends, remove b
## 🛠️ Local development
### Pre-requisites
- Ensure Docker Engine is installed and running.
### Development setup
Setting up your local environment is simple and straightforward. Follow these steps to get started:
1. Clone the repository:
```
git clone https://github.com/makeplane/plane.git
```
2. Navigate to the project folder:
```
cd plane
```
3. Create a new branch for your feature or fix:
```
git checkout -b <feature-branch-name>
```
4. Run the setup script in the terminal:
```
./setup.sh
```
5. Open the project in an IDE such as VS Code.
6. Review the `.env` files in the relevant folders. Refer to [Environment Setup](./ENV_SETUP.md) for details on the environment variables used.
7. Start the services using Docker:
```
docker compose -f docker-compose-local.yml up -d
```
Thats it! Youre all set to begin coding. Remember to refresh your browser if changes dont auto-reload. Happy contributing! 🎉
See [CONTRIBUTING](./CONTRIBUTING.md)
## ⚙️ Built with
[![Next JS](https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white)](https://nextjs.org/)

View File

@@ -1,3 +1,12 @@
NEXT_PUBLIC_API_BASE_URL=""
NEXT_PUBLIC_API_BASE_URL="http://localhost:8000"
NEXT_PUBLIC_WEB_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_ADMIN_BASE_URL="http://localhost:3001"
NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
NEXT_PUBLIC_WEB_BASE_URL=""
NEXT_PUBLIC_SPACE_BASE_URL="http://localhost:3002"
NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
NEXT_PUBLIC_LIVE_BASE_URL="http://localhost:3100"
NEXT_PUBLIC_LIVE_BASE_PATH="/live"

View File

@@ -17,10 +17,10 @@
"@headlessui/react": "^1.7.19",
"@plane/constants": "*",
"@plane/hooks": "*",
"@plane/services": "*",
"@plane/types": "*",
"@plane/ui": "*",
"@plane/utils": "*",
"@plane/services": "*",
"@tailwindcss/typography": "^0.5.9",
"@types/lodash": "^4.17.0",
"autoprefixer": "10.4.14",

View File

@@ -1,7 +1,7 @@
# Backend
# Debug value for api server use it as 0 for production use
DEBUG=0
CORS_ALLOWED_ORIGINS="http://localhost"
CORS_ALLOWED_ORIGINS="http://localhost:3000,http://localhost:3001,http://localhost:3002,http://localhost:3100"
# Database Settings
POSTGRES_USER="plane"
@@ -27,7 +27,7 @@ RABBITMQ_VHOST="plane"
AWS_REGION=""
AWS_ACCESS_KEY_ID="access-key"
AWS_SECRET_ACCESS_KEY="secret-key"
AWS_S3_ENDPOINT_URL="http://plane-minio:9000"
AWS_S3_ENDPOINT_URL="http://localhost:9000"
# Changing this requires change in the nginx.conf for uploads if using minio setup
AWS_S3_BUCKET_NAME="uploads"
# Maximum file upload limit
@@ -37,22 +37,31 @@ FILE_SIZE_LIMIT=5242880
DOCKERIZED=1 # deprecated
# set to 1 If using the pre-configured minio setup
USE_MINIO=1
USE_MINIO=0
# Nginx Configuration
NGINX_PORT=80
# Email redirections and minio domain settings
WEB_URL="http://localhost"
WEB_URL="http://localhost:8000"
# Gunicorn Workers
GUNICORN_WORKERS=2
# Base URLs
ADMIN_BASE_URL=
SPACE_BASE_URL=
APP_BASE_URL=
ADMIN_BASE_URL="http://localhost:3001"
ADMIN_BASE_PATH="/god-mode"
SPACE_BASE_URL="http://localhost:3002"
SPACE_BASE_PATH="/spaces"
APP_BASE_URL="http://localhost:3000"
APP_BASE_PATH=""
LIVE_BASE_URL="http://localhost:3100"
LIVE_BASE_PATH="/live"
LIVE_SERVER_SECRET_KEY="secret-key"
# Hard delete files after days
HARD_DELETE_AFTER_DAYS=60

View File

@@ -14,17 +14,29 @@ def base_host(request: Request | HttpRequest, is_admin: bool = False, is_space:
# Admin redirections
if is_admin:
admin_base_path = getattr(settings, "ADMIN_BASE_PATH", "/god-mode/")
if not admin_base_path.startswith("/"):
admin_base_path = "/" + admin_base_path
if not admin_base_path.endswith("/"):
admin_base_path += "/"
if settings.ADMIN_BASE_URL:
return settings.ADMIN_BASE_URL
return settings.ADMIN_BASE_URL + admin_base_path
else:
return base_origin + "/god-mode/"
return base_origin + admin_base_path
# Space redirections
if is_space:
space_base_path = getattr(settings, "SPACE_BASE_PATH", "/spaces/")
if not space_base_path.startswith("/"):
space_base_path = "/" + space_base_path
if not space_base_path.endswith("/"):
space_base_path += "/"
if settings.SPACE_BASE_URL:
return settings.SPACE_BASE_URL
return settings.SPACE_BASE_URL + space_base_path
else:
return base_origin + "/spaces/"
return base_origin + space_base_path
# App Redirection
if is_app:

View File

@@ -312,9 +312,13 @@ CSRF_FAILURE_VIEW = "plane.authentication.views.common.csrf_failure"
# Base URLs
ADMIN_BASE_URL = os.environ.get("ADMIN_BASE_URL", None)
ADMIN_BASE_PATH = os.environ.get("ADMIN_BASE_PATH", None)
SPACE_BASE_URL = os.environ.get("SPACE_BASE_URL", None)
SPACE_BASE_PATH = os.environ.get("SPACE_BASE_PATH", None)
APP_BASE_URL = os.environ.get("APP_BASE_URL")
APP_BASE_PATH = os.environ.get("APP_BASE_PATH", None)
LIVE_BASE_URL = os.environ.get("LIVE_BASE_URL")
LIVE_BASE_PATH = os.environ.get("LIVE_BASE_PATH")
WEB_URL = os.environ.get("WEB_URL")
HARD_DELETE_AFTER_DAYS = int(os.environ.get("HARD_DELETE_AFTER_DAYS", 60))

View File

@@ -19,17 +19,29 @@ def base_host(request: Request | HttpRequest, is_admin: bool = False, is_space:
# Admin redirections
if is_admin:
admin_base_path = getattr(settings, "ADMIN_BASE_PATH", "/god-mode/")
if not admin_base_path.startswith("/"):
admin_base_path = "/" + admin_base_path
if not admin_base_path.endswith("/"):
admin_base_path += "/"
if settings.ADMIN_BASE_URL:
return settings.ADMIN_BASE_URL
return settings.ADMIN_BASE_URL + admin_base_path
else:
return base_origin + "/god-mode/"
return base_origin + admin_base_path
# Space redirections
if is_space:
space_base_path = getattr(settings, "SPACE_BASE_PATH", "/spaces/")
if not space_base_path.startswith("/"):
space_base_path = "/" + space_base_path
if not space_base_path.endswith("/"):
space_base_path += "/"
if settings.SPACE_BASE_URL:
return settings.SPACE_BASE_URL
return settings.SPACE_BASE_URL + space_base_path
else:
return base_origin + "/spaces/"
return base_origin + space_base_path
# App Redirection
if is_app:

View File

@@ -6,6 +6,8 @@ services:
- dev_env
volumes:
- redisdata:/data
ports:
- "6379:6379"
plane-mq:
image: rabbitmq:3.13.6-management-alpine
@@ -26,7 +28,15 @@ services:
restart: unless-stopped
networks:
- dev_env
command: server /export --console-address ":9090"
entrypoint: >
/bin/sh -c "
mkdir -p /export/${AWS_S3_BUCKET_NAME} &&
minio server /export --console-address ':9090' &
sleep 5 &&
mc alias set myminio http://localhost:9000 ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY} &&
mc mb myminio/${AWS_S3_BUCKET_NAME} -p || true
&& tail -f /dev/null
"
volumes:
- uploads:/export
env_file:
@@ -34,6 +44,9 @@ services:
environment:
MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID}
MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY}
ports:
- "9000:9000"
- "9090:9090"
plane-db:
image: postgres:15.7-alpine
@@ -47,63 +60,65 @@ services:
- .env
environment:
PGDATA: /var/lib/postgresql/data
ports:
- "5432:5432"
web:
build:
context: .
dockerfile: ./web/Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- ./web:/app/web
env_file:
- ./web/.env
depends_on:
- api
- worker
# web:
# build:
# context: .
# dockerfile: ./web/Dockerfile.dev
# restart: unless-stopped
# networks:
# - dev_env
# volumes:
# - ./web:/app/web
# env_file:
# - ./web/.env
# depends_on:
# - api
# - worker
space:
build:
context: .
dockerfile: ./space/Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- ./space:/app/space
depends_on:
- api
- worker
- web
# space:
# build:
# context: .
# dockerfile: ./space/Dockerfile.dev
# restart: unless-stopped
# networks:
# - dev_env
# volumes:
# - ./space:/app/space
# depends_on:
# - api
# - worker
# - web
admin:
build:
context: .
dockerfile: ./admin/Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- ./admin:/app/admin
depends_on:
- api
- worker
- web
# admin:
# build:
# context: .
# dockerfile: ./admin/Dockerfile.dev
# restart: unless-stopped
# networks:
# - dev_env
# volumes:
# - ./admin:/app/admin
# depends_on:
# - api
# - worker
# - web
live:
build:
context: .
dockerfile: ./live/Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- ./live:/app/live
depends_on:
- api
- worker
- web
# live:
# build:
# context: .
# dockerfile: ./live/Dockerfile.dev
# restart: unless-stopped
# networks:
# - dev_env
# volumes:
# - ./live:/app/live
# depends_on:
# - api
# - worker
# - web
api:
build:
@@ -122,6 +137,9 @@ services:
depends_on:
- plane-db
- plane-redis
- plane-mq
ports:
- "8000:8000"
worker:
build:
@@ -179,25 +197,25 @@ services:
- plane-db
- plane-redis
proxy:
build:
context: ./nginx
dockerfile: Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
ports:
- ${NGINX_PORT}:80
env_file:
- .env
environment:
FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880}
BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}
depends_on:
- web
- api
- space
- admin
# proxy:
# build:
# context: ./nginx
# dockerfile: Dockerfile.dev
# restart: unless-stopped
# networks:
# - dev_env
# ports:
# - ${NGINX_PORT}:80
# env_file:
# - .env
# environment:
# FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880}
# BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}
# depends_on:
# - api
# - web
# - space
# - admin
volumes:
redisdata:

View File

@@ -1,8 +1,13 @@
API_BASE_URL="http://api:8000"
API_BASE_URL="http://localhost:8000"
WEB_BASE_URL="http://localhost:3000"
LIVE_BASE_URL="http://localhost:3100"
LIVE_BASE_PATH="/live"
REDIS_URL="redis://plane-redis:6379/"
LIVE_SERVER_SECRET_KEY="secret-key"
# If you prefer not to provide a Redis URL, you can set the REDIS_HOST and REDIS_PORT environment variables instead.
REDIS_PORT=6379
REDIS_HOST=plane-redis
REDIS_HOST=localhost
REDIS_URL="redis://localhost:6379/"

View File

@@ -17,15 +17,15 @@
"lint:errors": "eslint src --ext .ts,.tsx --quiet"
},
"dependencies": {
"reflect-metadata": "^0.2.2",
"express": "^4.21.2"
"express": "^4.21.2",
"reflect-metadata": "^0.2.2"
},
"devDependencies": {
"@plane/eslint-config": "*",
"@types/express": "^4.17.21",
"@types/reflect-metadata": "^0.1.0",
"@plane/typescript-config": "*",
"@types/express": "^4.17.21",
"@types/node": "^20.14.9",
"@types/reflect-metadata": "^0.1.0",
"@types/ws": "^8.5.10",
"tsup": "8.4.0",
"typescript": "^5.3.3"

View File

@@ -74,6 +74,11 @@ else
success=false
fi
# Activate Yarn (version set in package.json)
corepack enable yarn || success=false
# Install Node dependencies
yarn install || success=false
# Summary
echo -e "\n${YELLOW}Setup status:${NC}"
if [ "$success" = true ]; then

View File

@@ -1,3 +1,12 @@
NEXT_PUBLIC_API_BASE_URL=""
NEXT_PUBLIC_WEB_BASE_URL=""
NEXT_PUBLIC_API_BASE_URL="http://localhost:8000"
NEXT_PUBLIC_WEB_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_ADMIN_BASE_URL="http://localhost:3001"
NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
NEXT_PUBLIC_SPACE_BASE_URL="http://localhost:3002"
NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
NEXT_PUBLIC_LIVE_BASE_URL="http://localhost:3100"
NEXT_PUBLIC_LIVE_BASE_PATH="/live"

View File

@@ -22,9 +22,9 @@
"@plane/constants": "*",
"@plane/editor": "*",
"@plane/i18n": "*",
"@plane/services": "*",
"@plane/types": "*",
"@plane/ui": "*",
"@plane/services": "*",
"axios": "^1.8.3",
"clsx": "^2.0.0",
"date-fns": "^4.1.0",

View File

@@ -1,10 +1,12 @@
NEXT_PUBLIC_API_BASE_URL=""
NEXT_PUBLIC_API_BASE_URL="http://localhost:8000"
NEXT_PUBLIC_ADMIN_BASE_URL=""
NEXT_PUBLIC_WEB_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_ADMIN_BASE_URL="http://localhost:3001"
NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
NEXT_PUBLIC_SPACE_BASE_URL=""
NEXT_PUBLIC_SPACE_BASE_URL="http://localhost:3002"
NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
NEXT_PUBLIC_LIVE_BASE_URL=""
NEXT_PUBLIC_LIVE_BASE_URL="http://localhost:3100"
NEXT_PUBLIC_LIVE_BASE_PATH="/live"