mirror of
https://github.com/Dasemu/si-no-o-indiferente.git
synced 2026-11-27 15:56:52 +00:00
Translate root README to English and drop the deploy walkthrough
Purges docs/DEPLOY.md per project decision to stop maintaining a separate deploy walkthrough; deploy/ example systemd/nginx units remain as the reference. Root README is translated to English (game name kept as-is) to match the rest of the repo's documentation.
This commit is contained in:
1 parent
2681039074
commit
c5f4f728f4
2 files changed
+37
-154
No files matched your search
@@ -1,40 +1,39 @@
|
|||||||
# Historias Incompletas
|
# Sí, no, o indiferente
|
||||||
|
|
||||||
Juego de historias de pensamiento lateral (estilo "cuenta un enigma, el resto
|
A lateral-thinking story game (in the style of "tell a puzzle, everyone else
|
||||||
adivina la explicación completa haciendo preguntas de sí/no") para 2 o más
|
guesses the full explanation by asking yes/no questions") for 2 or more
|
||||||
jugadores compartiendo un mismo dispositivo. Web + APK (Capacitor).
|
players sharing a single device. Web + APK (Capacitor).
|
||||||
|
|
||||||
- Un jugador narra: elige una historia, lee en voz alta el enigma, y
|
- One player narrates: they pick a story, read the puzzle aloud, and answer
|
||||||
responde preguntas de sí/no del resto del grupo hasta que adivinan (o se
|
yes/no questions from the rest of the group until they guess (or give up
|
||||||
rinden) la solución completa.
|
on) the full solution.
|
||||||
- La app trae un mazo de historias por defecto embebido, y además intenta
|
- The app ships with a default deck of stories embedded, and also tries to
|
||||||
bajar un mazo "actualizado" desde un backend propio que genera 5 historias
|
download an "updated" deck from its own backend, which generates 5 new
|
||||||
nuevas por día con la API de Gemini. Si no hay conexión o el backend no
|
stories a day using the Gemini API. If there's no connection or the
|
||||||
tiene nada disponible, se usa el mazo default.
|
backend has nothing available, the default deck is used.
|
||||||
|
|
||||||
## Estructura del repo
|
## Repo structure
|
||||||
|
|
||||||
```
|
```
|
||||||
backend/ API en Node/Express que sirve /api/stories y genera historias
|
backend/ Node/Express API that serves /api/stories and generates new
|
||||||
nuevas con Gemini (backend/README.md)
|
stories with Gemini (backend/README.md)
|
||||||
frontend/ App React + Vite, empaquetable como APK con Capacitor
|
frontend/ React + Vite app, packageable as an Android APK with Capacitor
|
||||||
(frontend/README.md)
|
(frontend/README.md)
|
||||||
deploy/ Unidades systemd + config de nginx de ejemplo para producción
|
deploy/ Example systemd units + nginx config for production
|
||||||
docs/ Guía de deploy paso a paso (docs/DEPLOY.md)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Desarrollo local
|
## Local development
|
||||||
|
|
||||||
### Backend
|
### Backend
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd backend
|
cd backend
|
||||||
npm install
|
npm install
|
||||||
cp .env.example .env # completa GEMINI_API_KEY y ADMIN_TOKEN
|
cp .env.example .env # fill in GEMINI_API_KEY and ADMIN_TOKEN
|
||||||
npm run dev # http://localhost:8787
|
npm run dev # http://localhost:8787
|
||||||
```
|
```
|
||||||
|
|
||||||
Generar historias manualmente (usa tu GEMINI_API_KEY real):
|
Generate stories manually (uses your real GEMINI_API_KEY):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run generate
|
npm run generate
|
||||||
@@ -45,43 +44,41 @@ npm run generate
|
|||||||
```bash
|
```bash
|
||||||
cd frontend
|
cd frontend
|
||||||
npm install
|
npm install
|
||||||
cp .env.example .env # VITE_API_URL=http://localhost:8787 en dev
|
cp .env.example .env # VITE_API_URL=http://localhost:8787 in dev
|
||||||
npm run dev # http://localhost:5173
|
npm run dev # http://localhost:5173
|
||||||
```
|
```
|
||||||
|
|
||||||
### Frontend (APK con Capacitor)
|
### Frontend (APK with Capacitor)
|
||||||
|
|
||||||
Requiere Android Studio / Android SDK + JDK 17 instalados en tu máquina de
|
Requires Android Studio / Android SDK + JDK 17 installed on your development
|
||||||
desarrollo (esto no se puede generar en este entorno). Una vez instalados:
|
machine (this can't be generated in this environment). Once installed:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd frontend
|
cd frontend
|
||||||
npm run cap:sync # build web + copia assets a android/
|
npm run cap:sync # builds the web app + copies assets into android/
|
||||||
npm run android:open # abre el proyecto en Android Studio para compilar/firmar el APK
|
npm run android:open # opens the project in Android Studio to build/sign the APK
|
||||||
```
|
```
|
||||||
|
|
||||||
También podés compilar por línea de comandos una vez que tengas el SDK:
|
You can also build it from the command line once you have the SDK:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd frontend/android
|
cd frontend/android
|
||||||
./gradlew assembleDebug
|
./gradlew assembleDebug
|
||||||
# APK en frontend/android/app/build/outputs/apk/debug/
|
# APK at frontend/android/app/build/outputs/apk/debug/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contenido por defecto
|
## Default content
|
||||||
|
|
||||||
`frontend/src/data/defaultStories.json` tiene 16 historias originales
|
`frontend/src/data/defaultStories.json` has 16 original stories written for
|
||||||
escritas para este proyecto (no extraídas de ningún juego comercial de
|
this project (not extracted from any third-party commercial game), used as
|
||||||
terceros), usadas como fallback cuando no hay conexión al backend o todavía
|
a fallback when there's no connection to the backend or no batch has been
|
||||||
no se generó ningún lote.
|
generated yet.
|
||||||
|
|
||||||
## Producción
|
## Production
|
||||||
|
|
||||||
Ver [`docs/DEPLOY.md`](docs/DEPLOY.md) para el paso a paso de deploy en un
|
Example systemd/nginx configs live in the `deploy/` folder.
|
||||||
LXC de Debian sin Docker, con systemd + nginx + certbot, apuntando a tu
|
|
||||||
propio dominio.
|
|
||||||
|
|
||||||
## API key de Gemini
|
## Gemini API key
|
||||||
|
|
||||||
Conseguila en https://aistudio.google.com/apikey y ponela en
|
Get one at https://aistudio.google.com/apikey and put it in `backend/.env`
|
||||||
`backend/.env` como `GEMINI_API_KEY`.
|
as `GEMINI_API_KEY`.
|
||||||
-114
@@ -1,114 +0,0 @@
|
|||||||
# Deploy en un LXC de Debian (sin Docker, sin proveedor externo)
|
|
||||||
|
|
||||||
Esta guia asume un contenedor LXC Debian 12 con acceso root, sin Docker, y
|
|
||||||
que vas a exponer la app en tu propio dominio con nginx + Let's Encrypt.
|
|
||||||
|
|
||||||
## 1. Preparar el sistema
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apt update && apt upgrade -y
|
|
||||||
apt install -y curl git nginx certbot python3-certbot-nginx
|
|
||||||
|
|
||||||
# Node.js 22 LTS via NodeSource
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
apt install -y nodejs
|
|
||||||
|
|
||||||
node -v # deberia mostrar v22.x
|
|
||||||
```
|
|
||||||
|
|
||||||
Crea un usuario de sistema dedicado (sin login) para correr la app:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
useradd --system --create-home --home-dir /opt/historias --shell /usr/sbin/nologin historias
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. Clonar y preparar el proyecto
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /opt/historias
|
|
||||||
git clone <url-de-tu-repo> app
|
|
||||||
cd app
|
|
||||||
|
|
||||||
# Backend
|
|
||||||
cd backend
|
|
||||||
npm ci
|
|
||||||
cp .env.example .env
|
|
||||||
# Editar .env: GEMINI_API_KEY, ADMIN_TOKEN, CORS_ORIGIN=https://tu-dominio.com
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# Frontend
|
|
||||||
cd ../frontend
|
|
||||||
npm ci
|
|
||||||
cp .env.example .env
|
|
||||||
# Editar .env: VITE_API_URL=https://tu-dominio.com
|
|
||||||
npm run build # genera frontend/dist, servido por nginx
|
|
||||||
|
|
||||||
chown -R historias:historias /opt/historias
|
|
||||||
```
|
|
||||||
|
|
||||||
> Los paths de los ejemplos en `deploy/*.service` asumen que el repo termina
|
|
||||||
> viviendo en `/opt/historias/backend` y `/opt/historias/frontend`. Si tu
|
|
||||||
> checkout usa otra carpeta (por ejemplo `/opt/historias/app/backend`),
|
|
||||||
> ajusta `WorkingDirectory` y `ExecStart` en los archivos `.service` antes de
|
|
||||||
> instalarlos.
|
|
||||||
|
|
||||||
## 3. Servicio de la API (systemd)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp deploy/story-api.service /etc/systemd/system/story-api.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable --now story-api
|
|
||||||
systemctl status story-api
|
|
||||||
curl http://127.0.0.1:8787/api/health # {"ok":true}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. Generacion diaria de historias (systemd timer)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp deploy/story-generate.service /etc/systemd/system/story-generate.service
|
|
||||||
cp deploy/story-generate.timer /etc/systemd/system/story-generate.timer
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable --now story-generate.timer
|
|
||||||
|
|
||||||
# Probar la generacion manualmente una vez (usa tu GEMINI_API_KEY real):
|
|
||||||
systemctl start story-generate.service
|
|
||||||
journalctl -u story-generate.service -n 50 --no-pager
|
|
||||||
```
|
|
||||||
|
|
||||||
El timer corre todos los dias a las 06:00 (hora del sistema del LXC) con
|
|
||||||
hasta 10 minutos de retraso aleatorio. Ajusta `OnCalendar` en el `.timer` si
|
|
||||||
preferis otro horario.
|
|
||||||
|
|
||||||
## 5. nginx + TLS
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp deploy/nginx.conf.example /etc/nginx/sites-available/historias
|
|
||||||
# Editar server_name y la ruta de "root" si corresponde
|
|
||||||
ln -s /etc/nginx/sites-available/historias /etc/nginx/sites-enabled/historias
|
|
||||||
nginx -t && systemctl reload nginx
|
|
||||||
|
|
||||||
certbot --nginx -d tu-dominio.com
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6. Actualizar la app despues de un cambio
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /opt/historias/app
|
|
||||||
git pull
|
|
||||||
cd backend && npm ci && npm run build
|
|
||||||
cd ../frontend && npm ci && npm run build
|
|
||||||
systemctl restart story-api
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notas
|
|
||||||
|
|
||||||
- Las historias generadas se guardan en `backend/data/*.json` (no se versionan
|
|
||||||
en git). Hace backup de esa carpeta si te importa el historial generado.
|
|
||||||
- Si Gemini falla un dia (cuota, red, etc.), `story-generate.service` termina
|
|
||||||
con error y `latest.json` simplemente no se actualiza: la API sigue
|
|
||||||
sirviendo el ultimo lote bueno, y si nunca hubo ninguno, el cliente cae a
|
|
||||||
las historias default embebidas en la app.
|
|
||||||
- `ADMIN_TOKEN` protege `POST /api/admin/generate`, util para forzar una
|
|
||||||
generacion manual sin esperar al timer:
|
|
||||||
`curl -X POST https://tu-dominio.com/api/admin/generate -H "x-admin-token: <token>"`
|
|
||||||
- Revisa logs con `journalctl -u story-api -f` y `journalctl -u story-generate -f`.
|
|
||||||
Reference in new issue
Block a user