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

fix: environment file missing for space #3105

Merged
merged 4 commits into from
Dec 14, 2023
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
29 changes: 4 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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?

Expand Down
2 changes: 1 addition & 1 deletion apiserver/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ USER captain
# Expose container port and run entry point script
EXPOSE 8000

# CMD [ "./bin/takeoff" ]
CMD [ "./bin/takeoff.local" ]

31 changes: 31 additions & 0 deletions apiserver/bin/takeoff.local
Original file line number Diff line number Diff line change
@@ -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

21 changes: 4 additions & 17 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ volumes:

services:
plane-redis:
container_name: plane-redis
image: redis:6.2.7-alpine
restart: unless-stopped
networks:
Expand All @@ -21,7 +20,6 @@ services:
- redisdata:/data

plane-minio:
container_name: plane-minio
image: minio/minio
restart: unless-stopped
networks:
Expand All @@ -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:
Expand All @@ -53,16 +50,14 @@ services:
PGDATA: /var/lib/postgresql/data

web:
container_name: web
build:
context: .
dockerfile: ./web/Dockerfile.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- .:/app
command: yarn dev --filter=web
- ./web:/app/web
env_file:
- ./web/.env
depends_on:
Expand All @@ -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
Expand All @@ -99,15 +89,14 @@ 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:
- plane-db
- plane-redis

worker:
container_name: bgworker
build:
context: ./apiserver
dockerfile: Dockerfile.dev
Expand All @@ -127,7 +116,6 @@ services:
- plane-redis

beat-worker:
container_name: beatworker
build:
context: ./apiserver
dockerfile: Dockerfile.dev
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions nginx/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion nginx/nginx-single-docker-image.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 36 additions & 0 deletions nginx/nginx.conf.dev
Original file line number Diff line number Diff line change
@@ -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/;
}
}
}
1 change: 0 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion space/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 1 addition & 0 deletions web/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Loading