Skip to content

zeeket/hytky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HYTKY

Tests

Prettier

Site and forum for a student organization centered around electronic music culture. This is a T3 Stack project bootstrapped with create-t3-app. The forum login is designed to be exclusive to members of certain Telegram groups. A Telegram user's membership status in the groups is checked with HYTKYbot.

Running

Requirements

  • Docker Compose
  • Make

Instructions

  1. git clone <this repo>
  2. cd hytky
  3. cp .env.example .env and put your secret values in the .env file.
  4. cp .hytkybot.env.example .hytkybot.env and put your secret values in the .hytkybot.env file.
  5. make dev for hot reloading or make prod for a production-like environment.
    • Production environments should be seeded manually with make seed

Making changes to the database

In a development environment, use the make migrate command to generate and apply migrations. Commit the following to source control:

  • The entire migration history folder
  • The schema.prisma file

Deployment

The username of the Telegram bot that is used for the Telegram login button on the login page is stored as a variable on this GitHub repo. This is because we want to serve the login page with SSG from the container. To change the value to point to your own HYTKYbot:

  1. Fork this repo.
  2. Add the NEXT_PUBLIC_TG_BOT_NAME variable containing your bot's username to your forked repository.
  3. Edit docker/docker-compose.prod.from-registry.yml to point to your GHCR.

You should then be able to fetch the latest working image from your GHCR and simulate a deployment locally with make regprod

Deployment requirements

  • Ansible & access to a x86_64 apt based Linux production server

Initial deployment instructions

Replace 123.123.123.123 with your server's IP. Makefile asssumes you authenticate with ~/.ssh/id_rsa.

  1. make testconnect IP=123.123.123.123 should succeed
  2. make prepareprod IP=123.123.123.123
  3. make startprod IP=123.123.123.123

Continuous delivery

To push a new image, git tag a commit on the main branch with a semantic version number (for example v1.0.0). Latest image should get picked up by Watchtower.

TODO

  • Allow image submissions to posts and store them in minio (S3).
  • use Watchtower to deploy production Docker image.
  • English language option for all pages.
  • Seed db from JSON if prisma/eventArchive.json or prisma/forumArchive.json exist.
  • Remotely back up a deployment's database to prisma/forumBackup.json with a command.
  • Use src/server/utis/validators
  • Use toasts