Sign inSign up

haru/radvent

By haru

•Updated 1 day ago

radvent container

Image
0

4.1K

haru/radvent repository overview

⁠radvent

MIT License build Maintainability codecov Ask DeepWiki

Japansese/日本語⁠

An Advent Calendar-style blog web application. Write articles in Markdown and they are automatically published on their scheduled date.

This is a fork of nanonanomachine/radvent⁠ with the following additions and enhancements:

  • User authentication (Devise)
  • Per-user event management (multiple boards with public / protected / private visibility and membership control)
  • Multiple Advent Calendar events
  • Likes and comments
  • File attachments (CarrierWave)

The Markdown editor uses EasyMDE⁠, the Markdown parser uses marked⁠, and syntax highlighting uses highlight.js⁠.


⁠Table of Contents


⁠Tech Stack

CategoryTechnology
LanguageRuby >= 3.3
FrameworkRuby on Rails 8.1
Frontendesbuild / PostCSS (Bootstrap 5 / mdb-ui-kit) / @hotwired/stimulus
Markdown EditorEasyMDE (easy-markdown-editor)
TemplatesHAML
AuthenticationDevise
DB (development)SQLite3
DB (production)SQLite3 / MySQL 5.7+ / PostgreSQL
TestingRSpec / FactoryBot / SimpleCov
CIGitHub Actions

⁠Development Setup

⁠Prerequisites
  • Ruby >= 3.3
  • Node.js / Yarn
  • SQLite3 (default)
⁠Steps
# 1. Install dependencies
bundle install
yarn install

# 2. Generate default config files
#    Creates config/database.yml / config/secrets.yml / config/initializers/devise.rb
bundle exec rake radvent:generate_default_settings

# 3. Create database, run migrations, and seed data
bundle exec rake db:create db:migrate db:seed
⁠Default Admin User

After seeding (db:seed), the following admin account is available. Please change the password after your first login.

FieldValue
Email[email protected]⁠
Passwordadminadmin

⁠Starting the App

bundle exec rails s

Access the app at http://localhost:3000.

The app supports Japanese and English locales, and automatically switches based on your browser's language settings.


⁠Testing

The test framework used is RSpec.

⁠Run All Tests
bundle exec rspec spec
⁠Run Specific Tests
# Model specs only
bundle exec rspec spec/models

# Controller specs only
bundle exec rspec spec/controllers

# Single file
bundle exec rspec spec/models/user_spec.rb

# Specific line in a file
bundle exec rspec spec/models/user_spec.rb:42
⁠Coverage Report

After running tests, a coverage report is generated at coverage/index.html (SimpleCov / LCOV format).

bundle exec rspec spec
open coverage/index.html
⁠Test Structure
DirectoryContents
spec/models/Model specs
spec/controllers/Controller specs
spec/helpers/Helper specs
spec/uploaders/Uploader specs
spec/views/View specs
spec/factories/FactoryBot factory definitions

⁠Production Deployment

# 1. Generate config files
bundle exec rake radvent:generate_default_settings

# 2. Precompile assets
bundle exec rake assets:precompile RAILS_ENV=production

# 3. Run database migrations
bundle exec rake db:migrate RAILS_ENV=production

# 4. Set secret key and start
export SECRET_KEY_BASE=$(bundle exec rails secret)
bundle exec rails s -e production

⁠Docker

⁠Running with docker run
docker run -d -p 3000:3000 -v /host/data/directory:/var/radvent_data haru/radvent
⁠docker-compose Example (MySQL)
services:
  radvent:
    image: haru/radvent:latest
    ports:
      - "3000:3000"
    restart: unless-stopped
    volumes:
      - "./docker/data:/var/radvent_data"
      - "./log:/usr/local/radvent/log"
    links:
      - mysql
    environment:
      DB: mysql
      DB_USERNAME: root
      DB_PASSWORD: example
      DB_HOST: mysql
      DB_CREATE_ON_START: "true"
  mysql:
    image: mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - "./docker/mysql:/var/lib/mysql"
⁠docker-compose Example (PostgreSQL)
services:
  radvent:
    image: haru/radvent:latest
    ports:
      - "3000:3000"
    volumes:
      - "./docker/data:/var/radvent_data"
      - "./log:/usr/local/radvent/log"
    restart: unless-stopped
    environment:
      DB: postgres
      DB_USERNAME: postgres
      DB_PASSWORD: example
      DB_HOST: postgres
      DB_CREATE_ON_START: "true"
  postgres:
    image: postgres
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: example
    volumes:
      - "./docker/postgres:/var/lib/postgresql"
⁠Environment Variables
KeyValueDefault
DBsqlite3 / mysql / postgressqlite3
DB_NAMEDatabase nameradvent
DB_USERNAMEDB username—
DB_PASSWORDDB password—
DB_HOSTDB hostname—
DB_PORTDB port numberMySQL: 3306 / PostgreSQL: 5432
DB_CREATE_ON_STARTSet to true to run db:create on startupfalse
RADVENT_TITLESite name displayed in the headerAdvent Calendar

⁠Architecture

⁠Entity Relationship Diagram
Board ──< Event ──< AdventCalendarItem >── User
  │                       │
  └──< BoardMembership    └── Item ──< Comment
         >── User                └──< Like >── User
ModelDescription
UserDevise-authenticated user. Has admin flag
BoardContainer for events. Two types: top (system-wide) and user (user-created), with public / protected / private visibility
BoardMembershipJoin table between Board and User (membership management)
EventAdvent Calendar event. Belongs to a Board
AdventCalendarItemCalendar date slot (date is Integer 1–31)
ItemMarkdown article. Has a one-to-one relationship with AdventCalendarItem
LikeLike on an article
CommentComment on an article (stores user_name as a string only)
AttachmentFile attachment via CarrierWave

⁠License

MIT⁠


⁠Credits

Tag summary

Content type

Image

Digest

sha256:0838e1b72…

Size

828.6 MB

Last updated

1 day ago

docker pull haru/radvent