Skip to content

Commit

Permalink
documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
mk6i committed Sep 5, 2024
1 parent 279504a commit 44c696d
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 138 deletions.
2 changes: 1 addition & 1 deletion cmd/config_generator/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This program generates env config scripts from config.Config struct tags for
// unix and windows platforms.
// Usage: go run ./cmd/config_generator [platform] [filename]
// Example: go run ./cmd/config_generator windows settings.bat
// Example: go run ./cmd/config_generator unix settings.env
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func init() {

// Optionally populate environment variables with config file
if err := godotenv.Load(*cfgFile); err != nil {
fmt.Printf("Config file not found (%s). Moving on...\n", *cfgFile)
fmt.Printf("Config file (%s) not found, defaulting to env vars for app config...\n", *cfgFile)
} else {
fmt.Printf("Successfully loaded config file (%s)\n", *cfgFile)
}
Expand Down
2 changes: 1 addition & 1 deletion config/ras.service
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Environment="DISABLE_AUTH=true"
Environment="FAIL_FAST=false"
Environment="LOG_LEVEL=info"
Environment="OSCAR_HOST=127.0.0.1"
ExecStart=/opt/ras/bin/retro_aim_server
ExecStart=/opt/ras/retro_aim_server
Restart=on-failure

[Install]
Expand Down
36 changes: 6 additions & 30 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,8 @@ Before you can run Retro AIM Server, set up the following software dependencies.

Since Retro AIM Server is written in go, install the latest version of [golang](https://go.dev/).

If you're new to go, try [Visual Studio Code](https://code.visualstudio.com) wth the
[go plugin](https://code.visualstudio.com/docs/languages/go) as your first IDE.

### C Compiler

A C compiler is required in order to build the sqlite dependency.

#### macOS

> If you have git, this is likely already set up on your machine.
```shell
xcode-select --install
```

#### Linux (Ubuntu)

```shell
sudo apt install build-essential
```

#### Windows

Install the [tdm-gcc compiler](https://jmeubank.github.io/tdm-gcc/).
If you're new to go, try [Visual Studio Code](https://code.visualstudio.com) wth the [go plugin](https://code.visualstudio.com/docs/languages/go)
as your first IDE.

### Mockery (optional)

Expand Down Expand Up @@ -71,8 +49,7 @@ go build -o retro_aim_server ./cmd/server
To run the binary with the settings file:

```shell
source config/settings.env
./retro_aim_server
./retro_aim_server -config config/settings.env
```

## Testing
Expand All @@ -86,7 +63,6 @@ go test -race ./...

## Config File Generation

The config files `config/settings.bat` and `config/settings.env` are generated programmatically from the
[Config](../config/config.go) struct using `go generate`. If you want to add or remove application configuration
options, first edit the Config struct and then generate the configuration files by running `make config` from the
project root. Do not edit the config files by hand.
The config file `config/settings.env` is generated programmatically from the [Config](../config/config.go) struct using
`go generate`. If you want to add or remove application configuration options, first edit the Config struct and then
generate the configuration files by running `make config` from the project root. Do not edit the config files by hand.
5 changes: 2 additions & 3 deletions docs/CLIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Windows AIM versions 5.0-5.1.3036 run perfectly well on [Wine](https://www.wineh

Windows AIM can run on modern macOS without a VM, including the Apple Silicon platform!

Get started with the
[AIM for macOS project](https://github.com/mk6i/aim-for-macos).
Get started with the [AIM for macOS project](https://github.com/mk6i/aim-for-macos).

### Windows 10/11

Expand All @@ -44,7 +43,7 @@ Once installed, configure AIM to connect to Retro AIM Server.
<img width="662" alt="screenshot of AIM preferences window" src="https://github.com/mk6i/mkdb/assets/2894330/c7cfcaa4-8132-4b57-b5c9-7643c99cbda2">
</p>
3. In the `Host` field, enter the value of `OSCAR_HOST` found in `config/settings`. In the `Port` field, enter the
value of `AUTH_PORT` found in `config/settings`.
value of `AUTH_PORT` found in `config/settings.env`.
<p>
<img width="618" alt="Screen Shot 2024-03-29 at 11 22 19 PM" src="https://github.com/mk6i/mkdb/assets/2894330/da17c457-a773-4b82-b4ba-cb81f9a2e085">
</p>
Expand Down
8 changes: 3 additions & 5 deletions docs/CLIENT_ICQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ using [WineskinServer](https://github.com/Gcenx/WineskinServer), a wrapper for W
## Post-install Configuration

In this step, we'll replace ICQ's default server hostname with your Retro AIM
Server's hostname in the Windows Registry.
Server's hostname in the Windows Registry.
> Do not attempt to set the ICQ hostname via the registration Window. If you do
> this, a bug will surface that prevents the client from "remembering" settings
Expand Down Expand Up @@ -149,7 +149,7 @@ Server's hostname in the Windows Registry.
- Double-click the `Default Server Host` registry entry.
- Set `Value data` to the value of `OSCAR_HOST` found in Retro AIM Server
configuration `config/settings.env` (Linux/macOS) or `config/settings.bat` (Windows).
configuration `config/settings.env`.
- Click OK.
<p align="center">
Expand All @@ -163,9 +163,7 @@ Server's hostname in the Windows Registry.
- Double-click the `Default Server Port` registry entry.
- Tick the `Decimal` radio button.
- Set `Value data` to the value of `AUTH_PORT` found in Retro AIM Server
configuration `config/settings.env` (Linux/macOS) or `config/settings.bat`
(Windows).
- Set `Value data` to the value of `AUTH_PORT` found in Retro AIM Server configuration `config/settings.env`.
- Click OK.
<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion docs/LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This guide explains how to download, configure and run Retro AIM Server on Linux
Run the following command to launch Retro AIM Server:

```shell
./run.sh
./retro_aim_server
```

Retro AIM Server will run in the terminal, ready to accept AIM client connections.
Expand Down
12 changes: 6 additions & 6 deletions docs/MACOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This guide explains how to download, configure and run Retro AIM Server on macOS
Grab the latest macOS release from the [Releases page](https://github.com/mk6i/retro-aim-server/releases) for your
platform (Intel or Apple Silicon).

Because the Retro AIM Server `.app` has not been blessed by Apple, browsers such as Chrome may think it's a
Because the Retro AIM Server binary has not been blessed by Apple, browsers such as Chrome may think it's a
"suspicious" file and block the download, in which case you need to explicitly opt in to downloading the untrusted
file.

Expand All @@ -25,16 +25,16 @@ This guide explains how to download, configure and run Retro AIM Server on macOS
Open a terminal and navigate to the extracted directory. This terminal will be used for the remaining steps.

```shell
cd ~/Downloads/retro_aim_server.0.1.0.macos.intel_x86_64/
cd ~/Downloads/retro_aim_server.0.11.0.macos.intel_x86_64/
```

3. **Remove Quarantine**

Because the Retro AIM Server `.app` has not been blessed by Apple, macOS will quarantine the application. To proceed,
remove the quarantine flag from the `.app`. In the same terminal, run following command:
macOS will quarantine the Retro AIM Server binary because it has not been blessed by Apple. To remove the quarantine
flag from the binary, run following command in the same terminal,

```shell
sudo xattr -d com.apple.quarantine ./bin/retro_aim_server
sudo xattr -d com.apple.quarantine ./retro_aim_server
```

> While the binaries are 100% safe, you can avoid the security concern by [building the application yourself](./BUILD.md).
Expand All @@ -57,7 +57,7 @@ This guide explains how to download, configure and run Retro AIM Server on macOS
Run the following command to launch Retro AIM Server:

```shell
./run.sh
./retro_aim_server
```

Retro AIM Server will run in the terminal, ready to accept AIM client connections.
Expand Down
56 changes: 20 additions & 36 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,39 @@ This document explains how the Retro AIM Server release process works.
## Overview

Retro AIM Server is built and released to Github using [GoReleaser](https://goreleaser.com/). The release process, which
runs from a local computer (and not a CI/CD process) creates pre-built binaries for several platforms (Windows, MacOS,
runs from a local computer (and not a CI/CD process) creates pre-built binaries for several platforms (Windows, macOS,
Linux).

GoReleaser runs in a Docker container for two important reasons:

- Docker provides a hermetic environment that prevents build contamination from the host environment.
- The Docker image [goreleaser-cross](https://github.com/goreleaser/goreleaser-cross) consolidates all the libraries
needed for cross-compilation in one place.
- Given that the application uses cgo, it's much easier to use a pre-built container to build the sqlite library
than to manually set up a C compiler on Mac/Windows/Linux etc.
GoReleaser runs in a Docker container, which provides a hermetic environment that prevents build contamination from the
host environment.

### Code Signing Policy

Given the cost and complexity of code signing, this project only distributes unsigned binaries. This means that
MacOS distrusts Retro AIM Server by default and quarantines the application when you open it.
This project offers signed Windows binaries and does not currently offer signed macOS binaries. This means that macOS
distrusts Retro AIM Server by default and quarantines the application when you open it.
> If you don't want to bypass this security mechanism, you can [build the project yourself](./building) instead.
### Windows Build Obfuscation

Due to cost and complexity, none of the release artifacts are signed. One consequence of this is that Windows Defender
falsely detects [the `.exe` as a virus](https://go.dev/doc/faq#virus) and auto-quarantines the file upon execution.

We get around this by obfuscating the go binary at built time using [garble](https://github.com/burrowers/garble). In
order to accomplish this, the project wraps GoReleaser and garble in a custom Dockerfile `Dockerfile.goreleaser`.

The GoRelease-garble image must be built locally before running the release process.

## Release Procedure

The following is the procedure that builds Retro AIM Server and uploads the build artifacts to a Github release.

1. **Build Custom Docker Image**

Build the custom GoReleaser Docker image. Ensure that the latest version is set under `GO_RELEASER_CROSS_VERSION` in
the project Makefile.

```sh
make goreleaser-docker
```

2. **Export Github Personal Access Token (PAT)**
1. **Export Github Personal Access Token (PAT)**

Export a Github Personal Access Token that has `write:packages` permissions for the Retro AIM Server repo.

```sh
export GITHUB_TOKEN=...
```

3. **Tag The Build**
2. **Tag The Build**

Tag the build using [semantic versioning](https://semver.org/).
```shell
git tag v0.1.0
git push --tags
```

4. **Dry-Run Release**
3. **Dry-Run Release**

Execute a dry-run build to make sure all the moving parts work together. Fix any problems that crop up before
continuing.
Expand All @@ -70,11 +46,19 @@ The following is the procedure that builds Retro AIM Server and uploads the buil
make release-dry-run
```

5. **Release It!**
4. **Release It!**

Now run the release process. Once its complete, a new [release](https://github.com/mk6i/retro-aim-server/releases)
should appear in Github with download artifacts attached.
Now run the release process. Once its complete, a private draft [release](https://github.com/mk6i/retro-aim-server/releases)
should appear with attached build artifacts.

```shell
make release
```
```

5. **Sign It!**

Download the Windows release, sign it, and re-upload the `.zip` to the draft release created in the previous step.

6. **Publish It**

Publish the draft release.
28 changes: 15 additions & 13 deletions docs/SYSTEMD.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Configuring Retro AIM Server With systemd

This document details the configuration of Retro AIM Server to run as an unprivileged user with `systemd` managing it as a production service.
This document details the configuration of Retro AIM Server to run as an unprivileged user with `systemd` managing it as
a production service.

1. ** Download Retro AIM Server**
1. **Download Retro AIM Server**

Grab the latest Linux release from the [releases page](https://github.com/mk6i/retro-aim-server/releases)

2. ** Create the ras user and group **
2. **Create the ras user and group**

Run the following commands:

Expand All @@ -16,38 +17,39 @@ This document details the configuration of Retro AIM Server to run as an unprivi
$ sudo mkdir -p /var/ras
```

3. ** Extract the archive **
3. **Extract the archive**

Extract the archive using the usual `tar` invocation, and move the extracted contents into `/opt/ras`

4. ** Set Ownership and Permissions **
4. **Set Ownership and Permissions**

```shell
$ sudo chown -R ras:ras /opt/ras
$ sudo chmod -R o-rx /opt/ras
```

5. ** Copy the systemd service **
5. **Copy the systemd service**

Place the `ras.service` file in `/etc/systemd/system`

6. ** Reload systemd **
6. **Reload systemd**

```shell
$ sudo systemctl daemon-reload
```

7. ** Enable and start the service **
7. **Enable and start the service**

```shell
$ sudo systemctl enable --now ras.service
```
```shell
$ sudo systemctl enable --now ras.service
```

8. ** Make sure the service is running **
8. **Make sure the service is running**

```shell
$ sudo systemctl status ras.service
$ sudo journalctl -xeu ras.service
```

Note that the `systemd` service defines the configuration for Retro AIM Server directly, bypassing the usual `run.sh` script and `settings.env`. Customizations may be performed in `/etc/systemd/system/ras.service`.
Note that the `systemd` service defines the configuration for Retro AIM Server directly, bypassing the `settings.env`
config. Customizations may be performed in `/etc/systemd/system/ras.service`.
Loading

0 comments on commit 44c696d

Please sign in to comment.