Giter Club home page Giter Club logo

zskarte-server's Introduction

๐Ÿš€ Getting started with Strapi

Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.

develop

Start your Strapi application with autoReload enabled. Learn more

yarn dev

start

Start your Strapi application with autoReload disabled. Learn more

yarn start

build

Build your admin panel. Learn more

yarn build

Supporting Tools for Development

Different containerized services to use in the development process like postgresql and pgadmn

Linux prerequisites

# Create the data/postgresql folder
mkdir -p data/postgresql
# Add the UID 1001 (non-root user of postgresql) as the folder owner
chown -R 1001:1001 data/postgresql

Docker-Compose

This will startup a local postgresDB with a RDMS system (pgadmin).

Start

# docker version < 20.10.x
docker-compose up -d
# docker version >= 20.10.x
docker compose up -d

๐Ÿ’ก If you have trouble with the creation of the containers use: docker compose up -d --force-recreate

Stop

# docker version < 20.10.x
docker-compose down
# docker version >= 20.10.x
docker compose down

PGAdmin

A postgresql databas management tool

  • PostgreSQL:
    • User: postgres
    • Password: supersecret123

Create a database

  1. Open pgadmin
  2. Login
  3. Add Server (right click on Servers)
    • Register -> Server
      • Name: postgres-local
      • Host: postgresql-zskarte
      • Port: 5432
      • Username: postgres
      • Password: supersecret123
      • Save-Password: yes
  4. Create database (right click on Servers -> Server -> Databases)
    • Create -> Database
      • Name: zskarte

Persist database connections

# Execute inside pgadmin docker container
docker exec -it pgadmin sh
# Dump Actual connections into servers.json file to
/venv/bin/python setup.py --dump-servers servers.json --user [email protected]

Seed data & set up authorization

The application needs some data in order to work propperly. Curently, there is no seeding mechanism for an example organization. Follow those steps to create one:

  1. Create an organization
    • Content Manager -> Organisation -> Create new entry
  2. Create an user for the organization
    • Content Manager -> User -> Create new entry
      • Add role "Authenticated"
      • Add organization (the one created in step 1)
  3. Set permissions for "Authenticated" role
    • Settings -> User & Permissions Plugin -> Roles -> Authenticated
      • Give all rights on Organization
      • Give all rights on Operation

Environment Variables

An .env file has to be located inside the root folder for the application to start. There is an example .env file in the repo called ".env.example". For local development only, you can use the example file (rename it to ".env").

Azure

Kubernetes Connect

Connect to the AKS cluster with the following commands

# Install azure cli on MAC
brew update && brew install azure-cli

az login
az aks get-credentials --subscription zskarte --resource-group zskare --name zskare-aks --admin
# Switch your kubeconfig context (install kubectx first)
kubectx zskarte-aks-admin
# Switch to Test namespace (kubens doesn't work)
kubectl config set-context --current --namespace zskarte-test
# Switch to Prod namespace (kubens doesn't work)
kubectl config set-context --current --namespace zskarte-prod

Connect to pgadmin on AKS

kubectl port-forward service/pgadmin 7050:80

Cheap AKS Cluster

https://georgepaw.medium.com/how-to-run-the-cheapest-kubernetes-cluster-at-1-per-day-tutorial-9673f062b903

# Fill env variables
export SUBSCRIPTION=66961ec5-0870-43fb-a5cc-35e73d6d49d2
export LOCATION=switzerlandnorth
export RESOURCE_GROUP=zskarte
export AKS_CLUSTER=zskarte-aks
export VM_SIZE=Standard_B2s

# Create SSH key pair to login to instance in the future filename: zskarte
ssh-keygen -t rsa -b 4096 -C "zskarte"

# Create resource group
az group create --name $RESOURCE_GROUP \
		--subscription $SUBSCRIPTION \
		--location $LOCATION

# Create a basic single-node AKS cluster
az aks create \
	--subscription $SUBSCRIPTION \
	--resource-group $RESOURCE_GROUP \
	--name $AKS_CLUSTER \
	--vm-set-type VirtualMachineScaleSets \
	--node-count 1 \
	--ssh-key-value zskarte.pub \
	--load-balancer-sku basic \
	--enable-cluster-autoscaler \
	--min-count 1 \
	--max-count 1 \
    --node-vm-size $VM_SIZE \
    --nodepool-name default \
    --node-osdisk-size 32 \
    --node-osdisk-type managed

# Get credentials of AKS cluster
az aks get-credentials \
	--subscription $SUBSCRIPTION \
	--resource-group $RESOURCE_GROUP \
	--name $AKS_CLUSTER \
    --admin

Disable AKS SLA

AKSResourceID=$(az aks show --subscription $SUBSCRIPTION --name $AKS_CLUSTER --resource-group $RESOURCE_GROUP --query id -o tsv)
az resource update --ids $AKSResourceID --subscription $SUBSCRIPTION --set sku.tier="Free"

Helm add Bitnami repo

helm repo add bitnami https://charts.bitnami.com/bitnami

Install NGINX Ingress

helm upgrade --install nginx-ingress-controller bitnami/nginx-ingress-controller --create-namespace -n nginx-ingress-controller -f .azure/aks/nginx/values.yml

Install Cert-Manager

helm upgrade --install cert-manager bitnami/cert-manager --create-namespace -n cert-manager -f .azure/aks/cert-manager/values.yml
kubectl apply -f .azure/aks/cert-manager/letsencrpyt-staging.yml
kubectl apply -f .azure/aks/cert-manager/letsencrpyt-prod.yml

zskarte-server's People

Contributors

dfseifert avatar gobeli avatar lazulitee avatar lucamuh avatar switzerchees avatar thegnuu avatar zskarte-admin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

swerder

zskarte-server's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.