Skip to content
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
74 changes: 54 additions & 20 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,61 @@
# Use a custom Docker image
image:
file: .gitpod.Dockerfile
image: gitpod/workspace-full:latest

# Tasks to run when workspace starts
tasks:
- name: Install & Start Vue
- name: infrastructure
before: |
echo 'Bringing down any previously running containers'
init: |
cd frontend
npm install
cd deployment/local
docker-compose down -v
- name: postgres
init: |
cd deployment/local
echo 'Starting postgres container'
docker-compose up -d postgres
echo 'Started postgres'
- name: backend
init: |
cd deployment/local
echo 'Building backend container'
docker-compose build backend
echo 'Built backend'
command: |
cd frontend
npm run dev

gp await-port 7432
cd deployment/local
echo 'Starting backend container'
docker-compose up -d backend
echo 'Started backend'
- name: frontend
init: |
cd deployment/local
echo 'Copying .env-gitpod to .env'
cp .env-gitpod .env
eval $(gp env -e)
export VITE_API_BASE_URL=$(gp url 8300)
echo 'Building frontend container'
docker-compose build frontend
echo 'Built frontend'
command: |
gp await-port 8300
eval $(gp env -e)
export VITE_API_BASE_URL=$(gp url 8300)
cd deployment/local
echo 'Starting frontend container'
docker-compose up -d frontend
echo 'Started frontend'

# Ports to expose
ports:
- port: 5173
- name: Frontend
description: Port 4000 for the frontend
port: 4000
onOpen: open-preview

# VS Code extensions for Vue 3 + Vite
vscode:
extensions:
- octref.vetur # Vue tooling
- Vue.volar # Vue 3 IntelliSense
- esbenp.prettier-vscode
- dbaeumer.vscode-eslint
visibility: public
- name: Backend
description: Port 8300 for the backend
port: 8300
onOpen: ignore
visibility: public
- name: postgres
description: Port 7432 for the postgres
port: 7432
onOpen: ignore
6 changes: 4 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update \
curl \
libpq-dev \
postgresql-client \
dos2unix \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
Expand All @@ -30,8 +31,9 @@ RUN pip install --no-cache-dir --upgrade pip \
# Copy application code
COPY . .

# Make entrypoint script executable
RUN chmod +x docker-entrypoint.sh
# Convert entrypoint script to LF and make it executable
RUN dos2unix /app/docker-entrypoint.sh \
&& chmod +x /app/docker-entrypoint.sh

# Create non-root user for security
RUN adduser --disabled-password --gecos '' appuser \
Expand Down
4 changes: 2 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A modern FastAPI boilerplate with proper separation of concerns, PostgreSQL inte
## 📁 **Project Structure**

```
python-fastapi/
backend/
├── app/
│ ├── __init__.py
│ ├── database.py # Database configuration
Expand Down Expand Up @@ -65,7 +65,7 @@ python-fastapi/
1. **Clone the repository**
```bash
git clone <your-repo-url>
cd python-fastapi
cd backend
```

2. **Run with Docker Compose**
Expand Down
12 changes: 12 additions & 0 deletions deployment/local/.env-gitpod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Deployment environment
NODE_ENV=production

# Ports
FRONTEND_HTTP_PORT=4000


# Frontend API base
VITE_API_BASE_URL=http://localhost:3000

# Backend DATABASE_URL
DATABASE_URL=postgresql://fastapi_user:fastapi_password@postgres:5432/fastapi_db
7 changes: 1 addition & 6 deletions deployment/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
environment:
- VITE_API_BASE_URL=${VITE_API_BASE_URL:-http://localhost:3000}
ports:
- "${FRONTEND_HTTP_PORT:-8080}:80"
- "${FRONTEND_HTTP_PORT:-4000}:80"
restart: unless-stopped
backend:
build:
Expand All @@ -28,9 +28,6 @@ services:
- DATABASE_URL=${DATABASE_URL:-postgresql://fastapi_user:fastapi_password@postgres:5432/fastapi_db}
ports:
- "8300:8000"
volumes:
- .:/app
- /app/__pycache__
restart: unless-stopped
depends_on:
postgres:
Expand All @@ -52,8 +49,6 @@ services:
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
ports:
- "7432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fastapi_user -d fastapi_db"]
Expand Down
3 changes: 2 additions & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": true,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "all"
"trailingComma": "all",
"endOfLine": "auto"
}