Skip to content

JACKURUVI99/Delta-Blog-Setup

Repository files navigation

Delta Task 1 - Blog Server

Setup Instructions

Run the main setup once as root:

https://github.com/JACKURUVI99/Delta-Blog-Setup/
cd Delta-Blog-Setup
sudo mv scripts ~/scripts
cd /scripts
sudo bash delta-setup

delta-setup performs:

  • Makes yq executable at /usr/local/bin/yq
  • Runs .initusers, .notifysetup, .promotsetup, .setupcorn
  • Starts .notifyserver in background

Directory Structure

/scripts/
├── .initusers           # Sets up users, groups, and directories (calls .permission)
├── .notifysetup         # Sets up .viewnotify in all user directories
├── .notifycorn          # Cron script to count new notifications
├── .notifyserver        # Netcat server to broadcast notifications
├── .promotsetup         # Sets ACLs for promotion
├── .cronrunner          # Triggers adminpannel on valid dates
├── .permission          # Manages script and directory permissions
├── manageblogs          # Author script for creating/editing/publishing blogs
├── suprise              # Users subscribe or unsubscribe to authors
├── .viewnotify          # Reads and clears notifications on login
├── blogfilter           # Moderator script to review/approve/reject blogs
├── userFY               # Admin script to get user and blog details
├── approvepromotion     # Admin script to approve/deny promotions
├── promote-req          # User script to request promotion
├── .promote             # Core logic for promotion (used internally)
├── adminpannel          # Generates analytics report
├── users.yaml           # Initial user-role definitions
├── subscriptions.yaml   # List of author subscriptions
├── blogs_initial.yaml   # Template blogs YAML
└── reports/             # Report outputs generated by adminpannel

Roles and Permissions

  • g_user: Regular users
  • g_author: Users with blogging permissions
  • g_mod: Moderators with filtering rights
  • g_admin: Admins with complete access and report control

Usage Guide for Runtime Scripts

Script Role Description Usage Example
suprise User Subscribe or unsubscribe from an author bash /scripts/suprise bala
promote-req User Request for promotion sudo /scripts/promote-req
blogfilter Moderator Approve or block author blogs bash /scripts/blogfilter bala
userFY Admin View blog and user statistics bash /scripts/userFY username
approvepromotion Admin Approve or deny promotion requests sudo /scripts/approvepromotion username approve
manageblogs Author Create, edit, and publish blogs bash /scripts/manageblogs -super blog1

Note: Run suprise again to unsubscribe from the same author.


Background and System Scripts

Scripts starting with a dot (.) are background/system-level scripts:

Script Purpose
.initusers Initializes users and directories; invokes .permission
.notifysetup Installs .viewnotify in user home directories
.notifycorn Periodically checks and shows new notification count
.notifyserver Netcat-based background notification listener
.promotsetup Sets ACLs required for promotion mechanism
.permission Sets up group and file-level permissions (invoked by .initusers)
.cronrunner Validates schedule and triggers adminpannel

These are all invoked automatically through the main delta-setup script.


Ensure notify server starts:

nohup bash /scripts/.notifyserver > /dev/null 2>&1 &

Notification System Flow

  1. Author publishes a blog using manageblogs
  2. A Netcat message is sent to localhost
  3. .notifyserver receives it and looks up subscribers in subscriptions.yaml
  4. Relevant users’ notification logs are updated
  5. .viewnotify shows messages on next login or manual run

Reporting System Flow

  • .cronrunner is scheduled using crontab
  • It validates if current day is:
    • Thursday
    • First or last Saturday of Feb, May, Aug, Nov
  • If valid, it triggers adminpannel
  • Report is saved at /scripts/reports/DATE_TIME.yaml

Sample Crontab Entries

@reboot /scripts/.notifyserver
*/1 * * * * /scripts/.notifycorn
0 10 * * * /scripts/.cronrunner

Example Notification Output

Your Notifications:
- New post from bala: 'newblog'

Example Admin Report Output

blogs:
  - file_name: "travelblog"
    author: "bala"
    categories: ["Travel", "Lifestyle"]
    reads: 12

categories:
  Travel: 2
  Lifestyle: 1

top_articles:
  - file_name: "travelblog"
    reads: 12

total_published: 5
total_deleted: 1

Notes

  • After promotion or demotion, the user must log out and log back in for changes to take effect.
  • This system has been tested and is functional on Arch Linux.

Refer Documentation for further details


About

This is a blog Setup for Delta-Task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors