Infrastructure as Code for the WorkFort Discord community server.
- Discord Bot: Go application using discordgo library
- Configuration: YAML files defining server structure
- Task Runner: mise for tool management and commands
- IaC Philosophy: All server configuration lives in version control
- mise - Tool version manager
- Discord bot token and server (guild) ID
- Discord server with bot invited (Guild Install)
git clone https://github.com/Work-Fort/Discord.git
cd Discord
mise installThis installs Go and any other required tools.
This repository uses SOPS (Secrets OPerationS) with age encryption to store secrets securely in git.
Secrets are stored in secrets.yaml (encrypted and committed):
- Discord bot token
- Discord guild (server) ID
- GitHub webhook URL
The age private key (age-key.txt) is git-ignored and must be obtained from the team lead.
To decrypt secrets (view only):
mise run secrets_decryptTo edit secrets:
mise run secrets_editFor new contributors: Contact the team lead for age-key.txt and place it in the repo root
Run the initial setup to create channels, roles, and configure the server:
mise run setupThis reads config/*.yaml files and applies them to your Discord server.
All server configuration lives in config/:
server.yaml- Server settings and metadatachannels.yaml- Channel structure and permissionsroles.yaml- Role definitions and permissionsintegrations.yaml- Webhooks and external integrations
# Initial server setup from YAML configs
mise run setup
# Sync configuration changes to Discord
mise run sync
# Export current Discord state to YAML (backup/drift detection)
mise run backup
# Validate YAML configuration files
mise run validate
# Build the binary
mise run build
# Run tests
mise run test
# View encrypted secrets
mise run secrets_decrypt
# Edit encrypted secrets (opens editor)
mise run secrets_editThis repository uses SOPS (Secrets OPerationS) with age encryption to securely store secrets in git.
secrets.yaml: Encrypted secrets file (COMMITTED to git)age-key.txt: Private encryption key (GIT-IGNORED, never committed).sops.yaml: SOPS configuration with age public key
All secrets (Discord bot token, guild ID, webhook URLs) are encrypted before being committed. The private age key is required to decrypt them.
- Edit YAML configuration files in
config/ - Run
mise run validateto check syntax - Run
mise run syncto apply changes to Discord - Commit changes to git
Export current Discord server state:
mise run backupThis creates timestamped YAML snapshots. Compare with checked-in config to detect drift.
.
├── .mise.toml # Tool versions and task definitions
├── .sops.yaml # SOPS encryption config (age public key)
├── secrets.yaml # Encrypted secrets (COMMITTED)
├── age-key.txt # age private key (GIT-IGNORED)
├── .env # Shared config (committed)
├── config/
│ ├── server.yaml # Server settings
│ ├── channels.yaml # Channel structure
│ ├── roles.yaml # Roles and permissions
│ └── integrations.yaml # Webhooks, bots
├── cmd/
│ └── discord-bot/
│ └── main.go # CLI entry point
├── internal/
│ ├── setup/ # Initial setup logic
│ ├── sync/ # Config sync to Discord
│ ├── backup/ # Export Discord state
│ └── config/ # YAML config parsing
└── README.md # This file
GPL-2.0-only - See LICENSE.md for details.