-
Notifications
You must be signed in to change notification settings - Fork 0
Add Network and server infrastructure information #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TheUsernameOrSmth
merged 16 commits into
main
from
docs/network-and-server-infrastructure-update
Aug 23, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
de7f95d
Network and server infrastructure
TheUsernameOrSmth 8c54915
Rewrite docker guide
Fripe070 6c6cd39
Added Andesite docs
TheUsernameOrSmth e90d90b
Add docs for context specifier
TheUsernameOrSmth f9c22be
rename docker to containers
Fripe070 68a53b7
Polish traefik docs with auth methods in separate tabs
Fripe070 73130bd
Expose steps components for mdx by default
Fripe070 639ab2c
Proofreading fixes yay
Fripe070 cb11f95
Rewrite tons of the SSO/Authentik docs
Fripe070 76242d6
Rewrite network page
Fripe070 24e3656
polish
Fripe070 8f99daf
Some extra things
TheUsernameOrSmth 2962fbb
Merge remote-tracking branch 'origin/main' into docs/network-and-serv…
Fripe070 58b978d
Apply changes suggested by review
Fripe070 5eb09bb
Slightly clarify/reword login flow
Fripe070 8a0414e
Merge branch 'main' into docs/network-and-server-infrastructure-update
Fripe070 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| title: Containers | ||
| icon: Container | ||
| description: How to run software in containers on the IN-SMN server using Docker Compose | ||
| --- | ||
|
|
||
| <CalloutExt type="note"> | ||
| This page assumes that you have SSH access to the IN-SMN server. It may still | ||
| be useful if you do not have access but are developing software that will be | ||
| deployed to our servers. | ||
| </CalloutExt> | ||
|
|
||
| Almost all software hosted on the IN-SMN server runs in Docker containers managed with [Docker Compose](https://docs.docker.com/compose/). | ||
|
|
||
| Compose files are stored in two main locations: | ||
|
|
||
| - `/root/SMN/docker-compose.yml` contains the configuration for core/static services that do not require automatic updates. | ||
| These include | ||
| [Traefik](./traefik), | ||
| [Authentik](../sso), | ||
| [Mosquitto](https://github.com/eclipse-mosquitto/mosquitto), | ||
| [LMixer](../../locale/software/lmixer), | ||
| and others. | ||
|
|
||
| - `/home/deploy/` holds directories for automatically deployed applications, | ||
| which each have their own Compose file that references a published Docker image. | ||
| For details, see [Automatic deployment](#automatic-deployment). | ||
|
|
||
| If a container hosts a website that should be accessible, it should define labels as detailed on the [Traefik page](./traefik). | ||
|
|
||
| If you change a `docker-compose.yml` file, you can run `docker compose up -d` in its directory to restart only the affected containers. | ||
|
|
||
| ## Automatic deployment | ||
|
|
||
| We use GitHub Actions to automatically build, push, pull, and restart containers | ||
| on the server whenever changes are made to a project repository's main branch. | ||
|
|
||
| Since we pretty much always do the same thing, we have a workflow that is reused. | ||
|
|
||
| To set up automatic deployment: | ||
|
|
||
| <Steps> | ||
| <Step> | ||
| Copy `/home/deploy/example-app` and modify its configuration as needed. | ||
| </Step> | ||
| <Step> | ||
| Copy the [workflow template](https://github.com/itsektionen/andesite) and configure it as detailed in its README. | ||
| </Step> | ||
| <Step> | ||
| The workflow connects to the server over SSH as the `deploy` user. | ||
| Its credentials are stored as secrets in the chapter's [GitHub organization](https://github.com/itsektionen) | ||
| and are exposed to workflows as `SSH_HOST`, `SSH_USERNAME`, and `SSH_KEY`. | ||
|
|
||
| These secrets are made available automatically to workflows running on public repositories. | ||
| If the repository is private, you need to add the SSH credentials manually. | ||
|
|
||
| </Step> | ||
| </Steps> | ||
|
|
||
| ### Configuring Andesite | ||
|
|
||
| Andesite's behavior can be configured using inputs under `jobs.with`. | ||
|
|
||
| **Example:** Enable caching with GHA: | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| secrets: inherit | ||
| with: | ||
| deploy-dir: docs | ||
| cache: "gha" | ||
| gha-mode: "min" | ||
| ``` | ||
|
|
||
| Here is a list of all options and their effects: | ||
|
|
||
| | Key | Type | Default | Description | | ||
| | ---------------------- | -------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | deploy-dir | string | N/A (required) | The folder containing `docker-compose.yaml`, e.g. `/home/deploy/<deploy-dir>/docker-compose.yaml` | | ||
| | context-dir | string | "." | The folder containing the Dockerfile. Use this if it is not in the root directory. Prefix it with `./`, e.g. `./website/` | | ||
| | cache | "gha" or "" | "" | Enables caching during the Docker build step. "gha" caches all intermediate steps. | | ||
| | gha-mode | "min" or "max" | "min" | Controls how aggressively "gha" caching is performed. See [GHA caching mode](https://docs.docker.com/build/cache/backends/#cache-mode) | | ||
| | use-lfs | boolean | false | Whether the repository uses LFS to track files | | ||
| | limit-lfs-to-directory | string | "" | Fetches LFS files only from a specific folder rather than the entire repository. Useful for monorepos | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "title": "IN-SMN", | ||
| "icon": "Server" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| --- | ||
| title: Websites and routing | ||
| icon: TrafficCone | ||
| description: Routing web requests | ||
| --- | ||
|
|
||
| <CalloutExt type="note"> | ||
| This page assumes that you have SSH access to the IN-SMN server. It may still | ||
| be useful if you do not have access but are developing software that will be | ||
| deployed to our servers. | ||
| </CalloutExt> | ||
|
|
||
| We use [Traefik](https://doc.traefik.io/traefik/) to handle routing to our websites and to apply middleware. | ||
| It is usually configured through [container labels](https://doc.traefik.io/traefik/reference/routing-configuration/other-providers/docker/) | ||
| defined in project compose files, with the exception of when we need to route data to [IN-ITK](../servers#server-in-itk). | ||
| {/* TODO: Document yaml config */} In this case we use YAML configs located in `/root/SMN/traefik/conf/`. | ||
|
|
||
| The Traefik admin dashboard is hosted at [traefik.kth.it](https://traefik.kth.it/) for those with access. | ||
|
|
||
| ## Basic configuration | ||
|
|
||
| Most required labels are boilerplate and will not vary significantly between deployments. | ||
| The easiest approach to get up and running is to copy the labels of `/home/deploy/example-app` and modify them to fit the new deployment. | ||
|
|
||
| ## Adding authentication | ||
|
|
||
| There are two types of authentication commonly used for deployments: HTTP Basic Auth and Authentik. | ||
| Both are added by defining middleware with a Traefik label. | ||
| To leave a site available to the entire internet, omit the middleware label. | ||
|
|
||
| <Tabs items={["Authentik", "Basic Auth"]}> | ||
| <Tab value="Authentik"> | ||
| <CalloutExt type="note"> | ||
| To access a site with the Authentik middleware, it must be properly | ||
| configured through the Authentik dashboard. For details, see | ||
| [the SSO docs](../sso#configuration). | ||
| </CalloutExt> | ||
|
|
||
| ```yaml | ||
| # Label | ||
| - "traefik.http.routers.<APP_NAME>.middlewares=authentik@docker" | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab value="Basic Auth"> | ||
| <CalloutExt type="warning"> | ||
| Basic Auth uses shared, static credentials and does not provide per-user | ||
| access control. Use Authentik for sensitive services. | ||
| </CalloutExt> | ||
|
|
||
| ```yaml | ||
| # Label | ||
| - "traefik.http.routers.<APP_NAME>.middlewares=basic-auth@docker" | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## SSL encryption | ||
|
|
||
| We use [Let's Encrypt](https://letsencrypt.org/) to obtain signed SSL certificates. | ||
| Traefik automatically requests these for the domains and subdomains we use. | ||
|
|
||
| Since these certificates are issued per subdomain rather than for all of `*.kth.it`, | ||
| the browser will warn about a self-signed certificate if visiting a subdomain where nothing is served. | ||
|
|
||
| ### Adding new domains | ||
|
|
||
| <Steps> | ||
| <Step> | ||
| Ensure that the DNS record points to IN-SMN. | ||
| This can be checked by pinging both the domain and `server.kth.it` and comparing the IPs. | ||
| You might need to wait a long while for the DNS propagation to finish. | ||
| [Insert meme about DNS propagation being slow] | ||
|
|
||
| Note that for unused `*.kth.it` domains this step is already taken care of. | ||
| </Step> | ||
| <Step> | ||
| Setup the `Host(...)` rule(s) on the traefik configuration. | ||
| </Step> | ||
| <Step> | ||
| Start the container. Traefik will automatically detect the Hosts and request SSL certificates for them. | ||
|
|
||
| These certificates last for 90 days and are automatically renewed. | ||
| </Step> | ||
| </Steps> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| title: Networking | ||
| icon: Network | ||
| description: How data gets to the right place | ||
| --- | ||
|
|
||
| As detailed in [Servers](./servers), the chapter has two main servers in our | ||
| locale: IN-SMN and IN-ITK. IN-SMN is the primary server and runs the vast | ||
| majority of our self-hosted infrastructure and services. IN-ITK is managed by | ||
| [ITK](https://itk.gg) and is primarily used to host game servers with | ||
| [Pterodactyl](https://pterodactyl.io). | ||
|
|
||
| ## Incoming traffic | ||
|
|
||
| The router forwards incoming traffic from the internet to IN-SMN or IN-ITK, | ||
| depending on the destination port. | ||
|
|
||
| HTTP(S) traffic (ports `80` and `443`) and standard SSH (port `22`), is sent to IN-SMN. | ||
|
|
||
| Since most games use higher-numbered ports, ports `>=2000` are directed to IN-ITK. | ||
| As a consequence, SSH for IN-ITK uses port `2222` instead of the default `22` taken by IN-SMN. | ||
|
|
||
| <CalloutExt type="note"> | ||
| Since HTTP(S) traffic (ports 80 and 443) goes to IN-SMN, hosting websites on | ||
| IN-ITK requires IN-SMN to forward it to IN-ITK using [Traefik](in-smn/traefik). | ||
| </CalloutExt> | ||
|
|
||
|  | ||
|
|
||
| ## External hosting | ||
|
|
||
| Some websites need better availability than our local servers can guarantee, | ||
| such as [kth.it](https://kth.it) and the major committee websites. | ||
| These should instead be hosted on an external hosting service, commonly | ||
| [Netlify](https://www.netlify.com/) or sometimes [Vercel](https://vercel.com). | ||
|
|
||
| Since the main [kth.it](https://kth.it) site ([Heim](../software/heim)) | ||
| is not hosted locally on IN-SMN, there are two separate DNS records. | ||
| One record points the apex domain (`kth.it`) to Netlify | ||
| and another points the wildcard `*.kth.it` to the chapter's public IP address. | ||
|
|
||
| As a result, `kth.it` resolves to Netlify rather than the local router and | ||
| cannot be used to connect to the chapter servers over SSH. Use | ||
| `server.kth.it` instead. | ||
|
|
||
| Some subdomains of `kth.it` are also hosted on Netlify, | ||
| such as [init.kth.it](https://init.kth.it). | ||
| An easy way to find out where a domain is hosted is to simply ping the domain. | ||
| If it matches the IP for `kth.it`, it is Netlify, and if it matches `server.kth.it` it is | ||
| IN-SMN (or IN-ITK). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.