Skip to content

Commit

Permalink
gitpod: update tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsnaps committed Sep 9, 2024
1 parent 88510b8 commit 8c46f5c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 13 deletions.
38 changes: 38 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- name: Setup Backend
init: |
pip install -r requirements.txt
# You might want to add a command here to generate a SECRET_KEY in .env file if necessary
python manage.py collectstatic --noinput
python manage.py makemigrations --noinput
python manage.py migrate --noinput
python manage.py test
command: |
echo "To run the backend in DEBUG mode:"
DEBUG=True python manage.py runserver
echo "To run the backend in production mode:"
echo "DEBUG=False uvicorn backend_lms.asgi:application --host 0.0.0.0 --port 8000 --workers 2"
- name: Setup Frontend
init: |
cd ui/
npm install -g pnpm
pnpm i
cp .env.example .env
pnpm test
pnpm build
command: |
echo "Frontend build complete. To start the dev server, run:"
echo "cd ui && pnpm dev"
ports:
- port: 8000
onOpen: ignore
- port: 5173
onOpen: open-preview
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,37 @@ We envision a world where students are not only academically proficient but also
- Community Engagement
- Exclusive Offers and Discounts

## Build
## Build & Testing

```bash
# Build the UI
cd ui
echo "Building UI"
cd ui/
pnpm i
cp .env.example .env
pnpm test
pnpm build
cd ..

# Generate static assets
python manage.py collectstatic

# run dev server
python manage.py collectstatic

# run prod server (WSGI)
gunicorn backend_lms.wsgi:application --bind 0.0.0.0:8000 --workers 2
# Build the backend API
echo "Building backend API ..."
pip install -r requirements.txt
cp .env.example .env
# Generate a SECRET_KEY in .env file if necessary

# run prod server (ASGI)
uvicorn backend_lms.asgi:application --host 0.0.0.0 --port 8000 --workers 2
# Generate static assets
python manage.py collectstatic --noinput
python manage.py makemigrations --noinput
python manage.py migrate --noinput
python manage.py test

# Run dev server (DEBUG mode)
echo "To run in DEBUG mode:"
echo "DEBUG=True python manage.py runserver"

# Run prod server (ASGI)
echo "To run in production mode:"
echo "DEBUG=False uvicorn backend_lms.asgi:application --host 0.0.0.0 --port 8000 --workers 2"
```
P.S. You may need to ajust `host`, `port`, `workers` (4, 8...) according to your requirements.

P.S. You may need to adjust `host`, `port`, `workers` (4, 8...) according to your requirements.
5 changes: 5 additions & 0 deletions ui/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VITE_APP_TITLE=TalentCampus
# default locale
VITE_LOCALE="en"
VITE_HOSTNAME="http://127.0.0.1:8000"
VITE_USE_CSRF_TOKEN=false
3 changes: 3 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Environments
.env

0 comments on commit 8c46f5c

Please sign in to comment.