You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2026. It is now read-only.
Repository navigation
Commit 437db0d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+48-7Lines changed: 48 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,22 +12,60 @@ This repository contains the backend code for Octocon, which is structured into
12
12
-**octocon-web**: The Phoenix web application that serves the REST API, metrics, and admin dashboard.
13
13
-**octocon-discord**: The Discord bot that serves as an alternative interface for interacting with the Octocon platform, including "proxying" as alters.
14
14
15
-
## Distributed monolith
15
+
## Development setup
16
+
17
+
To set up a development environment for Octocon, you'll need to have the following prerequisites installed on a Unix-like operating system or WSL:
Once installed, follow these steps to set up your development environment:
23
+
1. Clone the repository:
24
+
```bash
25
+
git clone
26
+
cd octocon
27
+
```
28
+
29
+
2. Run the provided setup script:
30
+
```bash
31
+
./dev/setup.sh
32
+
```
33
+
This script will ensure your system is configured correctly, build the necessary Docker images, install dependencies, and perform database migrations.
34
+
35
+
3. Start the development environment:
36
+
```bash
37
+
./dev/bin/iex
38
+
```
39
+
This command will launch an interactive Elixir shell running the Octocon application inside a Docker container.
40
+
41
+
## Contributing
42
+
43
+
We welcome contributions to Octocon! If you'd like to contribute, please follow these steps:
44
+
1. Fork the repository on GitHub and create a new branch for your feature or bug fix.
45
+
2. Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages.
46
+
3. Run `mix format` then `mix lint` before submitting a PR to ensure code quality.
47
+
4. Submit a pull request to this repository for review.
48
+
49
+
While we respect your time, please note that not every contribution will be accepted; certain features may not align with our project's goals or privacy/security standards. If you'd like to contribute a new feature, your best bet is to reach out to us in the `#development` channel on our [Discord server](https://discord.gg/octocon) first to discuss its feasibility. Alternatively, we welcome PRs implementing accepted suggestions posted on [our issue tracker](https://github.com/octocondev/issues/issues?q=is%3Aissue%20state%3Aopen%20type%3ASuggestion%20(label%3A%22Low%20Priority%22%20OR%20label%3A%22High%20Priority%22%20OR%20label%3AUrgent))
50
+
51
+
## Deployment structure
16
52
Octocon is designed as a distributed monolith, meaning that while the components have a clear separation of concerns, they share a common codebase which is compiled and deployed as one executable.
17
53
18
-
Octocon is generally run in a cluster of nodes, which are designed to be globally distributed across the world. One "primary region" interfaces with a larger database instance and runs the Discord bot, while "auxiliary regions" interface with database replicas. This allows for low-latency access to the data from anywhere in the world.
54
+
Octocon is generally run in a cluster of nodes, which are designed to be globally distributed across the world. One "primary" node interfaces with a generally larger database instance and runs the Discord bot, while "auxiliary" nodes interface with smaller database instances. This allows for low-latency access to the data from anywhere in the world.
19
55
20
56
When not running on Fly.io, an Octocon node knows its role in the overall cluster through an environment variable (`NODE_GROUP`), which determines which parts of the supervision tree it will run, and how it will advertise itself to its peers.
21
57
22
-
By default, Octocon is configured to discover other nodes using the [libcluster](https://github.com/bitwalker/libcluster) library with a custom Tailscale strategy. All that is necessary is for each node to form a Distributed Erlang cluster; Octocon has internal logic to determine and cache each node's role in the cluster through an RPC communication step.
58
+
In production, Octocon is configured to discover other nodes using the [libcluster](https://github.com/bitwalker/libcluster) library with a custom Tailscale strategy. All that is necessary is for each node to form a Distributed Erlang cluster; Octocon has internal logic to determine and cache each node's role in the cluster through an RPC communication step.
23
59
24
60
There are 3 node groups:
25
-
-`primary`: A node running in the primary region, which interfaces with the read-write database and runs Discord shards. Other nodes proxy their database writes to a `primary` node.
26
-
-`auxiliary`: A node running in an auxiliary region, which interfaces with a read-only replica of the database. These nodes are largely only responsible for serving HTTP requests to the API.
27
-
-`sidecar`: A node responsible for isolating CPU-bound tasks from the rest of the cluster, such as image processing and heavy encryption tasks. **At least one** sidecar must be present in the entire cluster.
61
+
-`primary`: A node running in the primary region, which interfaces with a larger database instance, runs Discord shards, and handles certain types of global state. Other nodes proxy some requests to a `primary` node.
62
+
-`auxiliary`: A node running in an auxiliary region, which interfaces with a smaller database instance. These nodes are largely only responsible for serving HTTP requests to the API.
63
+
-`sidecar`: A node responsible for isolating CPU-bound tasks from the rest of the cluster, such as image processing and heavy encryption tasks. Ideally, **at least one** sidecar should be present in the cluster. If no sidecar is present, nodes will run these tasks themselves.
28
64
29
65
**Note**: Running multiple `primary` nodes is heavily experimental and not currently recommended - our Discord library (Nostrum) still doesn't behave well in this type of distributed environment.
66
+
30
67
## Configuration & integrations
68
+
31
69
Every Octocon node must be configured with a set of environment variables to function properly. These variables are used to connect to the database, configure the Discord bot, and set up other integrations, such as cloud object storage.
32
70
33
71
### OAuth
@@ -65,4 +103,7 @@ Every Octocon node must be configured with a set of environment variables to fun
65
103
-`NODE_GROUP` - The group this node belongs to (`primary`, `auxiliary`, or `sidecar`).
66
104
-`PRIMARY_NODE_COUNT` - Number of primary nodes in the cluster (**values other than 1 are experimental**).
67
105
-`POOL_SIZE` - Size of the database connection pool.
68
-
-`PORT` - Port to run the Phoenix web server on.
106
+
-`PORT` - Port to run the Phoenix web server on.
107
+
-`TAILSCALE_API_AUTHKEY` - When present, enables Tailscale-based clustering using the provided auth key.
108
+
-`NODE_LIST` - When present, enables static clustering with the provided comma-separated list of node IPs.
109
+
If neither `TAILSCALE_API_AUTHKEY` nor `NODE_LIST` are present, a single-node cluster is assumed, which will run as a `primary` node.
0 commit comments