Files
iro2-back-lecture/README.md
kosipov b36cf07635
Some checks failed
Deploy back2 / deploy (push) Failing after 46s
add autodeploy and add basic auth for file uploader
2026-04-02 19:42:04 +03:00

51 lines
1.4 KiB
Markdown

## Repo for site https://back2.iro.kosipov.ru
### Autodeploy (Gitea Actions)
Workflow file: `.gitea/workflows/deploy.yml`
Deploy starts automatically on every push to `main`.
Required repository secrets in Gitea:
- `DEPLOY_HOST` - host of the production server (example: `back2.iro.kosipov.ru`)
- `DEPLOY_USER` - SSH user for deploy
- `DEPLOY_PATH` - absolute path to Laravel project on server
- `DEPLOY_SSH_KEY` - private SSH key content (for `DEPLOY_USER`)
- `DEPLOY_PORT` - optional, defaults to `22`
What deployment does:
- updates project to `origin/main`
- runs `composer install --no-dev --optimize-autoloader`
- enables maintenance mode (`php artisan down`)
- clears stale caches, runs migrations, recreates Laravel caches
- restarts queue workers (`php artisan queue:restart`)
- disables maintenance mode (`php artisan up`)
Server prerequisites:
- `php`, `composer`, `git`, `bash` available in PATH
- deploy user has permissions for project files and artisan commands
### File Upload Basic Auth
Upload endpoints and upload page are protected by HTTP Basic Auth with 2 users from `.env`:
- `FILE_LINKS_UPLOAD_USER_1`
- `FILE_LINKS_UPLOAD_PASSWORD_1`
- `FILE_LINKS_UPLOAD_USER_2`
- `FILE_LINKS_UPLOAD_PASSWORD_2`
Protected routes:
- `GET /files`
- `POST /files`
- `POST /api/files/upload`
Download routes stay accessible by signed link:
- `GET /files/download/{path}` (signed URL)
- `GET /api/files/download/{path}` (signed URL)