Files
projectmycelium/docs/ops/method/current/deployment_method.md
2025-09-01 21:37:01 -04:00

109 lines
3.2 KiB
Markdown

# Project Mycelium Ops Method
## Introduction
We present simple CLI tools to deploy the Project Mycelium.
## Tools
You can use quick utility tools gits from ucli and pal from scottyeager (see https://github.com/ucli-tools, https://github.com/scottyeager/pal)
- When any step is confirmed to work, save as version management control
```
git add . && pal /commit --yolo && git push
```
- To push as a PR when many commits create a whole step/task in the roadmap/todo
```
gits pr create --title 'Update' --base development && gits pr merge --pr-number $(gits pr-latest)
```
- To update the website from e.g. development using Makefile
```
make update-dev
```
- This will ssh into the server hosting the marketplace on dev and prod (dev.threefold.pro, threefold.pro)
## Prerequisites
- git, make
- Docker or Podman (if containerizing locally)
- SSH access to deployment hosts (dev/prod)
- kubectl/helm if deploying to Kubernetes
- Config/secrets available (Stripe keys, PostgREST endpoint, DB credentials)
## Environments
- Dev: dev.threefold.pro
- Prod: threefold.pro
## Configuration
- Environment variables (examples):
- STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY
- POSTGREST_URL
- DATABASE_URL or connection parameters
- APP_ENV (development|production)
- Provide via .env files, system service env files, or Kubernetes Secrets as appropriate.
## Deployment Flows
- Local
- Build/run the app locally; verify basic UI and flows.
- Dev
- Use: `make update-dev` (as provided above)
- Verify deployment (see Verification)
- Prod
- Follow the same deployment pattern as dev against prod host or use corresponding prod target if defined.
## Verification
- Health: open the site on the target environment (dev.threefold.pro or threefold.pro)
- Basic smoke:
- Load homepage and key pages
- Add item to cart
- Run a test checkout with Stripe test keys (on dev)
## Rollback
- Identify last known good commit/tag
- Revert: `git revert <commit>` or checkout the tag/commit
- Redeploy using the same steps (e.g., `make update-dev`)
## Operations
- Logs: inspect application/server logs on target hosts; if running on Kubernetes, use `kubectl logs`
- Monitoring: confirm metrics/alerts if configured
- Backups: ensure regular DB and config backups and test restore procedures
## Troubleshooting
- Missing/incorrect env vars → verify configuration section
- SSH failures → validate keys and host reachability
- Stripe errors → confirm test vs live keys per environment
## Standard git equivalents
- Save work (equivalent to pal):
```
git add -A && git commit -m "<message>" && git push
```
- Create a PR: push your branch and open a PR on your Git hosting provider targeting `development` (or relevant branch)
## Checklists
- Pre-deploy: correct branch, env config present, backup taken (if needed)
- Post-deploy: site loads, smoke tests pass, logs clean of new errors
## References
- Dev design method: `../../../dev/method/current/design_method.md`
- DevOps overview: `../../../devops.md`
- Architecture & Roadmap: `../../../dev/design/current/projectmycelium-roadmap.md`
```mermaid
flowchart LR
Local[Local] --> Dev[Dev]
Dev --> Prod[Prod]
Dev -. smoke/verify .-> Dev
Prod -. checks .-> Prod
```