Production Deployment Guide
Same-origin HTTPS deploy for CognitixERP — publish API + WebApp, put nginx (or IIS) in front, then optionally automate updates with GitHub Actions.
1. Big picture
Use one website for everything (same-origin):
https://yourcompany.com/ → Blazor WebApp
https://yourcompany.com/api/... → Cognitix.API
https://yourcompany.com/uploads/ → logos & files
| On the server | Where |
|---|---|
| API files | /var/www/cognitix-erp/api |
| WebApp files | /var/www/cognitix-erp/webapp |
| API process | systemd cognitix-api on 127.0.0.1:5100 |
| Public HTTPS | nginx (or IIS) in front |
lib/Cognitix.Licensing/.
When you publish, use -p:BuyerBuild=true.
Deep Linux guide in the package: Source/CognitixERP/deploy/hetzner/README.md
2. URLs you must set
Replace yourcompany.com with your real domain. Keep all values matching.
| Place | Value |
|---|---|
| Setup Wizard — Frontend URL | https://yourcompany.com |
| Setup Wizard — API URL | https://yourcompany.com (no /api) |
WebApp appsettings.json | "ApiBaseUrl": "https://yourcompany.com/" |
| API Jwt Issuer / Audience | https://yourcompany.com |
| API Cors AllowedOrigins | https://yourcompany.com |
| API ApiSettings:BaseUrl | https://yourcompany.com |
| API AppSettings:WebAppUrl | https://yourcompany.com |
/api at the end of API URL or ApiBaseUrl.
The app already adds api/.... Wrong values break logos and uploads.
3. Manual deploy (publish on your PC)
From Source/CognitixERP:
3.1 Publish API (Linux VPS)
dotnet publish src\Cognitix.API\Cognitix.API.csproj ^
-c Release -r linux-x64 --self-contained true ^
-p:BuyerBuild=true ^
-o C:\publish\Cognitix.API
3.2 Publish WebApp
dotnet workload install wasm-tools
dotnet publish apps\Cognitix.WebApp\Cognitix.WebApp.csproj ^
-c Release -p:BuyerBuild=true ^
-o C:\publish\Cognitix.WebApp
Before or after publish, set WebApp config:
{
"ApiBaseUrl": "https://yourcompany.com/"
}
Copy API output to the server api/ folder. Copy WebApp wwwroot contents to webapp/.
3.3 Server secrets file
On the server only, create api/appsettings.Production.json
(use sample deploy/hetzner/appsettings.Production.server.example.json). Set:
- Database connection string
- JWT key (32+ chars) or env
COGNITIX_JWT_KEY - CORS + Jwt Issuer/Audience + BaseUrl/WebAppUrl (table in section 2)
Licensing:SkipInDevelopment=false+ CognitiveCircle ApiKey / HmacSecret
4. Linux VPS with nginx (recommended)
Full commands live in deploy/hetzner/README.md. Short version:
-
Folders
sudo mkdir -p /var/www/cognitix-erp/{api,webapp} sudo chown -R YOUR_SSH_USER:www-data /var/www/cognitix-erp -
Database — SQL Server, PostgreSQL, or MySQL.
Sample PostgreSQL script:
deploy/hetzner/postgresql-init.sql -
systemd — copy
deploy/hetzner/cognitix-api.service, setUser=, then:
API listens onsudo systemctl daemon-reload sudo systemctl enable cognitix-api sudo systemctl start cognitix-apihttp://127.0.0.1:5100only. -
nginx — copy
deploy/hetzner/nginx-site.conf.example, changeserver_nameto your domain. Required locations:/,/api/,/uploads/,/api/uploads/,/chat-hub. -
HTTPS
sudo certbot --nginx -d yourcompany.com sudo nginx -t && sudo systemctl reload nginx
/uploads/ and /api/uploads/ proxy blocks
(they are already in the sample nginx file).
5. GitHub Actions CI/CD
This matches Source/CognitixERP/deploy/hetzner/README.md Part B. Optional, but best for updates.
5.1 What you need
- Your code in a GitHub repo (buyer package root =
Source/CognitixERP) - Workflow file:
.github/workflows/deploy.yml - Four GitHub Secrets (no secrets inside the YAML file)
- Licensing DLLs committed:
lib/Cognitix.Licensing/*.dll
5.2 Create deploy SSH key (on your PC)
bash deploy/hetzner/generate-deploy-key.sh
Creates:
deploy/hetzner/deploy-keys/cognitix_erp_deploy— private (GitHub Secret only)deploy/hetzner/deploy-keys/cognitix_erp_deploy.pub— public (server)
Install the public key on the server:
# Windows PowerShell
type deploy\hetzner\deploy-keys\cognitix_erp_deploy.pub | ssh YOUR_SSH_USER@YOUR_SERVER_IP "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
# Linux / macOS
cat deploy/hetzner/deploy-keys/cognitix_erp_deploy.pub | ssh YOUR_SSH_USER@YOUR_SERVER_IP "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Test:
ssh -i deploy/hetzner/deploy-keys/cognitix_erp_deploy YOUR_SSH_USER@YOUR_SERVER_IP
5.3 GitHub Secrets
GitHub → Settings → Secrets and variables → Actions → New repository secret
| Secret name | Value |
|---|---|
DEPLOY_HOST | YOUR_SERVER_IP |
DEPLOY_USER | YOUR_SSH_USER |
DEPLOY_PATH | /var/www/cognitix-erp |
DEPLOY_SSH_KEY | Full private key text (-----BEGIN OPENSSH PRIVATE KEY----- …) |
Copy private key (PowerShell):
Get-Content .\deploy\hetzner\deploy-keys\cognitix_erp_deploy -Raw | Set-Clipboard
5.4 GitHub Environment
Settings → Environments → New environment → name: production
(The workflow uses environment: production.)
5.5 Allow CI to restart the API (once on server)
sudo visudo -f /etc/sudoers.d/cognitix-erp-deploy
One line (use your SSH user):
YOUR_SSH_USER ALL=(ALL) NOPASSWD: /bin/systemctl restart cognitix-api
sudo -n systemctl restart cognitix-api
5.6 Commit Licensing DLLs + run deploy
git add -f lib/Cognitix.Licensing/*.dll
git add .github/workflows/deploy.yml
git commit -m "Include Licensing DLLs for CI builds."
git push
Then: GitHub → Actions → Deploy → Run workflow (or push to main/master).
cognitix-api active → health HTTP 200.
5.7 What CI does / does not do
- Builds API + WebApp and copies files to the server
- Restarts
cognitix-api - Does not overwrite
appsettings.Production.json(keep secrets on the server) - Does not delete
wwwroot/uploads(logos stay)
More detail: deploy/hetzner/README.md
6. Setup Wizard after first deploy
- Open
https://yourcompany.com/setup - Step 1 — company name, Frontend URL + API URL = site origin, pick SQL Server / PostgreSQL / MySQL, create DB
- Step 2 — create admin user (no default password ships)
- Step 3 — Envato purchase code or 14-day trial (Production needs internet + CognitiveCircle keys)
- Login at
https://yourcompany.com/users/login
7. Go-live checks
curl -i https://yourcompany.com/api/system/health
curl -i -H "Host: localhost" http://127.0.0.1:5100/api/system/health
- Site loads over HTTPS
- Login works with your admin account
- Company logo loads (needs nginx
/uploads/) - License status is Trial or Active (not DevelopmentSkipped)
Problems? See Troubleshooting FAQ.
8. Windows IIS (short)
- Install .NET 10 Hosting Bundle + URL Rewrite
- One HTTPS site for
yourcompany.com - Serve WebApp static files; reverse-proxy
/api/,/uploads/,/chat-hubto the API (same idea as nginx) - Set
ASPNETCORE_ENVIRONMENT=ProductionandCOGNITIX_JWT_KEY - Use the same URL table from section 2
For most buyers, Linux + nginx + optional GitHub Actions is simpler.
9. Please Contact us
- Sign up at https://cognitivebd.com
- Create a Support Ticket.
- Within 48hr we will reply.
Or email support@cognitivebd.com with your purchase code, version, and screenshots/logs.
Production Deployment