Skip to content

An api skeleton using mongodb for chubbyts-framework.

License

Notifications You must be signed in to change notification settings

chubbyts/chubbyts-petstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chubbyts-petstore

CI Coverage Status Mutation testing badge

bugs code_smells coverage duplicated_lines_density ncloc sqale_rating alert_status reliability_rating security_rating sqale_index vulnerabilities

Description

An api skeleton using mongodb for chubbyts-framework.

Requirements

Environment

Add the following environment variable to your system, for example within ~/.bashrc:

export USER_ID=$(id -u)
export GROUP_ID=$(id -g)

Docker

docker-compose up -d
docker-compose exec node bash

Start

pnpm start

Urls

Pet

Structure

Command

Commands is code that is meant to be executed on command line.

Handler

Handler alias Controller, or Controller actions to be more precise.

Model

Models, entities, documents what ever fits your purpose the best.

Repository

Repositories get data from storages like databases, opensearch, redis or whereever your models are stored or cached.

ServiceFactory

Service factories are the glue code of the dependeny injection container.

Deployment

Setup

Deployment

cd pulumi
pnpm install
pulumi config set digitalocean:token XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:cert-manager-email XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:ip-range 10.10.11.0/24
pulumi config set chubbyts-petstore:k8s-node-Count: "1"
pulumi config set chubbyts-petstore:mongodb-node-Count: "1"
pulumi config set chubbyts-petstore:opensearch-node-Count: "1"
pulumi up

Docker registry login

doctl registry login

Kubectl config

doctl kubernetes clusters list
doctl kubernetes clusters kubeconfig save <clustername>

Important kubectl commands

# lists all deployments: container definition(s) which provide(s) howto start a pod
kubectl get deployments

# show the current deployment definition
kubectl get deployment <deploymentname> -o yaml

# edit the current deployment defintion (should be done via code change and pulumi up, and not inline)
kubectl edit deployment <deploymentname>

# lists all pods: container(s) which provide(s) one application for example the cms
kubectl get pods

# show the current pod definition (do not edit!)
kubectl get pod <podname> -o yaml

# enter a pod
kubectl exec -it <podname> -- /bin/bash

Debug production build

Make sure the development version is running to reuse its mongodb instance.

docker build --platform=linux/amd64 -f ./docker/production/node/Dockerfile -t chubbyts-petstore-node .
docker run -it -e NODE_ENV=production -e MONGO_URI="<see docker-compose.yml, replace @mongo with @host.docker.internal>" -e SERVER_HOST=0.0.0.0 -e SERVER_PORT=3000 -p 3000:3000 chubbyts-petstore-node

Copyright

2024 Dominik Zogg

About

An api skeleton using mongodb for chubbyts-framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published