Skip to content

Build mytoken From Source

Building mytoken from source is more complicated than installing it from a packaged release. In the following we describe the necessary steps.

Prerequisites

Go

Please refer to the golang documentation on how to install go on your system. Be aware that your distribution might provide a golang package for easier installation. However, when installing from your distribution's package ensure that the provided version is recent enough.

Version

The required go version is at least 1.25.1

Node.js

Please refer to the nodejs documentation on how to install nodejs on your system. Be aware that your distribution might provide a nodejs package for easier installation. However, when installing from your distribution's package ensure that the provided version is recent enough.

Version

The required nodejs version is at least 22

Get the source code

You can either clone the repository or download a release archive:

Clone the repository:

git clone https://github.com/oidc-mytoken/server
cd server

Or download a release archive:

# Download the latest release from https://github.com/oidc-mytoken/server/releases
wget https://github.com/oidc-mytoken/server/archive/v<VERSION>.tar.gz
tar -xzf v<VERSION>.tar.gz
cd server-<VERSION>

Or download the prerel (pre-release) branch:

wget https://github.com/oidc-mytoken/server/archive/prerel.tar.gz
tar -xzf prerel.tar.gz
cd server-prerel

Build Binaries

The mytoken server comes with three binaries:

  • mytoken-server: The actual mytoken server
  • mytoken-setup: Setup utility (includes database migration functionality)
  • mytoken-notifier-server: Standalone notifier server (only needed if notifications feature is enabled and you want to use a dedicated notifier server instead of the integrated one)

Development build

./scripts/dev.sh

This builds the frontend and runs the server in development mode.

Manual build

Building mytoken-server consists of two steps: building the frontend, and then the go binary.

Build the Frontend

First build the frontend:

./scripts/build-frontend.sh
# or manually:
cd frontend && npm run build

The built frontend will be placed in internal/server/spa/dist/ and served by the mytoken server.

Go Build

Then build the server and other tools:

go build ./cmd/mytoken-server
go build ./cmd/mytoken-server/mytoken-setup
go build ./cmd/mytoken-server/mytoken-notifier-server

This will place the binaries in your current working directory.

Release builds

Use GoReleaser for building releases and packages.

Installation

Manual installation requires additional steps.

Create the relevant directories

The following directories are needed by mytoken and normally created by the distribution's package. You now have to create these manually.

Create the directory for the configuration file:

mkdir /etc/mytoken

Create a directory where the log files are stored:

mkdir /var/log/mytoken

Copy the example configuration

Copy the example configuration file to the created configuration directory:

cp config/example-config.yaml /etc/mytoken/

Create a service file (optional)

Create a file called /etc/systemd/system/mytoken.service with the following content (matching the one in config/mytoken.service):

[Unit]
Description=mytoken
After=network.target auditd.service

[Service]
ExecStart=/usr/bin/mytoken-server
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/
StandardOutput  inherit
StandardError inherit
KillMode=process
Restart=always
RestartPreventExitStatus=255
Type=simple

[Install]
WantedBy=multi-user.target

Adapt to your needs

ExecStart should point to your mytoken-server binary.

Setup and Configuration

For the remaining configuration please refer to the Deployment Guide starting at section 'Configuration'.


Last update: April 16, 2026 11:57:50
Back to top