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

Add production support and update environment configurations #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yunho7687
Copy link
Member

Change Summary

  • Enhance README with production mode instructions
  • Modify entrypoint scripts to handle production environment
  • Update Dockerfile to create access logs directory
  • Change Django settings module path in ASGI and WSGI files
  • Adjust static file paths in Django settings
  • Introduce docker-compose configuration for production
  • Add script to run development servers for client and server

Change Form

NA

Other Information

Please review the code relating to the WSGI part and the files' changes in docker/server/

- Enhance README with production mode instructions
- Modify entrypoint scripts to handle production environment
- Update Dockerfile to create access logs directory
- Change Django settings module path in ASGI and WSGI files
- Adjust static file paths in Django settings
- Introduce docker-compose configuration for production
- Add script to run development servers for client and server
@yunho7687 yunho7687 added backend Task must have a back end issue bug Something isn't working labels Nov 29, 2024
@yunho7687 yunho7687 linked an issue Nov 29, 2024 that may be closed by this pull request
@@ -39,9 +39,9 @@ fi
# Run Django/Gunicorn
# ===================
if [ "${APP_ENV^^}" = "PRODUCTION" ]; then

su -
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to run root?

@@ -17,5 +17,7 @@ RUN poetry install

COPY ./server ./

RUN mkdir -p /var/log/accesslogs && chmod -R 777 /var/log/accesslogs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the problem with the perms?

Comment on lines +26 to +39
client:
container_name: wajo-client
build:
context: .
dockerfile: ./docker/client/Dockerfile
restart: unless-stopped
env_file: ./client/.env
ports:
- 3000:3000
volumes:
- ${LOCAL_WORKSPACE_FOLDER:-.}/client:/app
- ignore:/app/node_modules
volumes:
ignore:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're planning to host the client in the vps too?

Comment on lines +15 to +25
server:
container_name: wajo-server
build:
context: .
dockerfile: ./docker/server/Dockerfile
restart: unless-stopped
env_file: ./server/.env
ports:
- 8000:8000
volumes:
- ${LOCAL_WORKSPACE_FOLDER:-.}/server:/app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not going to work... you're going to need to have a nginx setup

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nginx needs to be infront to serve traffic, and will need to serve the static files as well

@frinzekt
Copy link
Member

i don't know where you modelled this change, but i expect it to be similar to this https://github.com/codersforcauses/csf/blob/main/docker-compose-prod.yml

container_name: wajo-server
build:
context: .
dockerfile: ./docker/server/Dockerfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no... DO NOT build the docker image in the VPS...

Get it to pull from a docker image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason why you don't do that is:

  1. you want replicability by getting what worked in the artifact
  2. building docker image requires lots of resource that your vps server may not have more
  3. you'll want something like watchtower to do continuous deployment (which it relies on it coming from artifact store such as docker registry)

@frinzekt
Copy link
Member

In production , you'll also need to push to docker registry https://github.com/codersforcauses/csf/blob/main/.github/workflows/docker-build.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Task must have a back end issue bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Production mode build failed for Django WSGI
3 participants