Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: make
run: make
working-directory: ./ninjam/server
- name: target
run: mkdir target
working-directory: ./ninjam/server
- name: copy-ninjamsrv
run: cp ninjamsrv ./target/
working-directory: ./ninjam/server
- name: copy-cfg
run: cp example.cfg ./target/config.cfg
working-directory: ./ninjam/server
- name: copy-licence
run: cp cclicense.txt ./target/cclicense.txt
working-directory: ./ninjam/server
- name: tar-gz
run: tar -czvf ninjam.tar.gz -C target .
working-directory: ./ninjam/server/
- uses: actions/upload-artifact@v4
with:
name: ninjamsrv
path: ./ninjam/server/target
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./ninjam/server/ninjam.tar.gz
asset_name: ninjam.tar.gz
asset_content_type: application/zip
13 changes: 13 additions & 0 deletions ninjam/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:latest

ENV PATH /usr/local/ninjam:$PATH
ARG TAG
ADD https://github.com/zeppelinux/ninjam/releases/download/${TAG}/ninjam.tar.gz /var/tmp/

RUN mkdir -p /var/tmp/ninjam && tar -xzf /var/tmp/ninjam.tar.gz -C /var/tmp/ninjam && rm /var/tmp/ninjam.tar.gz && mv /var/tmp/ninjam /usr/local/
WORKDIR /usr/local/ninjam
# forward request and error logs to docker log collector
#RUN ln -sf /dev/stdout ./ninjamserver.log

EXPOSE 2049
ENTRYPOINT ["ninjamsrv", "config.cfg"]
2 changes: 1 addition & 1 deletion ninjam/server/example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DefaultBPI 8
# write PID file (non-windows version only)
# PIDFile ninjamserver.pid

# LogFile ninjamserver.log
LogFile ninjamserver.log


# set keep-alive interval in seconds. should probably not bother
Expand Down
5 changes: 5 additions & 0 deletions ninjam/server/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: ninjam-server
version: 0.1.0
Empty file.
32 changes: 32 additions & 0 deletions ninjam/server/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "ninjam-server.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ninjam-server.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ninjam-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
72 changes: 72 additions & 0 deletions ninjam/server/helm/templates/config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "ninjam-server.fullname" . }}
labels:
app: {{ template "ninjam-server.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
config.cfg: |
# only one port line allowed (last one will be used)
# these are comments
Port 2049

# limit connections of normal users to 10
MaxUsers 10

# limit normal users to 32 channels each, anonymous users to 2
MaxChannels 32 2

ServerLicense cclicense.txt

#anonymoususers yes or no, or multi (to allow multiple users of the same name from the same IP)
AnonymousUsers no
AnonymousUsersCanChat yes
AnonymousMaskIP yes # shows just the nn.nn.nn.x instead of full IP.


AllowHiddenUsers no # set to yes to allow people without channels to not appear in the user list


#ACL list lets you specify in order a list, first match is used
ACL 10.0.0.0/8 deny
ACL 192.168.0.0/16 reserve # reserve slots for local
ACL 0.0.0.0/0 allow # allow all


#user/password/permissions sets
User administrator myadminpass * # allow all functions
User booga anotherpass CBTKRM # allow chat, bpm/bpi, topic changing, and kicking, a reserved slot, and multiple logins
User myuser mypass # allow default functions (chat, no topic)

# optional user/pass with simple status retrieving permissions (this also has the advantage of having the server do less work)
# StatusUserPass username password

DefaultTopic "Welcome to NINJAM. Please play nicely."
DefaultBPM 120
DefaultBPI 8

# two parameters: path to log to, and session length (in minutes). 0 for length means 30 seconds.
# if the first parameter (path) is empty, no logging is done
# SessionArchive . 15


# these two require a full restart to update:

# write PID file (non-windows version only)
# PIDFile ninjamserver.pid

# LogFile ninjamserver.log


# set keep-alive interval in seconds. should probably not bother
# specifying this, the default is 3, which is adequate.
# SetKeepAlive 3

# voting system:
# SetVotingThreshold 50 # sets threshold to 50%. can be 1-100%, or >100 to disable
# SetVotingVoteTimeout 60 # sets timeout before votes are reset, in seconds

# MOTDFile motd.txt # send this text as a privmsg to all users when they connect
51 changes: 51 additions & 0 deletions ninjam/server/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "ninjam-server.fullname" . }}
labels:
app: {{ template "ninjam-server.name" . }}
chart: {{ template "ninjam-server.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "ninjam-server.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "ninjam-server.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config-volume
mountPath: /usr/local/ninjam/config.cfg
subPath: config.cfg
ports:
- name: ninjam-tcp
containerPort: 2049
protocol: TCP
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ template "ninjam-server.fullname" . }}
19 changes: 19 additions & 0 deletions ninjam/server/helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "ninjam-server.fullname" . }}
labels:
app: {{ template "ninjam-server.name" . }}
chart: {{ template "ninjam-server.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: ninjam-tcp
protocol: TCP
name: open
selector:
app: {{ template "ninjam-server.fullname" . }}
release: {{ .Release.Name }}
29 changes: 29 additions & 0 deletions ninjam/server/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Default values for teamcity.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
repository: zeppelinux/ninjam-server
tag: v0.081
pullPolicy: IfNotPresent

service:
type: ClusterIP
port: 2049

# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 800m
# memory: 968Mi
# requests:
# cpu: 600m
# memory: 968Mi

nodeSelector: {}

tolerations: []

affinity: {}
3 changes: 3 additions & 0 deletions ninjam/server/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build --build-arg TAG=$DOCKER_TAG -t $IMAGE_NAME .