Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
japsu committed Dec 30, 2023
0 parents commit f95a5c5
Show file tree
Hide file tree
Showing 9 changed files with 805 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: cicd

on:
push:
branches:
- main

jobs:
deploy:
runs-on: self-hosted
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- id: cache-bin
uses: actions/cache@v3
with:
path: bin
key: ${{ runner.os }}-bin-2
- if: steps.cache-bin.outputs.cache-hit != 'true'
run: |
mkdir bin
curl -Lo bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
curl -Lo bin/kubectl https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl
chmod +x bin/skaffold bin/kubectl
- run: echo "$PWD/bin" >> $GITHUB_PATH

- run: |
npm ci
cd kubernetes && ENV=production npx ts-node manifest.ts && cd ..
skaffold run -n rallly
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Con2 Kubernetes deployment of Rallly

[Rallly](https://github.com/lukevella/rallly) is a tool to, according to them,

> Schedule group meetings with friends, colleagues and teams. Create meeting polls to find the best date and time to organize an event based on your participants' availability. Save time and avoid back-and-forth emails.
This repository provides a Kubernetes deployment of Rallly that is setup to authenticate against [Kompassi](https://github.com/con2/kompassi) using OIDC.

User friendly redirects to `rallly.con2.fi` (such as `rally.con2.fi`) are managed under [redirects](https://github.com/con2/redirects). (Note that in every other instance of `rallly` there are three lower-case L letters.)

## Getting started

Requirements:

* A Kubernetes cluster
* [Skaffold](https://skaffold.dev)
* Node.js (tested: 20, 21)

For a macOS workstation using Homebrew, install local dependencies using

brew install skaffold kubernetes-cli node
npm install

Generate Kubernetes manifests using

npm run k8s:generate

This runs the `kubernetes/manifest.ts` that is intended to be a brutally simple Node.js program with no other dependencies than `fs`. It accepts one environment variable, `ENV`, with the values `dev` (the default) and `production`, and outputs Kubernetes manifests as JSON files in the directory it was run.

Test with Skaffold (with Docker Desktop or similar local Kubernetes cluster):

npm run k8s:dev

Assuming you have an [ingress controller set up](https://outline.con2.fi/doc/ingress-controller-XfVUOHtp2t#h-installing-an-ingress-controller-for-local-development), you should now be able to view the UI at http://rallly.localhost.

For staging and production, deployment is done in two steps using Skaffold:

cd kubernetes && ENV=staging npx ts-node manifest.ts && cd -
skaffold run -n rallly

See `skaffold.yaml` in the repository root.

You should, for the most part, not deploy manually. GitHub Actions CI/CD is set up to deploy all commits to `main` into the staging environment at https://v2.dev.kompassi.eu, and after a manual gate into production at https://v2.kompassi.eu. See `.github/workflows/cicd.yaml`.
1 change: 1 addition & 0 deletions kubernetes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json
Loading

0 comments on commit f95a5c5

Please sign in to comment.