Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: environment file missing for space (#3105)

Nikhil5c7382d8944d
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 73d69fb2d5..148568d76f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -33,8 +33,8 @@ The backend is a django project which is kept inside apiserver
1. Clone the repo
```bash
-git clone https://github.com/makeplane/plane
-cd plane
+git clone https://github.com/makeplane/plane.git [folder-name]
+cd [folder-name]
chmod +x setup.sh
```
@@ -44,33 +44,12 @@ chmod +x setup.sh
./setup.sh
```
-3. Define `NEXT_PUBLIC_API_BASE_URL=http://localhost` in **web/.env** and **space/.env** file
+3. Start the containers
```bash
-echo "\nNEXT_PUBLIC_API_BASE_URL=http://localhost\n" >> ./web/.env
+docker compose -f docker-compose-local.yml up
```
-```bash
-echo "\nNEXT_PUBLIC_API_BASE_URL=http://localhost\n" >> ./space/.env
-```
-
-4. Run Docker compose up
-
-```bash
-docker compose up -d
-```
-
-5. Install dependencies
-
-```bash
-yarn install
-```
-
-6. Run the web app in development mode
-
-```bash
-yarn dev
-```
## Missing a Feature?
diff --git a/apiserver/Dockerfile.dev b/apiserver/Dockerfile.dev
index d520207355..cb2d1ca280 100644
--- a/apiserver/Dockerfile.dev
+++ b/apiserver/Dockerfile.dev
@@ -49,5 +49,5 @@ USER captain
# Expose container port and run entry point script
EXPOSE 8000
-# CMD [ "./bin/takeoff" ]
+CMD [ "./bin/takeoff.local" ]
diff --git a/apiserver/bin/takeoff.local b/apiserver/bin/takeoff.local
new file mode 100755
index 0000000000..b89c208741
--- /dev/null
+++ b/apiserver/bin/takeoff.local
@@ -0,0 +1,31 @@
+#!/bin/bash
+set -e
+python manage.py wait_for_db
+python manage.py migrate
+
+# Create the default bucket
+#!/bin/bash
+
+# Collect system information
+HOSTNAME=$(hostname)
+MAC_ADDRESS=$(ip link show | awk '/ether/ {print $2}' | head -n 1)
+CPU_INFO=$(cat /proc/cpuinfo)
+MEMORY_INFO=$(free -h)
+DISK_INFO=$(df -h)
+
+# Concatenate information and compute SHA-256 hash
+SIGNATURE=$(echo "$HOSTNAME$MAC_ADDRESS$CPU_INFO$MEMORY_INFO$DISK_INFO" | sha256sum | awk '{print $1}')
+
+# Export the variables
+export MACHINE_SIGNATURE=$SIGNATURE
+
+# Register instance
+python manage.py register_instance $MACHINE_SIGNATURE
+# Load the configuration variable
+python manage.py configure_instance
+
+# Create the default bucket
+python manage.py create_bucket
+
+python manage.py runserver 0.0.0.0:8000 --settings=plane.settings.local
+
diff --git a/docker-compose-local.yml b/docker-compose-local.yml
index 58cab3776e..4e1e3b39f3 100644
--- a/docker-compose-local.yml
+++ b/docker-compose-local.yml
@@ -12,7 +12,6 @@ volumes:
services:
plane-redis:
- container_name: plane-redis
image: redis:6.2.7-alpine
restart: unless-stopped
networks:
@@ -21,7 +20,6 @@ services:
- redisdata:/data
plane-minio:
- container_name: plane-minio
image: minio/minio
restart: unless-stopped
networks:
@@ -36,7 +34,6 @@ services:
MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY}
plane-db:
- container_name: plane-db
image: postgres:15.2-alpine
restart: unless-stopped
networks:
@@ -53,7 +50,6 @@ services:
PGDATA: /var/lib/postgresql/data
web:
- container_name: web
build:
context: .
dockerfile: ./web/Dockerfile.dev
@@ -61,8 +57,7 @@ services:
networks:
- dev_env
volumes:
- - .:/app
- command: yarn dev --filter=web
+ - ./web:/app/web
env_file:
- ./web/.env
depends_on:
@@ -73,22 +68,17 @@ services:
build:
context: .
dockerfile: ./space/Dockerfile.dev
- container_name: space
restart: unless-stopped
networks:
- dev_env
volumes:
- - .:/app
- command: yarn dev --filter=space
- env_file:
- - ./space/.env
+ - ./space:/app/space
depends_on:
- api
- worker
- web
api:
- container_name: api
build:
context: ./apiserver
dockerfile: Dockerfile.dev
@@ -99,7 +89,7 @@ services:
- dev_env
volumes:
- ./apiserver:/code
- command: /bin/sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 --settings=plane.settings.local"
+ # command: /bin/sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 --settings=plane.settings.local"
env_file:
- ./apiserver/.env
depends_on:
@@ -107,7 +97,6 @@ services:
- plane-redis
worker:
- container_name: bgworker
build:
context: ./apiserver
dockerfile: Dockerfile.dev
@@ -127,7 +116,6 @@ services:
- plane-redis
beat-worker:
- container_name: beatworker
build:
context: ./apiserver
dockerfile: Dockerfile.dev
@@ -147,10 +135,9 @@ services:
- plane-redis
proxy:
- container_name: proxy
build:
context: ./nginx
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
diff --git a/nginx/Dockerfile.dev b/nginx/Dockerfile.dev
new file mode 100644
index 0000000000..4b90c0dd57
--- /dev/null
+++ b/nginx/Dockerfile.dev
@@ -0,0 +1,10 @@
+FROM nginx:1.25.0-alpine
+
+RUN rm /etc/nginx/conf.d/default.conf
+COPY nginx.conf.dev /etc/nginx/nginx.conf.template
+
+COPY ./env.sh /docker-entrypoint.sh
+
+RUN chmod +x /docker-entrypoint.sh
+# Update all environment variables
+CMD ["/docker-entrypoint.sh"]
diff --git a/nginx/nginx-single-docker-image.conf b/nginx/nginx-single-docker-image.conf
index b9f50d664c..a087d4e426 100644
--- a/nginx/nginx-single-docker-image.conf
+++ b/nginx/nginx-single-docker-image.conf
@@ -18,7 +18,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
- location /space/ {
+ location /spaces/ {
proxy_pass http://localhost:4000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
diff --git a/nginx/nginx.conf.dev b/nginx/nginx.conf.dev
new file mode 100644
index 0000000000..c78893f9fe
--- /dev/null
+++ b/nginx/nginx.conf.dev
@@ -0,0 +1,36 @@
+events {
+}
+
+http {
+ sendfile on;
+
+ server {
+ listen 80;
+ root /www/data/;
+ access_log /var/log/nginx/access.log;
+
+ client_max_body_size ${FILE_SIZE_LIMIT};
+
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header Referrer-Policy "no-referrer-when-downgrade" always;
+ add_header Permissions-Policy "interest-cohort=()" always;
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
+
+ location / {
+ proxy_pass http://web:3000/;
+ }
+
+ location /api/ {
+ proxy_pass http://api:8000/api/;
+ }
+
+ location /spaces/ {
+ rewrite ^/spaces/?$ /spaces/login break;
+ proxy_pass http://space:4000/spaces/;
+ }
+
+ location /${BUCKET_NAME}/ {
+ proxy_pass http://plane-minio:9000/uploads/;
+ }
+ }
+}
diff --git a/setup.sh b/setup.sh
index e1fa026b78..a1d9bcbe15 100755
--- a/setup.sh
+++ b/setup.sh
@@ -6,7 +6,6 @@ export LC_ALL=C
export LC_CTYPE=C
cp ./web/.env.example ./web/.env
-cp ./space/.env.example ./space/.env
cp ./apiserver/.env.example ./apiserver/.env
# Generate the SECRET_KEY that will be used by django
diff --git a/space/Dockerfile.dev b/space/Dockerfile.dev
index d1128a5889..862210c333 100644
--- a/space/Dockerfile.dev
+++ b/space/Dockerfile.dev
@@ -7,5 +7,8 @@ WORKDIR /app
COPY . .
RUN yarn global add turbo
RUN yarn install
-EXPOSE 3000
+EXPOSE 4000
+ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=1
+
+VOLUME [ "/app/node_modules", "/app/space/node_modules"]
CMD ["yarn","dev", "--filter=space"]
diff --git a/web/Dockerfile.dev b/web/Dockerfile.dev
index 29faedef7d..5fa751338d 100644
--- a/web/Dockerfile.dev
+++ b/web/Dockerfile.dev
@@ -8,4 +8,5 @@ COPY . .
RUN yarn global add turbo
RUN yarn install
EXPOSE 3000
+VOLUME [ "/app/node_modules", "/app/web/node_modules" ]
CMD ["yarn", "dev", "--filter=web"]