LogoLogo
Github
  • πŸš€Getting Started
    • Platform Installation
  • Platform
    • πŸ‘–Pocketbase
    • πŸ“‚Projects
    • πŸ“ƒBlueprints
    • 🟒Deployments
    • πŸ—ΊοΈMap
    • ⏱️Rollouts
    • πŸ’ΎImage
    • ↔️Scale
    • πŸ”€Network
    • πŸ’ΏVolumes
    • πŸ”Envs & Secrets
  • Operator manual
    • πŸ—οΈArchitecture
    • πŸ”§Setup Guide
    • 🧬CRD
  • additional resources
    • πŸ‘©β€πŸ’»Examples
      • Prebuilt Applications
      • Builds
Powered by GitBook

Partners

  • Natron Tech
  • Bern University of applied science
  • GitBook

All rights reserved.

On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Platform

Pocketbase

PreviousPlatform InstallationNextProjects

Last updated 12 months ago

Was this helpful?

One-Click uses the open source backend to achieve things like authentication and storing data. It also serves the frontend of One-Click. In the release process the pocketbase and frontend code will get compiled and put into a single container image and pushed to the Github container registry.

Pocketbase offers the ability to extend it with our own golang code. You can listen on certain events and then execute code. We use that to make the Kubernetes api calls and manage the Kubernetes resources created via the frontend interface.

You can find the code under the following link:

Authentication

Pocketbase uses JWT tokens for authentication. The frontend sends a request to the pocketbase backend with the user credentials. The backend then checks if the user exists and if the password is correct. If everything is correct, the backend will return a JWT token. The frontend will then store this token in the local storage and use it for every request to the backend.

We also support the ability to use the following authentication providers:

  • Google

  • Github

  • Microsoft

The frontend will automatically display the login buttons for these providers if they are enabled in the pocketbase backend.

Database UML

Endpoints

Pocketbase allows you to create custom endpoints. These endpoints can be used to execute custom code. We use this feature to serve everything to the frontend. The custom endpoints are written in golang and you can find them in the main.go file under the app.OnBeforeServe().Add(func(e *core.ServeEvent) error { function.

Table

Endpoint
Method
Description

/

*

Serves the frontend

/api

*

Serves the backend

/_

*

Serves the backend

/rollouts/:projectId/:rolloutId/status

GET

Get rollout status

/rollouts/:projectId/:rolloutId/metrics

GET

Get rollout metrics

/rollouts/:projectId/:rolloutId/events

GET

Get rollout events

/rollouts/:projectId/:podName/logs

GET

Get pod logs

/pb/blueprints/:blueprintId

GET

Get blueprint

/pb/blueprints/shared/:blueprintId

POST

Share blueprint

/auto-update/:autoUpdateId

POST

Auto update

/cluster-info

GET

Get cluster info

/rollouts/:projectId/:podName

DELETE

Delete pod

/ws/k8s/rollouts

GET

Websocket to get resource updates of a rollout

/ws/k8s/logs

GET

Websocket to get pod logs

/ws/k8s/events

GET

Websocket to get pod events

All endpoints are protected by the JWT authentication, except the websocket endpoints. The frontend will send the JWT token in the header of the request.

Environment Variables

Variable Name
Default
Description

LOCAL

false

Set to true if you're running KubeLab locally. It will take your local kubeconfig under .kube/config

LOCAL_KUBECONFIG_FILE

~/.kube/config

Set to the path of your kubeconfig file if you're running KubeLab locally. It will take your local kubeconfig under the specified path

CronTick

*/1 * * * *

The tick in cron notation at which the auto image update will check for new updates in the registry. Do not change this under 1min

Extended Information

Generated with the tool.

For more information about pocketbase, please visit the . Also dig into the source code of our implementations and try to understand how we use pocketbase in our project.

πŸ‘–
PocketBaseUML
official documentation
pocketbase
https://github.com/janlauber/one-click/tree/main/pocketbase
pocketbase settings
UML

Get the status of a specific deployment

get
Authorizations
Path parameters
projectIdstringRequired
deploymentIdstringRequired
Responses
200
Deployment status
application/json
404
Deployment not found
get
GET /api/pb/{projectId}/{deploymentId}/status HTTP/1.1
Host: example.com
Accept: */*
{
  "replicas": 1,
  "podNames": [
    "text"
  ],
  "resources": {
    "requestSum": {
      "cpu": "text",
      "memory": "text"
    },
    "limitSum": {
      "cpu": "text",
      "memory": "text"
    }
  },
  "status": "text"
}

Get metrics for a specific deployment

get
Authorizations
Path parameters
projectIdstringRequired
deploymentIdstringRequired
Responses
200
Deployment metrics
application/json
404
Deployment not found
get
GET /api/pb/{projectId}/{deploymentId}/metrics HTTP/1.1
Host: example.com
Accept: */*
{
  "metrics": [
    {
      "name": "text",
      "cpu": "text",
      "memory": "text"
    }
  ]
}

Get events for a specific deployment

get
Authorizations
Path parameters
projectIdstringRequired
deploymentIdstringRequired
Responses
200
Events list for the deployment
application/json
404
Deployment not found
get
GET /api/pb/{projectId}/{deploymentId}/events HTTP/1.1
Host: example.com
Accept: */*
{
  "events": [
    {
      "reason": "text",
      "message": "text",
      "typus": "text"
    }
  ]
}

Get logs for a specific pod

get
Authorizations
Path parameters
projectIdstringRequired
podNamestringRequired
Responses
200
Pod logs
application/text
404
Pod not found
get
GET /api/pb/{projectId}/{podName}/logs HTTP/1.1
Host: example.com
Accept: */*
{
  "logs": "text"
}

Retrieve a blueprint by ID

get
Authorizations
Path parameters
blueprintIdstringRequired
Responses
200
Blueprint details
application/json
404
Blueprint not found
get
GET /api/pb/blueprints/{blueprintId} HTTP/1.1
Host: example.com
Accept: */*
{
  "id": "text",
  "details": "text"
}

Share a blueprint

post
Authorizations
Path parameters
blueprintIdstringRequired
Responses
200
Blueprint shared successfully
application/json
404
Blueprint not found
post
POST /api/pb/blueprints/shared/{blueprintId} HTTP/1.1
Host: example.com
Accept: */*
{
  "message": "text"
}

Trigger an automatic update

post
Authorizations
Path parameters
autoUpdateIdstringRequired
Responses
200
Update initiated
application/json
post
POST /api/pb/auto-update/{autoUpdateId} HTTP/1.1
Host: example.com
Accept: */*
200

Update initiated

{
  "status": "text"
}

Retrieve cluster information

get
Authorizations
Responses
200
Cluster information
application/json
get
GET /api/pb/cluster-info HTTP/1.1
Host: example.com
Accept: */*
200

Cluster information

{
  "clusterId": "text",
  "status": "text"
}

Delete a specific pod

delete
Authorizations
Path parameters
projectIdstringRequired
podNamestringRequired
Responses
204
Pod deleted successfully
404
Pod not found
delete
DELETE /api/pb/{projectId}/{podName} HTTP/1.1
Host: example.com
Accept: */*

No content

Open a WebSocket to receive live deployment updates

get
Authorizations
Responses
101
WebSocket connection established
get
GET /api/ws/k8s/deployments HTTP/1.1
Host: example.com
Accept: */*
101

WebSocket connection established

No content

Open a WebSocket to receive live logs from pods

get
Authorizations
Responses
101
WebSocket connection established
get
GET /api/ws/k8s/logs HTTP/1.1
Host: example.com
Accept: */*
101

WebSocket connection established

No content

Open a WebSocket to receive live events from deployments

get
Authorizations
Responses
101
WebSocket connection established
get
GET /api/ws/k8s/events HTTP/1.1
Host: example.com
Accept: */*
101

WebSocket connection established

No content

  • Authentication
  • Database UML
  • Endpoints
  • GETGet the status of a specific deployment
  • GETGet metrics for a specific deployment
  • GETGet events for a specific deployment
  • GETGet logs for a specific pod
  • GETRetrieve a blueprint by ID
  • POSTShare a blueprint
  • POSTTrigger an automatic update
  • GETRetrieve cluster information
  • DELETEDelete a specific pod
  • GETOpen a WebSocket to receive live deployment updates
  • GETOpen a WebSocket to receive live logs from pods
  • GETOpen a WebSocket to receive live events from deployments
  • Environment Variables
  • Extended Information