Migrate from GitHub to Gitea with CI/CD
Some checks failed
Deploy / deploy (push) Failing after 6m11s
Some checks failed
Deploy / deploy (push) Failing after 6m11s
- Add Gitea Actions workflow for automated frontend and API deployment - Update all raw download URLs from GitHub to Gitea - Remove deprecated Amplify config and GitHub-specific Terraform variables - Clean up commented-out Amplify resources from Terraform - Update documentation to reflect new repository and CI/CD setup
This commit is contained in:
117
.gitea/workflows/deploy.yml
Normal file
117
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Detect changes
|
||||||
|
id: changes
|
||||||
|
run: |
|
||||||
|
FRONTEND_CHANGED=false
|
||||||
|
API_CHANGED=false
|
||||||
|
|
||||||
|
if git diff --name-only HEAD~1 HEAD | grep -qvE '^api/'; then
|
||||||
|
FRONTEND_CHANGED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git diff --name-only HEAD~1 HEAD | grep -qE '^api/'; then
|
||||||
|
API_CHANGED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "frontend=$FRONTEND_CHANGED" >> $GITHUB_OUTPUT
|
||||||
|
echo "api=$API_CHANGED" >> $GITHUB_OUTPUT
|
||||||
|
echo "Frontend changed: $FRONTEND_CHANGED"
|
||||||
|
echo "API changed: $API_CHANGED"
|
||||||
|
|
||||||
|
# ── Frontend Deploy ──────────────────────────────────────────────
|
||||||
|
- name: Setup Node.js
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Security check
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: npm run security:check
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: npm test -- --passWithNoTests
|
||||||
|
|
||||||
|
- name: Build Next.js
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: npm run build
|
||||||
|
env:
|
||||||
|
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
|
||||||
|
NEXT_PUBLIC_MATOMO_URL: ${{ vars.NEXT_PUBLIC_MATOMO_URL }}
|
||||||
|
NEXT_PUBLIC_MATOMO_SITE_ID: ${{ vars.NEXT_PUBLIC_MATOMO_SITE_ID }}
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
if: steps.changes.outputs.frontend == 'true' || steps.changes.outputs.api == 'true'
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: ${{ vars.AWS_REGION }}
|
||||||
|
|
||||||
|
- name: Deploy to S3
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: |
|
||||||
|
S3_BUCKET="${{ vars.S3_BUCKET }}"
|
||||||
|
|
||||||
|
# Upload HTML files with no-cache
|
||||||
|
aws s3 sync out/ s3://$S3_BUCKET/ \
|
||||||
|
--delete \
|
||||||
|
--exclude "*" \
|
||||||
|
--include "*.html" \
|
||||||
|
--cache-control "public, max-age=0, must-revalidate" \
|
||||||
|
--content-type "text/html"
|
||||||
|
|
||||||
|
# Upload _next static assets with immutable 1-year cache
|
||||||
|
aws s3 sync out/_next/ s3://$S3_BUCKET/_next/ \
|
||||||
|
--cache-control "public, max-age=31536000, immutable"
|
||||||
|
|
||||||
|
# Upload other assets with 1-day cache
|
||||||
|
aws s3 sync out/ s3://$S3_BUCKET/ \
|
||||||
|
--exclude "*.html" \
|
||||||
|
--exclude "_next/*" \
|
||||||
|
--cache-control "public, max-age=86400"
|
||||||
|
|
||||||
|
- name: Invalidate CloudFront
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
run: |
|
||||||
|
aws cloudfront create-invalidation \
|
||||||
|
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
|
||||||
|
--paths "/*"
|
||||||
|
|
||||||
|
# ── API Deploy ───────────────────────────────────────────────────
|
||||||
|
- name: Deploy API via SSM
|
||||||
|
if: steps.changes.outputs.api == 'true'
|
||||||
|
run: |
|
||||||
|
aws ssm send-command \
|
||||||
|
--region ${{ vars.AWS_REGION }} \
|
||||||
|
--instance-ids "${{ vars.INSTANCE_ID }}" \
|
||||||
|
--document-name "AWS-RunShellScript" \
|
||||||
|
--parameters 'commands=[
|
||||||
|
"cd /home/ubuntu/filamenteka-api",
|
||||||
|
"cp server.js server.js.backup",
|
||||||
|
"curl -o server.js https://git.demirix.dev/dax/Filamenteka/raw/branch/main/api/server.js",
|
||||||
|
"sudo systemctl restart node-api",
|
||||||
|
"sudo systemctl status node-api"
|
||||||
|
]' \
|
||||||
|
--output json
|
||||||
|
echo "API deploy command sent via SSM"
|
||||||
63
CLAUDE.md
63
CLAUDE.md
@@ -7,7 +7,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||||||
Filamenteka is a 3D printing filament inventory management system for tracking Bambu Lab filaments. It consists of:
|
Filamenteka is a 3D printing filament inventory management system for tracking Bambu Lab filaments. It consists of:
|
||||||
- **Frontend**: Next.js app with React, TypeScript, and Tailwind CSS (static export)
|
- **Frontend**: Next.js app with React, TypeScript, and Tailwind CSS (static export)
|
||||||
- **Backend**: Node.js API server with PostgreSQL database
|
- **Backend**: Node.js API server with PostgreSQL database
|
||||||
- **Infrastructure**: AWS (Amplify for frontend, EC2 for API, RDS for database)
|
- **Infrastructure**: AWS (CloudFront + S3 for frontend, EC2 for API, RDS for database)
|
||||||
|
|
||||||
## Critical Rules
|
## Critical Rules
|
||||||
|
|
||||||
@@ -20,13 +20,17 @@ Filamenteka is a 3D printing filament inventory management system for tracking B
|
|||||||
## Common Commands
|
## Common Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Development
|
# Frontend Development
|
||||||
npm run dev # Start Next.js development server (port 3000)
|
npm run dev # Start Next.js development server (port 3000)
|
||||||
npm run build # Build static export to /out directory
|
npm run build # Build static export to /out directory
|
||||||
npm run lint # Run ESLint
|
npm run lint # Run ESLint
|
||||||
|
npm run typecheck # Run TypeScript type checking
|
||||||
npm test # Run Jest tests
|
npm test # Run Jest tests
|
||||||
npm run test:watch # Run Jest in watch mode
|
npm run test:watch # Run Jest in watch mode
|
||||||
|
|
||||||
|
# API Development (in /api directory)
|
||||||
|
cd api && npm run dev # Start API server with nodemon (port 4000)
|
||||||
|
|
||||||
# Security & Quality
|
# Security & Quality
|
||||||
npm run security:check # Check for credential leaks (scripts/security/security-check.js)
|
npm run security:check # Check for credential leaks (scripts/security/security-check.js)
|
||||||
npm run test:build # Test if build succeeds without creating files
|
npm run test:build # Test if build succeeds without creating files
|
||||||
@@ -67,10 +71,15 @@ scripts/deploy-frontend.sh # Manual frontend deployment helper
|
|||||||
### Key Components
|
### Key Components
|
||||||
- `FilamentTableV2` - Main inventory display with sorting/filtering
|
- `FilamentTableV2` - Main inventory display with sorting/filtering
|
||||||
- `SaleManager` - Bulk sale management interface
|
- `SaleManager` - Bulk sale management interface
|
||||||
|
- `BulkFilamentPriceEditor` - Bulk price modification interface
|
||||||
- `ColorCell` - Smart color rendering with gradient support
|
- `ColorCell` - Smart color rendering with gradient support
|
||||||
- `EnhancedFilters` - Advanced filtering system
|
- `EnhancedFilters` - Advanced filtering system
|
||||||
- `ColorRequestForm` - Customer color request form
|
- `ColorRequestForm` - Customer color request form
|
||||||
- `ColorRequestModal` - Modal for color requests
|
- `ColorRequestModal` - Modal for color requests
|
||||||
|
- `SaleCountdown` - Sale timer display
|
||||||
|
- `MatomoAnalytics` - Analytics tracking
|
||||||
|
- `BackToTop` - Scroll-to-top button
|
||||||
|
- `MaterialBadge`, `ColorSwatch`, `InventoryBadge` - Display components
|
||||||
|
|
||||||
### Data Models
|
### Data Models
|
||||||
|
|
||||||
@@ -117,11 +126,15 @@ color_requests: {
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
### Frontend (AWS Amplify)
|
### Frontend (AWS CloudFront + S3)
|
||||||
- Automatic deployment on push to main branch
|
- **Primary Method**: CloudFront distribution with S3 origin
|
||||||
- Build output: Static files in `/out` directory
|
- S3 bucket: `filamenteka-frontend`
|
||||||
- Config: `amplify.yml`, `next.config.js` (output: 'export')
|
- CloudFront Function: `index-rewrite` for directory-to-index.html routing
|
||||||
- Security check runs during build (amplify.yml preBuild phase)
|
- Build output: Static files in `/out` directory (Next.js static export)
|
||||||
|
- Config: `next.config.js` (output: 'export'), `terraform/cloudfront-frontend.tf`
|
||||||
|
- Cache: 24h TTL for static assets, GET/HEAD methods cached
|
||||||
|
- OAC (Origin Access Control): S3 public access blocked, CloudFront-only access
|
||||||
|
- **CI/CD**: Gitea Actions workflow (`.gitea/workflows/deploy.yml`) auto-deploys on push to main
|
||||||
|
|
||||||
### API Server (EC2)
|
### API Server (EC2)
|
||||||
- Deployment via `scripts/deploy-api-update.sh` (uses AWS SSM to push updates)
|
- Deployment via `scripts/deploy-api-update.sh` (uses AWS SSM to push updates)
|
||||||
@@ -129,7 +142,7 @@ color_requests: {
|
|||||||
- Server IP: `3.71.161.51`
|
- Server IP: `3.71.161.51`
|
||||||
- Domain: `api.filamenteka.rs`
|
- Domain: `api.filamenteka.rs`
|
||||||
- Service: `node-api` (systemd)
|
- Service: `node-api` (systemd)
|
||||||
- Deploy script pulls from GitHub main branch and restarts service
|
- Deploy script pulls from Gitea main branch and restarts service
|
||||||
- IMPORTANT: When deploying API, remember to build for AMD64 Linux (not ARM macOS)
|
- IMPORTANT: When deploying API, remember to build for AMD64 Linux (not ARM macOS)
|
||||||
|
|
||||||
### Database (RDS PostgreSQL)
|
### Database (RDS PostgreSQL)
|
||||||
@@ -170,7 +183,14 @@ color_requests: {
|
|||||||
- Config: `jest.config.js`, `jest.setup.js`
|
- Config: `jest.config.js`, `jest.setup.js`
|
||||||
- Coverage goal: >80%
|
- Coverage goal: >80%
|
||||||
- Run with `npm test` or `npm run test:watch`
|
- Run with `npm test` or `npm run test:watch`
|
||||||
- Tests include: component tests, API integration tests, data consistency checks
|
- Test files include:
|
||||||
|
- `ui-features.test.ts` - UI functionality
|
||||||
|
- `api-integration.test.ts` - API interactions
|
||||||
|
- `no-mock-data.test.ts` - Real data validation (ensures no fake/mock data)
|
||||||
|
- `color-management.test.ts` - Color CRUD operations
|
||||||
|
- `data-consistency.test.ts` - Data validation
|
||||||
|
- `components/*.test.tsx` - Component unit tests
|
||||||
|
- `data/*.test.ts` - Data structure validation
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
@@ -225,18 +245,16 @@ Important database constraints:
|
|||||||
- `filaments.kolicina` has check constraint: `kolicina = refill + spulna`
|
- `filaments.kolicina` has check constraint: `kolicina = refill + spulna`
|
||||||
- Always update `colors` table first before adding filaments with new colors
|
- Always update `colors` table first before adding filaments with new colors
|
||||||
|
|
||||||
### API Deployment Workflow
|
### Deployment Workflow (Gitea Actions CI/CD)
|
||||||
1. Make changes to `/api/server.js`
|
Pushing to `main` triggers `.gitea/workflows/deploy.yml` which auto-detects what changed:
|
||||||
2. Commit and push to main branch
|
- **Frontend changes**: Runs security check, tests, builds Next.js, deploys to S3 with cache headers, invalidates CloudFront
|
||||||
3. Run `./scripts/deploy-api-update.sh` (uses AWS SSM to pull from GitHub and restart)
|
- **API changes**: Sends SSM command to EC2 to download `server.js` from Gitea and restart the service
|
||||||
4. Verify deployment: `curl https://api.filamenteka.rs/` should return `{"status":"ok"}`
|
- **Both**: If a push touches frontend and API files, both deploy steps run
|
||||||
|
|
||||||
### Frontend Deployment Workflow
|
Manual deployment is still available:
|
||||||
1. Make changes to app/components/pages
|
1. Frontend: `./scripts/deploy-frontend.sh`
|
||||||
2. Test locally: `npm run dev`
|
2. API: `./scripts/deploy-api-update.sh`
|
||||||
3. Run pre-commit checks: `./scripts/pre-commit.sh`
|
3. Verify API: `curl https://api.filamenteka.rs/` should return `{"status":"ok"}`
|
||||||
4. Commit and push to main branch
|
|
||||||
5. AWS Amplify automatically builds and deploys (monitors main branch)
|
|
||||||
|
|
||||||
## Infrastructure
|
## Infrastructure
|
||||||
|
|
||||||
@@ -256,4 +274,7 @@ Infrastructure as Code in `/terraform/`:
|
|||||||
- **API**: EC2 instance running Node.js/Express with systemd service
|
- **API**: EC2 instance running Node.js/Express with systemd service
|
||||||
- **Database**: AWS RDS PostgreSQL (eu-central-1)
|
- **Database**: AWS RDS PostgreSQL (eu-central-1)
|
||||||
- **DNS**: Cloudflare for api.filamenteka.rs
|
- **DNS**: Cloudflare for api.filamenteka.rs
|
||||||
- **Deployment**: AWS Amplify for frontend, SSM for API updates
|
- **CI/CD**: Gitea Actions (`.gitea/workflows/deploy.yml`)
|
||||||
|
- **Deployment**: CloudFront + S3 for frontend, SSM for API updates
|
||||||
|
- **Repository**: `git.demirix.dev/dax/Filamenteka`
|
||||||
|
- **CDN**: CloudFront PriceClass_100 (US, Canada, Europe)
|
||||||
55
README.md
55
README.md
@@ -4,21 +4,22 @@ A web application for tracking Bambu Lab filament inventory with automatic color
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 🎨 **Automatic Color Coding** - Table rows are automatically colored based on filament colors
|
- Automatic Color Coding - Table rows are automatically colored based on filament colors
|
||||||
- 🔍 **Search & Filter** - Quick search across all filament properties
|
- Search & Filter - Quick search across all filament properties
|
||||||
- 📊 **Sortable Columns** - Click headers to sort by any column
|
- Sortable Columns - Click headers to sort by any column
|
||||||
- 🌈 **Gradient Support** - Special handling for gradient filaments like Cotton Candy Cloud
|
- Gradient Support - Special handling for gradient filaments like Cotton Candy Cloud
|
||||||
- 📱 **Responsive Design** - Works on desktop and mobile devices
|
- Responsive Design - Works on desktop and mobile devices
|
||||||
- 💰 **Sale Management** - Bulk sale pricing with countdown timers
|
- Sale Management - Bulk sale pricing with countdown timers
|
||||||
- 🔐 **Admin Panel** - Protected dashboard for inventory management
|
- Admin Panel - Protected dashboard for inventory management
|
||||||
- 📦 **Spool Types** - Support for both regular and refill spools
|
- Spool Types - Support for both regular and refill spools
|
||||||
|
|
||||||
## Technology Stack
|
## Technology Stack
|
||||||
|
|
||||||
- **Frontend**: Next.js + React + TypeScript + Tailwind CSS
|
- **Frontend**: Next.js + React + TypeScript + Tailwind CSS
|
||||||
- **Backend**: Node.js API server (Express)
|
- **Backend**: Node.js API server (Express)
|
||||||
- **Database**: PostgreSQL (AWS RDS)
|
- **Database**: PostgreSQL (AWS RDS)
|
||||||
- **Infrastructure**: AWS Amplify (Frontend), EC2 (API), RDS (Database)
|
- **Infrastructure**: AWS CloudFront + S3 (Frontend), EC2 (API), RDS (Database)
|
||||||
|
- **CI/CD**: Gitea Actions
|
||||||
- **IaC**: Terraform
|
- **IaC**: Terraform
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
@@ -27,15 +28,14 @@ A web application for tracking Bambu Lab filament inventory with automatic color
|
|||||||
- PostgreSQL (for local development)
|
- PostgreSQL (for local development)
|
||||||
- AWS Account (for deployment)
|
- AWS Account (for deployment)
|
||||||
- Terraform 1.0+ (for infrastructure)
|
- Terraform 1.0+ (for infrastructure)
|
||||||
- GitHub account
|
|
||||||
|
|
||||||
## Setup Instructions
|
## Setup Instructions
|
||||||
|
|
||||||
### 1. Clone the Repository
|
### 1. Clone the Repository
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/yourusername/filamenteka.git
|
git clone https://git.demirix.dev/DaX/Filamenteka.git
|
||||||
cd filamenteka
|
cd Filamenteka
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Install Dependencies
|
### 2. Install Dependencies
|
||||||
@@ -90,7 +90,7 @@ The filament table displays these columns:
|
|||||||
- **Boja** - Color name (e.g., Mistletoe Green, Hot Pink)
|
- **Boja** - Color name (e.g., Mistletoe Green, Hot Pink)
|
||||||
- **Refill** - Number of refill spools
|
- **Refill** - Number of refill spools
|
||||||
- **Spulna** - Number of regular spools
|
- **Spulna** - Number of regular spools
|
||||||
- **Količina** - Total quantity (refill + spulna)
|
- **Kolicina** - Total quantity (refill + spulna)
|
||||||
- **Cena** - Price per unit
|
- **Cena** - Price per unit
|
||||||
- **Sale** - Active sale percentage and end date
|
- **Sale** - Active sale percentage and end date
|
||||||
|
|
||||||
@@ -106,15 +106,19 @@ Unknown colors default to light gray.
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
Push to the main branch to trigger automatic deployment:
|
Pushing to `main` triggers automatic deployment via Gitea Actions:
|
||||||
|
- Frontend changes are built, tested, and deployed to S3/CloudFront
|
||||||
|
- API changes are deployed to EC2 via AWS SSM
|
||||||
|
|
||||||
|
Manual deployment is also available:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add .
|
# Frontend
|
||||||
git commit -m "Update filament colors"
|
./scripts/deploy-frontend.sh
|
||||||
git push origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
Amplify will automatically build and deploy your changes.
|
# API
|
||||||
|
./scripts/deploy-api-update.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Admin Panel
|
## Admin Panel
|
||||||
|
|
||||||
@@ -155,9 +159,7 @@ Deploy API server updates:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Use the deployment script
|
# Use the deployment script
|
||||||
./scripts/deploy-api.sh
|
./scripts/deploy-api-update.sh
|
||||||
|
|
||||||
# Or deploy manually to EC2 instance
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
@@ -181,12 +183,3 @@ Deploy API server updates:
|
|||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create a feature branch
|
|
||||||
3. Commit your changes
|
|
||||||
4. Push to the branch
|
|
||||||
5. Create a Pull Request
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ cd /home/ubuntu/filamenteka-api
|
|||||||
# Backup current server.js
|
# Backup current server.js
|
||||||
cp server.js server.js.backup
|
cp server.js server.js.backup
|
||||||
|
|
||||||
# Download the updated server.js from GitHub
|
# Download the updated server.js from Gitea
|
||||||
curl -o server.js https://raw.githubusercontent.com/daxdax89/Filamenteka/sale/api/server.js
|
curl -o server.js https://git.demirix.dev/dax/Filamenteka/raw/branch/main/api/server.js
|
||||||
|
|
||||||
# Restart the service
|
# Restart the service
|
||||||
sudo systemctl restart node-api
|
sudo systemctl restart node-api
|
||||||
@@ -30,7 +30,7 @@ aws ssm send-command \
|
|||||||
--parameters "commands=[
|
--parameters "commands=[
|
||||||
'cd /home/ubuntu/filamenteka-api',
|
'cd /home/ubuntu/filamenteka-api',
|
||||||
'cp server.js server.js.backup',
|
'cp server.js server.js.backup',
|
||||||
'curl -o server.js https://raw.githubusercontent.com/daxdax89/Filamenteka/sale/api/server.js',
|
'curl -o server.js https://git.demirix.dev/dax/Filamenteka/raw/branch/main/api/server.js',
|
||||||
'sudo systemctl restart node-api',
|
'sudo systemctl restart node-api',
|
||||||
'sudo systemctl status node-api'
|
'sudo systemctl status node-api'
|
||||||
]" \
|
]" \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script to update API server via GitHub
|
# Script to update API server via Gitea
|
||||||
# Since we can't SSH directly, we'll use the API server to pull latest code
|
# Since we can't SSH directly, we'll use the API server to pull latest code
|
||||||
|
|
||||||
echo "🚀 Updating API server with latest code..."
|
echo "🚀 Updating API server with latest code..."
|
||||||
|
|||||||
@@ -20,98 +20,5 @@ provider "cloudflare" {
|
|||||||
api_token = var.cloudflare_api_token != "" ? var.cloudflare_api_token : "dummy" # Dummy token if not provided
|
api_token = var.cloudflare_api_token != "" ? var.cloudflare_api_token : "dummy" # Dummy token if not provided
|
||||||
}
|
}
|
||||||
|
|
||||||
# ===== DEPRECATED: Amplify Hosting (Migrated to CloudFront + S3) =====
|
# Frontend hosted on CloudFront + S3 (see cloudfront-frontend.tf)
|
||||||
# Amplify app was deleted due to broken GitHub integration
|
# CI/CD handled by Gitea Actions (see .gitea/workflows/deploy.yml)
|
||||||
# Frontend now hosted on CloudFront + S3 (see cloudfront-frontend.tf)
|
|
||||||
# Kept here for reference only
|
|
||||||
#
|
|
||||||
# resource "aws_amplify_app" "filamenteka" {
|
|
||||||
# name = "filamenteka"
|
|
||||||
# repository = var.github_repository
|
|
||||||
# platform = "WEB"
|
|
||||||
#
|
|
||||||
# build_spec = <<-EOT
|
|
||||||
# version: 1
|
|
||||||
# frontend:
|
|
||||||
# phases:
|
|
||||||
# preBuild:
|
|
||||||
# commands:
|
|
||||||
# - npm ci
|
|
||||||
# - npm run security:check
|
|
||||||
# build:
|
|
||||||
# commands:
|
|
||||||
# - npm run build
|
|
||||||
# - npm run test
|
|
||||||
# artifacts:
|
|
||||||
# baseDirectory: .next
|
|
||||||
# files:
|
|
||||||
# - '**/*'
|
|
||||||
# cache:
|
|
||||||
# paths:
|
|
||||||
# - node_modules/**/*
|
|
||||||
# - .next/cache/**/*
|
|
||||||
# EOT
|
|
||||||
#
|
|
||||||
# environment_variables = {
|
|
||||||
# NEXT_PUBLIC_API_URL = "https://api.filamenteka.rs/api"
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# custom_rule {
|
|
||||||
# source = "/<*>"
|
|
||||||
# status = "404"
|
|
||||||
# target = "/index.html"
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# enable_branch_auto_build = true
|
|
||||||
#
|
|
||||||
# tags = {
|
|
||||||
# Name = "Filamenteka"
|
|
||||||
# Environment = var.environment
|
|
||||||
# "amplify:github_app_migration" = "opted_out"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# resource "aws_amplify_branch" "main" {
|
|
||||||
# app_id = aws_amplify_app.filamenteka.id
|
|
||||||
# branch_name = "main"
|
|
||||||
# enable_auto_build = true
|
|
||||||
# environment_variables = {}
|
|
||||||
# stage = "PRODUCTION"
|
|
||||||
# tags = {
|
|
||||||
# Name = "Filamenteka-main"
|
|
||||||
# Environment = var.environment
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# resource "aws_amplify_branch" "dev" {
|
|
||||||
# app_id = aws_amplify_app.filamenteka.id
|
|
||||||
# branch_name = "dev"
|
|
||||||
# enable_auto_build = true
|
|
||||||
# stage = "DEVELOPMENT"
|
|
||||||
# tags = {
|
|
||||||
# Name = "Filamenteka-dev"
|
|
||||||
# Environment = "development"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# resource "aws_amplify_domain_association" "filamenteka" {
|
|
||||||
# count = var.domain_name != "" ? 1 : 0
|
|
||||||
# app_id = aws_amplify_app.filamenteka.id
|
|
||||||
# domain_name = var.domain_name
|
|
||||||
# wait_for_verification = false
|
|
||||||
#
|
|
||||||
# sub_domain {
|
|
||||||
# branch_name = aws_amplify_branch.main.branch_name
|
|
||||||
# prefix = ""
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# sub_domain {
|
|
||||||
# branch_name = aws_amplify_branch.main.branch_name
|
|
||||||
# prefix = "www"
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# sub_domain {
|
|
||||||
# branch_name = aws_amplify_branch.dev.branch_name
|
|
||||||
# prefix = "dev"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
# Copy this file to terraform.tfvars and fill in your values
|
# Copy this file to terraform.tfvars and fill in your values
|
||||||
|
|
||||||
# GitHub repository for Amplify
|
|
||||||
github_repository = "https://github.com/yourusername/filamenteka"
|
|
||||||
github_token = "ghp_your_github_token_here"
|
|
||||||
|
|
||||||
# Domain configuration
|
# Domain configuration
|
||||||
domain_name = "filamenteka.yourdomain.com"
|
domain_name = "filamenteka.yourdomain.com"
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,3 @@
|
|||||||
variable "github_repository" {
|
|
||||||
description = "GitHub repository URL"
|
|
||||||
type = string
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "github_token" {
|
|
||||||
description = "GitHub personal access token for Amplify"
|
|
||||||
type = string
|
|
||||||
sensitive = true
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "domain_name" {
|
variable "domain_name" {
|
||||||
description = "Custom domain name (optional)"
|
description = "Custom domain name (optional)"
|
||||||
type = string
|
type = string
|
||||||
|
|||||||
Reference in New Issue
Block a user