GitHub - 9vlc/allthingslinux · GitHub
Skip to content

9vlc/allthingslinux

Folders and files

Repository files navigation

All Things Linux Website

This repository contains the source code for the All Things Linux website (allthingslinux.org).

Overview

This is a Next.js application (using the App Router) built with Tailwind CSS for styling and Contentlayer for managing MDX blog content. It is deployed to Cloudflare Workers using the OpenNext adapter (@opennextjs/cloudflare). The project also utilizes Trigger.dev for background jobs.

Deployments are automated via Cloudflare's Git integration, deploying the main branch to production and the dev branch to a development/preview environment.

Tech Stack

Getting Started

Prerequisites

  • Node.js (version specified in package.json)
  • pnpm (install with npm install -g pnpm or follow installation guide)
  • Access to Cloudflare account (for viewing deployments and managing secrets)
  • Trigger.dev account for background/async task management

Installation

  1. Clone the repository:
    git clone https://github.com/allthingslinux/allthingslinux.git
    cd allthingslinux
  2. Install dependencies:
    pnpm install

Local Development

  1. Secrets (.dev.vars):

    • Create a .dev.vars file in the project root. This file is ignored by Git (.gitignore).
    • Add the required environment variables and secrets needed for local development (e.g., GITHUB_TOKEN, MONDAY_API_KEY, MONDAY_BOARD_ID, DISCORD_WEBHOOK_URL, TRIGGER_SECRET_KEY). Use the format KEY=VALUE, one per line.
    • Refer to wrangler.local.jsonc (vars section) for the expected variable names.
  2. Run Development Servers:

    • To start all necessary development servers (Next.js, Wrangler, Trigger.dev) concurrently, run:
      pnpm run dev:all
    • This will typically make:
      • The Next.js app available at http://localhost:3000.
      • The Wrangler dev server (simulating Cloudflare) available at http://localhost:8788.
  3. Accessing the App: Use http://localhost:3000 for standard development with Hot Module Replacement (HMR). Use http://localhost:8788 to interact with the app as it would run within the Wrangler environment (useful for testing Cloudflare-specific bindings or logic).

Configuration Files

The project uses separate wrangler configuration files for different environments:

  • wrangler.local.jsonc: Used by pnpm run dev:wrangler and pnpm run dev:all. Reads secrets from .dev.vars.
  • wrangler.dev.jsonc: Used for deployments to the development environment (via Cloudflare Git integration on the dev branch).
  • wrangler.production.jsonc: Used for deployments to the production environment (via Cloudflare Git integration on the main branch).
  • wrangler.jsonc: Minimal file required only for the @opennextjs/cloudflare build step (due to the specific package version). Not used for deployment targeting.

Building the Project

To perform a full production build, including adapting the Next.js output for Cloudflare Workers via OpenNext, run:

pnpm run build

This executes the full build chain defined in package.json. The output suitable for Cloudflare deployment will be placed in the .open-next directory.

Deployment

Deployments are typically automated via Cloudflare's Git integration connected to the allthingslinux-development and allthingslinux-production Worker services.

  • Push to dev branch: Triggers a build and deployment to the development environment.
  • Push to main branch: Triggers a build and deployment to the production environment.

Manual deployments can be triggered using:

  • pnpm run deploy:dev (Builds and deploys to development)
  • pnpm run deploy:prod (Builds and deploys to production)
  • pnpm run deploy (Alias for deploy:prod)

Refer to the Cloudflare Worker settings for the exact build/deploy commands used by the automated process.

Secrets Management

  • Local: Use the .dev.vars file (ensure it's in .gitignore).
  • Development: Manage secrets via the Cloudflare dashboard for the allthingslinux-development Worker or using wrangler secret put <KEY> --env development.
  • Production: Manage secrets via the Cloudflare dashboard for the allthingslinux-production Worker or using wrangler secret put <KEY>.

Available Scripts

For a detailed explanation of all available pnpm scripts, please refer to the PNPM_SCRIPTS.md file in the repository root.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors