From 805cfed1a3e3b5afbecfbc4ce97602974856384e Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 3 Jul 2025 18:42:14 +0530 Subject: [PATCH] refactor: update paths and structure for server services in Docker and documentation (#7333) - Changed references from 'apiserver' to 'apps/server' in Docker configurations and environment setup. - Updated contributing documentation to reflect the new service structure. - Adjusted setup script to accommodate the new directory layout. - Removed obsolete files related to the previous structure. --- .github/workflows/build-test-pull-request.yml | 10 +-- CONTRIBUTING.md | 87 +++++++++++-------- ENV_SETUP.md | 22 ++--- aio/Dockerfile-app | 12 +-- apps/server/Procfile | 3 - apps/server/runtime.txt | 1 - deploy/selfhost/build.yml | 2 +- docker-compose-local.yml | 24 ++--- docker-compose.yml | 16 ++-- heroku.yml | 3 - setup.sh | 19 ++-- 11 files changed, 105 insertions(+), 94 deletions(-) delete mode 100644 apps/server/Procfile delete mode 100644 apps/server/runtime.txt delete mode 100644 heroku.yml diff --git a/.github/workflows/build-test-pull-request.yml b/.github/workflows/build-test-pull-request.yml index 227425c8f1..acbd9d26eb 100644 --- a/.github/workflows/build-test-pull-request.yml +++ b/.github/workflows/build-test-pull-request.yml @@ -6,7 +6,7 @@ on: types: ["opened", "synchronize", "ready_for_review"] jobs: - lint-apiserver: + lint-server: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: @@ -17,10 +17,10 @@ jobs: python-version: "3.x" # Specify the Python version you need - name: Install Pylint run: python -m pip install ruff - - name: Install Apiserver Dependencies - run: cd apiserver && pip install -r requirements.txt - - name: Lint apiserver - run: ruff check --fix apiserver + - name: Install Server Dependencies + run: cd apps/server && pip install -r requirements.txt + - name: Lint apps/server + run: ruff check --fix apps/server lint-admin: if: github.event.pull_request.draft == false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a15675208..01a4ff5ad5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,6 +25,7 @@ When opening a new issue, please use a clear and concise title that follows this - For documentation: `πŸ“˜ Docs: [short description]` **Examples:** + - `πŸ› Bug: API token expiry time not saving correctly` - `πŸ“˜ Docs: Clarify RAM requirement for local setup` - `πŸš€ Feature: Allow custom time selection for token expiration` @@ -47,7 +48,7 @@ This helps us triage and manage issues more efficiently. The project is a monorepo, with backend api and frontend in a single repo. -The backend is a django project which is kept inside apiserver +The backend is a django project which is kept inside apps/server 1. Clone the repo @@ -105,11 +106,13 @@ To ensure consistency throughout the source code, please keep these rules in min - **Improve documentation** - fix incomplete or missing [docs](https://docs.plane.so/), bad wording, examples or explanations. ## Contributing to language support + This guide is designed to help contributors understand how to add or update translations in the application. ### Understanding translation structure #### File organization + Translations are organized by language in the locales directory. Each language has its own folder containing JSON files for translations. Here's how it looks: ``` @@ -122,7 +125,9 @@ packages/i18n/src/locales/ └── [language]/ └── translations.json ``` + #### Nested structure + To keep translations organized, we use a nested structure for keys. This makes it easier to manage and locate specific translations. For example: ```json @@ -137,32 +142,37 @@ To keep translations organized, we use a nested structure for keys. This makes i ``` ### Translation formatting guide + We use [IntlMessageFormat](https://formatjs.github.io/docs/intl-messageformat/) to handle dynamic content, such as variables and pluralization. Here's how to format your translations: #### Examples + - **Simple variables** - ```json - { + + ```json + { "greeting": "Hello, {name}!" - } - ``` + } + ``` - **Pluralization** - ```json - { + ```json + { "items": "{count, plural, one {Work item} other {Work items}}" - } - ``` + } + ``` ### Contributing guidelines #### Updating existing translations + 1. Locate the key in `locales//translations.json`. 2. Update the value while ensuring the key structure remains intact. 3. Preserve any existing ICU formats (e.g., variables, pluralization). #### Adding new translation keys + 1. When introducing a new key, ensure it is added to **all** language files, even if translations are not immediately available. Use English as a placeholder if needed. 2. Keep the nesting structure consistent across all languages. @@ -170,48 +180,50 @@ We use [IntlMessageFormat](https://formatjs.github.io/docs/intl-messageformat/) 3. If the new key requires dynamic content (e.g., variables or pluralization), ensure the ICU format is applied uniformly across all languages. ### Adding new languages + Adding a new language involves several steps to ensure it integrates seamlessly with the project. Follow these instructions carefully: -1. **Update type definitions** -Add the new language to the TLanguage type in the language definitions file: +1. **Update type definitions** + Add the new language to the TLanguage type in the language definitions file: - ```typescript - // types/language.ts - export type TLanguage = "en" | "fr" | "your-lang"; - ``` + ```typescript + // types/language.ts + export type TLanguage = "en" | "fr" | "your-lang"; + ``` -2. **Add language configuration** -Include the new language in the list of supported languages: +2. **Add language configuration** + Include the new language in the list of supported languages: - ```typescript - // constants/language.ts - export const SUPPORTED_LANGUAGES: ILanguageOption[] = [ - { label: "English", value: "en" }, - { label: "Your Language", value: "your-lang" } - ]; - ``` + ```typescript + // constants/language.ts + export const SUPPORTED_LANGUAGES: ILanguageOption[] = [ + { label: "English", value: "en" }, + { label: "Your Language", value: "your-lang" } + ]; + ``` -3. **Create translation files** - 1. Create a new folder for your language under locales (e.g., `locales/your-lang/`). +3. **Create translation files** + 1. Create a new folder for your language under locales (e.g., `locales/your-lang/`). 2. Add a `translations.json` file inside the folder. 3. Copy the structure from an existing translation file and translate all keys. -4. **Update import logic** -Modify the language import logic to include your new language: +4. **Update import logic** + Modify the language import logic to include your new language: - ```typescript - private importLanguageFile(language: TLanguage): Promise { - switch (language) { - case "your-lang": - return import("../locales/your-lang/translations.json"); - // ... - } - } - ``` + ```typescript + private importLanguageFile(language: TLanguage): Promise { + switch (language) { + case "your-lang": + return import("../locales/your-lang/translations.json"); + // ... + } + } + ``` ### Quality checklist + Before submitting your contribution, please ensure the following: - All translation keys exist in every language file. @@ -222,6 +234,7 @@ Before submitting your contribution, please ensure the following: - There are no missing or untranslated keys. #### Pro tips + - When in doubt, refer to the English translations for context. - Verify pluralization works with different numbers. - Ensure dynamic values (e.g., `{name}`) are correctly interpolated. diff --git a/ENV_SETUP.md b/ENV_SETUP.md index 775d6a55f4..54e0415a5f 100644 --- a/ENV_SETUP.md +++ b/ENV_SETUP.md @@ -36,7 +36,7 @@ USE_MINIO=1 NGINX_PORT=80 ``` -## {PROJECT_FOLDER}/apiserver/.env +## {PROJECT_FOLDER}/apps/server/.env ``` # Backend @@ -63,8 +63,6 @@ AWS_S3_ENDPOINT_URL="http://plane-minio:9000" AWS_S3_BUCKET_NAME="uploads" # Maximum file upload limit FILE_SIZE_LIMIT=5242880 -# Settings related to Docker -DOCKERIZED=1 # deprecated # set to 1 If using the pre-configured minio setup USE_MINIO=1 # Nginx Configuration @@ -78,11 +76,15 @@ ADMIN_BASE_URL= SPACE_BASE_URL= APP_BASE_URL= SECRET_KEY="gxoytl7dmnc1y37zahah820z5iq3iozu38cnfjtu3yaau9cd9z" +# RabbitMQ Settings +RABBITMQ_HOST="plane-mq" +RABBITMQ_PORT="5672" +RABBITMQ_USER="plane" +RABBITMQ_PASSWORD="plane" +RABBITMQ_VHOST="plane" +AMQP_URL="" +# Authentication Settings +ENABLE_SIGNUP=1 +ENABLE_EMAIL_PASSWORD=1 +ENABLE_MAGIC_LINK_LOGIN=0 ``` - -## Updates​ - -- The naming convention for containers and images has been updated. -- The plane-worker image will no longer be maintained, as it has been merged with plane-backend. -- The Tiptap pro-extension dependency has been removed, eliminating the need for Tiptap API keys. -- The image name for Plane deployment has been changed to plane-space. diff --git a/aio/Dockerfile-app b/aio/Dockerfile-app index 7ffe3f803b..b209ce70e4 100644 --- a/aio/Dockerfile-app +++ b/aio/Dockerfile-app @@ -70,18 +70,18 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1 -COPY apiserver/requirements.txt ./api/ -COPY apiserver/requirements ./api/requirements +COPY apps/server/requirements.txt ./api/ +COPY apps/server/requirements ./api/requirements RUN pip install -r ./api/requirements.txt --compile --no-cache-dir # Add in Django deps and generate Django's static files -COPY apiserver/manage.py ./api/manage.py -COPY apiserver/plane ./api/plane/ -COPY apiserver/templates ./api/templates/ +COPY apps/server/manage.py ./api/manage.py +COPY apps/server/plane ./api/plane/ +COPY apps/server/templates ./api/templates/ COPY package.json ./api/package.json -COPY apiserver/bin ./api/bin/ +COPY apps/server/bin ./api/bin/ RUN chmod +x ./api/bin/* RUN chmod -R 777 ./api/ diff --git a/apps/server/Procfile b/apps/server/Procfile deleted file mode 100644 index 63736e8e8a..0000000000 --- a/apps/server/Procfile +++ /dev/null @@ -1,3 +0,0 @@ -web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker plane.asgi:application --bind 0.0.0.0:$PORT --max-requests 10000 --max-requests-jitter 1000 --access-logfile - -worker: celery -A plane worker -l info -beat: celery -A plane beat -l INFO \ No newline at end of file diff --git a/apps/server/runtime.txt b/apps/server/runtime.txt deleted file mode 100644 index 4937ae149a..0000000000 --- a/apps/server/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.12.6 \ No newline at end of file diff --git a/deploy/selfhost/build.yml b/deploy/selfhost/build.yml index b65d297e9f..aa5306fb46 100644 --- a/deploy/selfhost/build.yml +++ b/deploy/selfhost/build.yml @@ -20,7 +20,7 @@ services: api: image: ${DOCKERHUB_USER:-local}/plane-backend:${APP_RELEASE:-latest} build: - context: ./apiserver + context: ./apps/server dockerfile: ./Dockerfile.api proxy: diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 86457615a9..257780143a 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -122,7 +122,7 @@ services: api: build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.dev args: DOCKER_BUILDKIT: 1 @@ -130,10 +130,10 @@ services: networks: - dev_env volumes: - - ./apiserver:/code + - ./apps/server:/code command: ./bin/docker-entrypoint-api-local.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - plane-db - plane-redis @@ -143,7 +143,7 @@ services: worker: build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.dev args: DOCKER_BUILDKIT: 1 @@ -151,10 +151,10 @@ services: networks: - dev_env volumes: - - ./apiserver:/code + - ./apps/server:/code command: ./bin/docker-entrypoint-worker.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - api - plane-db @@ -162,7 +162,7 @@ services: beat-worker: build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.dev args: DOCKER_BUILDKIT: 1 @@ -170,10 +170,10 @@ services: networks: - dev_env volumes: - - ./apiserver:/code + - ./apps/server:/code command: ./bin/docker-entrypoint-beat.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - api - plane-db @@ -181,7 +181,7 @@ services: migrator: build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.dev args: DOCKER_BUILDKIT: 1 @@ -189,10 +189,10 @@ services: networks: - dev_env volumes: - - ./apiserver:/code + - ./apps/server:/code command: ./bin/docker-entrypoint-migrator.sh --settings=plane.settings.local env_file: - - ./apiserver/.env + - .env depends_on: - plane-db - plane-redis diff --git a/docker-compose.yml b/docker-compose.yml index 861fa9dd89..184b514c10 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,14 +40,14 @@ services: api: container_name: api build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.api args: DOCKER_BUILDKIT: 1 restart: always command: ./bin/docker-entrypoint-api.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - plane-db - plane-redis @@ -55,14 +55,14 @@ services: worker: container_name: bgworker build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.api args: DOCKER_BUILDKIT: 1 restart: always command: ./bin/docker-entrypoint-worker.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - api - plane-db @@ -71,14 +71,14 @@ services: beat-worker: container_name: beatworker build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.api args: DOCKER_BUILDKIT: 1 restart: always command: ./bin/docker-entrypoint-beat.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - api - plane-db @@ -87,14 +87,14 @@ services: migrator: container_name: plane-migrator build: - context: ./apiserver + context: ./apps/server dockerfile: Dockerfile.api args: DOCKER_BUILDKIT: 1 restart: no command: ./bin/docker-entrypoint-migrator.sh env_file: - - ./apiserver/.env + - ./apps/server/.env depends_on: - plane-db - plane-redis diff --git a/heroku.yml b/heroku.yml deleted file mode 100644 index e9d2ac0337..0000000000 --- a/heroku.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - docker: - web: deploy/heroku/Dockerfile \ No newline at end of file diff --git a/setup.sh b/setup.sh index c19a29abf9..5d87c84467 100755 --- a/setup.sh +++ b/setup.sh @@ -44,20 +44,23 @@ export LC_CTYPE=C echo -e "${YELLOW}Setting up environment files...${NC}" # Copy all environment example files -services=("" "web" "apiserver" "space" "admin" "live") +services=("" "web" "server" "space" "admin" "live") success=true for service in "${services[@]}"; do - prefix="./" - if [ "$service" != "" ]; then - prefix="./$service/" + if [ "$service" == "" ]; then + # Handle root .env file + prefix="./" + else + # Handle service .env files in apps folder + prefix="./apps/$service/" fi copy_env_file "${prefix}.env.example" "${prefix}.env" || success=false done # Generate SECRET_KEY for Django -if [ -f "./apiserver/.env" ]; then +if [ -f "./apps/server/.env" ]; then echo -e "\n${YELLOW}Generating Django SECRET_KEY...${NC}" SECRET_KEY=$(tr -dc 'a-z0-9' < /dev/urandom | head -c50) @@ -66,11 +69,11 @@ if [ -f "./apiserver/.env" ]; then echo -e "${RED}Ensure 'tr' and 'head' commands are available on your system.${NC}" success=false else - echo -e "SECRET_KEY=\"$SECRET_KEY\"" >> ./apiserver/.env - echo -e "${GREEN}βœ“${NC} Added SECRET_KEY to apiserver/.env" + echo -e "SECRET_KEY=\"$SECRET_KEY\"" >> ./apps/server/.env + echo -e "${GREEN}βœ“${NC} Added SECRET_KEY to apps/server/.env" fi else - echo -e "${RED}βœ—${NC} apiserver/.env not found. SECRET_KEY not added." + echo -e "${RED}βœ—${NC} apps/server/.env not found. SECRET_KEY not added." success=false fi