sync full source from private myoffice
This commit is contained in:
@@ -1,110 +1,52 @@
|
||||
# MyOffice
|
||||
|
||||
**Layers**
|
||||
Frontend <-> Backend <-> Services <-> Repositories <-> Database
|
||||
ASP.NET Core API + Angular SPA. Full source is in this repository; runnable binaries are published as **Gitea Releases** (`myoffice-publish.tar.gz`).
|
||||
|
||||
*1. MyOffice.SPA*
|
||||
Frontend layer
|
||||
Angular
|
||||
## Install on Proxmox (one line)
|
||||
|
||||
*2. MyOffice.Web*
|
||||
Backend layer
|
||||
ASP Core
|
||||
On the Proxmox host:
|
||||
|
||||
*3. MyOffice.Data.Services*
|
||||
Services layer
|
||||
```bash
|
||||
bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)"
|
||||
```
|
||||
|
||||
*5. MyOffice.Data.Models*
|
||||
Models
|
||||
That creates an LXC with PostgreSQL + ASP.NET runtime, downloads the latest release, and starts the app on port **9100**. Proxy with your nginx LXC to `http://<ct-ip>:9100`.
|
||||
|
||||
*6. MyOffice.Data.Repositories*
|
||||
Database layer
|
||||
Optional environment variables before the command:
|
||||
|
||||
*7. MyOffice.DbContext*
|
||||
AppDbContext
|
||||
EntityFramework Core
|
||||
```bash
|
||||
export GITEA_URL="https://mygit.ase.com.ua"
|
||||
export GITEA_OWNER="alexandr"
|
||||
export GITEA_REPO="myoffice_public"
|
||||
export GITEA_BRANCH="master"
|
||||
export RELEASE_TAG="latest" # or v1.2.3
|
||||
```
|
||||
|
||||
*8. MyOffice.Migrations.Postgres*
|
||||
Postgres Migrations
|
||||
Details: [proxmox/README.md](proxmox/README.md).
|
||||
|
||||
*9. MyOffice.Migrations.Sqlite*
|
||||
Sqlite Migrations
|
||||
## Build from source (manual)
|
||||
|
||||
Requirements: .NET 10 SDK, Node.js 20+.
|
||||
|
||||
**DataBase**
|
||||
1. SQLite
|
||||
2. PostgreSql
|
||||
3. MS SQL
|
||||
```bash
|
||||
./proxmox/publish.sh --tar
|
||||
# Windows: .\proxmox\publish.ps1 -Tar
|
||||
```
|
||||
|
||||
**Develompent**
|
||||
1. Local IIS
|
||||
2. Express IIS
|
||||
Output: `_Published/` (API + SPA in `wwwroot`) and optional `myoffice-publish.tar.gz`.
|
||||
|
||||
**Authentication & Authorization**
|
||||
Local development:
|
||||
|
||||
1. OpenIddict (replaces IdentityServer4)
|
||||
2. Custom UserStore + Identity V3 password hashes (legacy hashes rehashed on login)
|
||||
3. SPA: email/password via ROPC (kept); Authorization Code + PKCE configured for interactive OIDC
|
||||
4. Login with Google / Auth0 (`external` grant)
|
||||
5. Details: [docs/AUTH.md](docs/AUTH.md), refactoring: [docs/REFACTORING_PLAN.md](docs/REFACTORING_PLAN.md)
|
||||
```bash
|
||||
dotnet build MyOffice.Web/MyOffice.Web.csproj
|
||||
cd MyOffice.SPA && npm install && npm start # http://localhost:4300
|
||||
# Run MyOffice.Web (API http://localhost:9100); set FrontEnd:Host to the SPA origin
|
||||
```
|
||||
|
||||
**Build & Deploy**
|
||||
1. Build with .bat
|
||||
2. Deploy to Linux
|
||||
Docker demo (SPA + API + Postgres + pgAdmin): see [Docker/README.md](Docker/README.md).
|
||||
|
||||
**Get started**
|
||||
1. Restore / build: `dotnet build MyOffice.Web/MyOffice.Web.csproj`
|
||||
2. SPA: `cd MyOffice.SPA && npm install && npm start` (default http://localhost:4300)
|
||||
3. Set startup project to `MyOffice.Web`, run (API default http://localhost:9100)
|
||||
4. Ensure `FrontEnd:Host` matches the SPA origin (`appsettings.json`)
|
||||
5. Tests: `dotnet test MyOffice.Tests/MyOffice.Tests.csproj`
|
||||
6. Empty DB is auto-filled with demo users (rates at Jan 1, sample accounts/items/motions):
|
||||
- `user_UAH@user_UAH.userUAH` / `user_UAH`
|
||||
- `user_USD@user_USD.userUSD` / `user_USD`
|
||||
- `user_EUR@user_EUR.userEUR` / `user_EUR`
|
||||
## Demo logins
|
||||
|
||||
**add site to IIS**
|
||||
1. add
|
||||
Site name:myproject
|
||||
Physical path:...\MyProject\MyProject.Web
|
||||
Port:9100
|
||||
2. Select 'IIS', Run Backend (F5)
|
||||
Seeded on empty DB:
|
||||
|
||||
**Settings**
|
||||
1. launchSettings.json
|
||||
2. appsettings
|
||||
appsettings.json
|
||||
appsettings.Development.json
|
||||
appsettings.Production.json
|
||||
3. Optional: `AutoMapper:LicenseKey` (or env `AUTOMAPPER_LICENSE_KEY`) — free Community key from https://automapper.io if under ~$5M revenue. Empty works; you only get license warning logs.
|
||||
|
||||
**External providers**
|
||||
1. Auth0
|
||||
appsettings ExternalProviders:Auth0
|
||||
2. Google
|
||||
appsettings ExternalProviders:Google
|
||||
|
||||
**PowerShell scripts**
|
||||
1. use 'Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass' to allow run *.ps1
|
||||
2. params.txt
|
||||
2.1. publish_folder=_Published (folder to publish)
|
||||
2.2. linux_user=root (linux user)
|
||||
2.3. linux_host=192.168.1.215 (linux host)
|
||||
2.4. linux_folder=/var/www/MyProject (folder in linux)
|
||||
|
||||
**Build**
|
||||
1. .\build.ps1
|
||||
1.1. '.\build.ps1' - build Backend + Frontend
|
||||
1.2. '.\build.ps1 dotnet' build Backend
|
||||
1.3. '.\build.ps1 spa' build Frontend
|
||||
|
||||
**Docker demo** (SPA + API + Postgres + pgAdmin)
|
||||
1. `cd Docker` then `.\build.ps1` (defaults :32080 / :32081 / :32082)
|
||||
2. After code changes: `.\build.ps1 rebuild` (or `.\build.ps1 reset` to wipe DB + re-seed)
|
||||
3. Details: [Docker/README.md](Docker/README.md)
|
||||
|
||||
**Proxmox** (Gitea public scripts + release artifact)
|
||||
1. Maintainer: `.\proxmox\publish.ps1 -Tar` → `.\proxmox\release.ps1` → `.\proxmox\sync-public.ps1 -Push` (or Gitea Actions)
|
||||
2. User on Proxmox: set `GITEA_URL` / `GITEA_OWNER` / `REPO_RAW_BASE`, run `myoffice.sh` (see [proxmox/README.md](proxmox/README.md))
|
||||
3. Proxy nginx to `http://<ct-ip>:9100`
|
||||
4. Lab SSH (no Gitea): `.\proxmox\deploy.ps1 -TargetHost <ct-ip>`
|
||||
- `user_UAH@user_UAH.userUAH` / `user_UAH` (also USD, EUR variants)
|
||||
|
||||
Reference in New Issue
Block a user