Skip to content

Commit 1e59f0f

Browse files
author
Alumno
committed
Initial project import and frontend completion
0 parents  commit 1e59f0f

71 files changed

Lines changed: 8024 additions & 0 deletions

Some content is hidden

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

.dockerignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.github
5+
6+
# IDE
7+
.vscode
8+
.idea
9+
*.swp
10+
*.swo
11+
*~
12+
13+
# Documentation
14+
README.md
15+
DOCKER.md
16+
JWT.md
17+
SECURITY.md
18+
INSTALL.md
19+
*.md
20+
21+
# Logs
22+
logs/
23+
*.log
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Backups
30+
backups/
31+
*.backup
32+
*.bak
33+
34+
# Env files (usar variables de Docker)
35+
.env
36+
.env.*
37+
38+
# Composer
39+
vendor/
40+
composer.lock
41+
42+
# NPM
43+
node_modules/
44+
package-lock.json
45+
46+
# Tests
47+
tests/
48+
phpunit.xml
49+
50+
# Scripts (no necesarios en imagen)
51+
scripts/
52+
53+
# Docker files (no necesarios dentro de la imagen)
54+
Dockerfile*
55+
docker-compose*.yml
56+
.dockerignore
57+
58+
# Uploads y temp (se monta como volumen)
59+
uploads/
60+
tmp/
61+
temp/
62+
cache/
63+
64+
# CI/CD
65+
.github/
66+
.gitlab-ci.yml
67+
.travis.yml

.env.docker

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Docker Environment Variables
2+
# Copia este archivo a .env para desarrollo local
3+
4+
# Application
5+
APP_ENV=development
6+
APP_DEBUG=true
7+
APP_PORT=8080
8+
9+
# Database
10+
DB_NAME=secure_app_db
11+
DB_USER=root
12+
DB_PASSWORD=root
13+
MYSQL_PORT=3306
14+
15+
# Redis (opcional)
16+
REDIS_PASSWORD=secret
17+
REDIS_PORT=6379
18+
19+
# phpMyAdmin (opcional)
20+
PMA_PORT=8081
21+
22+
# Nginx (producción)
23+
NGINX_PORT=80
24+
NGINX_SSL_PORT=443

.env.example

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Configuración de la Aplicación
2+
# Copia este archivo a .env y configura los valores reales
3+
4+
# Aplicación
5+
APP_NAME="Secure App"
6+
APP_ENV=development
7+
APP_DEBUG=true
8+
APP_URL=http://localhost
9+
10+
# Base de Datos
11+
DB_HOST=localhost
12+
DB_NAME=secure_app_db
13+
DB_USER=root
14+
DB_PASSWORD=
15+
16+
# Seguridad
17+
SESSION_LIFETIME=7200
18+
MAX_LOGIN_ATTEMPTS=5
19+
LOCKOUT_DURATION=900
20+
21+
# Email (opcional)
22+
MAIL_FROM=noreply@secureapp.com
23+
MAIL_FROM_NAME="Secure App"
24+
SMTP_HOST=
25+
SMTP_PORT=587
26+
SMTP_USERNAME=
27+
SMTP_PASSWORD=
28+
29+
# Timezone
30+
APP_TIMEZONE=America/Mexico_City

.github/workflows/deploy.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
13+
env:
14+
DOCKER_REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
# Job 1: Tests y Validación
19+
test:
20+
name: Tests y Validación
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout código
25+
uses: actions/checkout@v3
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.2'
31+
extensions: pdo, pdo_mysql, opcache
32+
33+
- name: Validar sintaxis PHP
34+
run: |
35+
find src -name "*.php" -exec php -l {} \; | grep -v "No syntax errors"
36+
37+
- name: Verificar configuración
38+
run: |
39+
if [ ! -f "config.php" ]; then
40+
echo "Error: config.php no encontrado"
41+
exit 1
42+
fi
43+
44+
# Job 2: Build Docker Image
45+
build:
46+
name: Build Docker Image
47+
runs-on: ubuntu-latest
48+
needs: test
49+
50+
steps:
51+
- name: Checkout código
52+
uses: actions/checkout@v3
53+
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v2
56+
57+
- name: Login to GitHub Container Registry
58+
uses: docker/login-action@v2
59+
with:
60+
registry: ${{ env.DOCKER_REGISTRY }}
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
64+
- name: Extract metadata
65+
id: meta
66+
uses: docker/metadata-action@v4
67+
with:
68+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
69+
tags: |
70+
type=ref,event=branch
71+
type=ref,event=pr
72+
type=semver,pattern={{version}}
73+
type=semver,pattern={{major}}.{{minor}}
74+
type=sha,prefix={{branch}}-
75+
76+
- name: Build y Push Docker Image
77+
uses: docker/build-push-action@v4
78+
with:
79+
context: .
80+
push: ${{ github.event_name != 'pull_request' }}
81+
tags: ${{ steps.meta.outputs.tags }}
82+
labels: ${{ steps.meta.outputs.labels }}
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+
target: production
86+
87+
# Job 3: Deploy a Staging (solo branch develop)
88+
deploy-staging:
89+
name: Deploy to Staging
90+
runs-on: ubuntu-latest
91+
needs: build
92+
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
93+
environment:
94+
name: staging
95+
url: https://staging.yourdomain.com
96+
97+
steps:
98+
- name: Checkout código
99+
uses: actions/checkout@v3
100+
101+
- name: Deploy vía SSH
102+
uses: appleboy/ssh-action@master
103+
with:
104+
host: ${{ secrets.STAGING_HOST }}
105+
username: ${{ secrets.STAGING_USER }}
106+
key: ${{ secrets.STAGING_SSH_KEY }}
107+
script: |
108+
cd /var/www/secure-app-staging
109+
git pull origin develop
110+
docker-compose down
111+
docker-compose pull
112+
docker-compose up -d
113+
docker-compose exec -T app php --version
114+
115+
# Job 4: Deploy a Production (solo branch main)
116+
deploy-production:
117+
name: Deploy to Production
118+
runs-on: ubuntu-latest
119+
needs: build
120+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
121+
environment:
122+
name: production
123+
url: https://yourdomain.com
124+
125+
steps:
126+
- name: Checkout código
127+
uses: actions/checkout@v3
128+
129+
- name: Deploy vía SSH
130+
uses: appleboy/ssh-action@master
131+
with:
132+
host: ${{ secrets.PRODUCTION_HOST }}
133+
username: ${{ secrets.PRODUCTION_USER }}
134+
key: ${{ secrets.PRODUCTION_SSH_KEY }}
135+
script: |
136+
cd /var/www/secure-app
137+
git pull origin main
138+
docker-compose down
139+
docker-compose --profile production pull
140+
docker-compose --profile production up -d
141+
docker-compose exec -T app php --version
142+
143+
- name: Health Check
144+
run: |
145+
sleep 30
146+
curl -f https://yourdomain.com/api.php?path=health || exit 1
147+
148+
# Job 5: Security Scan
149+
security-scan:
150+
name: Security Scan
151+
runs-on: ubuntu-latest
152+
needs: test
153+
154+
steps:
155+
- name: Checkout código
156+
uses: actions/checkout@v3
157+
158+
- name: Run Trivy vulnerability scanner
159+
uses: aquasecurity/trivy-action@master
160+
with:
161+
scan-type: 'fs'
162+
scan-ref: '.'
163+
format: 'sarif'
164+
output: 'trivy-results.sarif'
165+
166+
- name: Upload Trivy results to GitHub Security
167+
uses: github/codeql-action/upload-sarif@v2
168+
with:
169+
sarif_file: 'trivy-results.sarif'

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Sistema Operativo
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
*~
10+
.env
11+
12+
# IDEs
13+
.vscode/
14+
.idea/
15+
*.sublime-project
16+
*.sublime-workspace
17+
*.swp
18+
*.swo
19+
20+
# Logs
21+
logs/
22+
*.log
23+
error_log
24+
25+
# Configuración sensible
26+
config.php
27+
# Descomentar si usas .env
28+
# .env
29+
30+
# Dependencies
31+
vendor/
32+
node_modules/
33+
34+
# Uploads y cache
35+
uploads/
36+
cache/
37+
temp/
38+
tmp/
39+
40+
# Backups
41+
*.sql
42+
*.sql.gz
43+
*.backup
44+
backup/
45+
46+
# Sistema
47+
.htaccess.backup

0 commit comments

Comments
 (0)