Skip to content

Commit c4f28bf

Browse files
authored
Merge pull request #426 from CodeForPhilly/develop
Release: v1.1.5
2 parents 8ca20aa + ee06e75 commit c4f28bf

42 files changed

Lines changed: 685 additions & 793 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: [sahilds1] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/containers-publish.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: "Containers: Publish"
33
on:
44
release:
55
types: [published]
6+
push:
7+
branches: [develop]
68

79
permissions:
810
packages: write
@@ -12,7 +14,7 @@ jobs:
1214
name: Build and Push
1315
runs-on: ubuntu-latest
1416
steps:
15-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v4
1618

1719
- name: Login to ghcr.io Docker registry
1820
uses: docker/login-action@v3
@@ -24,7 +26,18 @@ jobs:
2426
- name: Compute Docker container image addresses
2527
run: |
2628
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}"
27-
DOCKER_TAG="${GITHUB_REF:11}"
29+
git fetch --tags --force
30+
31+
if [[ "${{ github.event_name }}" == "release" ]]; then
32+
TAG="${GITHUB_REF#refs/tags/}"
33+
DOCKER_TAG="${TAG#v}"
34+
else
35+
# Pre-release for develop
36+
BASE_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
37+
VERSION="${BASE_TAG#v}"
38+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
39+
DOCKER_TAG="${VERSION}-dev.${TIMESTAMP}"
40+
fi
2841
2942
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV
3043
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
@@ -44,10 +57,20 @@ jobs:
4457
--file Dockerfile.prod \
4558
--tag "${DOCKER_REPOSITORY}/app:latest" \
4659
--tag "${DOCKER_REPOSITORY}/app:${DOCKER_TAG}" \
60+
--build-arg VERSION="${DOCKER_TAG}" \
4761
.
4862
4963
- name: "Push Docker container image app:latest"
5064
run: docker push "${DOCKER_REPOSITORY}/app:latest"
5165

5266
- name: "Push Docker container image app:v*"
5367
run: docker push "${DOCKER_REPOSITORY}/app:${DOCKER_TAG}"
68+
69+
- name: Save Docker Tag
70+
run: echo "${DOCKER_TAG}" > docker_tag.txt
71+
72+
- name: Upload Docker Tag
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: docker-tag
76+
path: docker_tag.txt

.github/workflows/deploy-downstream.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/frontend-ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Frontend: Lint and Build"
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
pull_request:
7+
branches: [develop]
8+
9+
jobs:
10+
frontend:
11+
name: Lint and Build
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: frontend
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "18"
23+
cache: "npm"
24+
cache-dependency-path: frontend/package-lock.json
25+
26+
- name: Install dependencies
27+
run: npm ci --legacy-peer-deps
28+
29+
- name: Lint
30+
run: npm run lint
31+
continue-on-error: true
32+
33+
- name: Build
34+
run: npm run build
35+
continue-on-error: true

CLAUDE.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -278,28 +278,6 @@ docker compose exec backend python manage.py test
278278
### Frontend Tests
279279
No test framework currently configured. Consider adding Jest/Vitest for future testing.
280280

281-
## Deployment
282-
283-
### Local Kubernetes (using Devbox)
284-
```bash
285-
# Install Devbox first: https://www.jetify.com/devbox
286-
287-
# Add balancertestsite.com to /etc/hosts
288-
sudo sh -c 'echo "127.0.0.1 balancertestsite.com" >> /etc/hosts'
289-
290-
# Deploy to local k8s cluster
291-
devbox shell
292-
devbox create:cluster
293-
devbox run deploy:balancer
294-
295-
# Access at https://balancertestsite.com:30219/
296-
```
297-
298-
### Production
299-
- Manifests: `deploy/manifests/balancer/`
300-
- ConfigMap: `deploy/manifests/balancer/base/configmap.yml`
301-
- Secrets: `deploy/manifests/balancer/base/secret.template.yaml`
302-
303281
## Key Files Reference
304282

305283
- `server/balancer_backend/settings.py` - Django configuration (auth, database, CORS)

Dockerfile.prod

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ RUN npm run build
2121
# Stage 2: Build Backend
2222
FROM python:3.11.4-slim-bullseye
2323

24+
# Receive version argument from build command
25+
ARG VERSION
26+
ENV VERSION=${VERSION}
27+
2428
# Set work directory
2529
WORKDIR /usr/src/app
2630

@@ -32,9 +36,11 @@ ENV PYTHONUNBUFFERED=1
3236
RUN apt-get update && apt-get install -y netcat && rm -rf /var/lib/apt/lists/*
3337

3438
# Install Python dependencies
35-
RUN pip install --upgrade pip
39+
RUN pip install --upgrade pip --no-cache-dir
3640
COPY server/requirements.txt .
37-
RUN pip install -r requirements.txt
41+
# Install CPU-only torch to save space (avoids ~4GB of CUDA libs)
42+
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
43+
RUN pip install -r requirements.txt --no-cache-dir
3844

3945
# Copy backend application code
4046
COPY server/ .

README.md

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ The project kanban board is [on GitHub here](https://github.com/orgs/CodeForPhil
2121

2222
The Code for Philly Code of Conduct is [here](https://codeforphilly.org/pages/code_of_conduct/)
2323

24-
### Setting up a development environment
24+
### Setting up a development environment
2525

2626
Get the code using git by either forking or cloning `CodeForPhilly/balancer-main`
2727

28-
Tools used to run Balancer:
29-
1. `OpenAI API`: Ask for an API key and add it to `config/env/env.dev`
30-
2. `Anthropic API`: Ask for an API key and add it to `config/env/env.dev`
28+
1. Copy the example environment file:
29+
```bash
30+
cp config/env/dev.env.example config/env/dev.env
31+
```
32+
2. (Optional) Add your API keys to `config/env/dev.env`:
33+
- `OpenAI API`
34+
- `Anthropic API`
3135

3236
Tools used for development:
3337
1. `Docker`: Install Docker Desktop
@@ -70,40 +74,6 @@ df = pd.read_sql(query, engine)
7074
#### Django REST
7175
- The email and password are set in `server/api/management/commands/createsu.py`
7276

73-
## Local Kubernetes Deployment
74-
75-
### Prereqs
76-
77-
- Fill the configmap with the [env vars](./deploy/manifests/balancer/base/configmap.yml)
78-
- Install [Devbox](https://www.jetify.com/devbox)
79-
- Run the following script with admin privileges:
80-
81-
```bash
82-
HOSTNAME="balancertestsite.com"
83-
LOCAL_IP="127.0.0.1"
84-
85-
# Check if the correct line already exists
86-
if grep -q "^$LOCAL_IP[[:space:]]\+$HOSTNAME" /etc/hosts; then
87-
echo "Entry for $HOSTNAME with IP $LOCAL_IP already exists in /etc/hosts"
88-
else
89-
echo "Updating /etc/hosts for $HOSTNAME"
90-
sudo sed -i "/[[:space:]]$HOSTNAME/d" /etc/hosts
91-
echo "$LOCAL_IP $HOSTNAME" | sudo tee -a /etc/hosts
92-
fi
93-
```
94-
95-
### Steps to reproduce
96-
97-
Inside root dir of balancer
98-
99-
```bash
100-
devbox shell
101-
devbox create:cluster
102-
devbox run deploy:balancer
103-
```
104-
105-
The website should be available in [https://balancertestsite.com:30219/](https://balancertestsite.com:30219/)
106-
10777
## Architecture
10878

10979
The Balancer website is a Postgres, Django REST, and React project. The source code layout is:

db/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

devbox.json

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)