Skip to content

cyberkeygen CyberKeyGen

CyberKeyGen is used as a simple password generator.

🛠 Installation

Default Port: 8080

Configuration path: /opt/cyberkeygen

For this installation of CyberKeyGen, the LXC is used to both build and serve the static site. The reason for this to make it easier to build and deploy the site after an update.

npm and vite are used to build the site and an nginx Docker container is used to serve the site.

(
  apt install npm
  git clone https://github.com/karthik558/CyberKeyGen.git /opt/cyberkeygen
  npm install --prefix /opt/cyberkeygen -D vite
  npm run --prefix /opt/cyberkeygen build
  docker run -it --rm -d -p 8080:80 --name web -v /opt/cyberkeygen/dist:/usr/share/nginx/html nginx
)

âš™ Config

They CyberKeyGen source repo is stored in the /opt/cyberkeygen directory and the distribution files are stored in the /opt/cyberkeygen/dist directory after build.

homelab/docker/cyberkeygen/.env

CONFIG_DIR=/opt/cyberkeygen/dist
INSTALL_DIR=/opt/cyberkeygen
CONTAINER_NAME=cyberkeygen
homelab/docker/cyberkeygen/compose.yaml
---
services:
  cyberkeygen:
    container_name: "${CONTAINER_NAME}"
    image: "nginx:1.28.0"
    env_file:
      - .env
    ports:
      - '8080:80'
    restart: always
    volumes:
      - "${CONFIG_DIR}:/usr/share/nginx/html"

Traefik

homelab/pve/traefik/conf.d/cyberkeygen.yaml
---
http:
 #region routers 
  routers:
    cyberkeygen:
      entryPoints:
        - "websecure"
      rule: "Host(`cyberkeygen.l.nicholaswilde.io`)"
      middlewares:
        - default-headers@file
        - https-redirectscheme@file
      tls: {}
      service: cyberkeygen
#endregion
#region services
  services:
    cyberkeygen:
      loadBalancer:
        servers:
          - url: "http://192.168.2.104:8080"
        passHostHeader: true
#endregion

🚀 Upgrade

To upgrade the CyberKeyGen app, the source repo is pulled and then rebuilt.

The nginx Docker image is managed by Renovate and so and so after a Renovate PR is merged into this repo, this repo is pulled and the Docker container is pulled and restarted.

Warning

The below commands purge any unused Docker images! Use at your own risk!

homelab/docker/cyberkeygen

task upgrade
(
  git pull origin
  git -C /opt/cyberkeygen pull origin
  npm run --prefix /opt/cyberkeygen build
  docker compose up --force-recreate --build -d
  docker image prune -a -f
)

Task List

task: Available tasks for this project:
* build:          Build
* decrypt:        Decrypt .env using SOPS
* deps:           Install dependencies
* encrypt:        Encrypt .env using SOPS
* export:         Export the task list
* init:           Init everything
* init-env:       Init .env file
* pull:           Pull docker images
* restart:        Restart Docker containers
* status:         Docker container status
* stop:           Stop Docker containers
* up:             Run Docker compose in the foreground.
* up-d:           Run Docker compose in the background.
* update:         Update running containers
* upgrade:        Upgrade Docker containers
* watch:          Watch Docker container logs

🔗 References