6 Commits
Author SHA1 Message Date
lumither c466ba48a9 feat(Makefile) Makefile fix&cleanup 2025-11-03 13:49:56 -05:00
lumither 330dd7c2a6 feat(Makefile) add cr support 2025-11-03 13:21:13 -05:00
lumither 1966e0059c feat(action) add release build 2025-11-03 01:54:28 -05:00
lumither 3f5f23a4e8 feat(action) canary container build
build canary nocturne image / build (push) Has been cancelled
2025-11-03 01:15:46 -05:00
lumither 7205faddbe feat(blog) change foreground color in dark mode 2025-10-21 21:50:41 -04:00
lumither f1d43e6799 fix(deploy) add db auto-restart 2025-10-18 17:30:42 -04:00
14 changed files with 229 additions and 17 deletions

No files matched your search

+4
View File
@@ -17,3 +17,7 @@ WORK_DIR=/nocturne
# frontend settings # frontend settings
API_LOCAL_URL=http://backend:3001 API_LOCAL_URL=http://backend:3001
API_REMOTE_URL=https://lumither.com/api API_REMOTE_URL=https://lumither.com/api
# deployment
USE_CR=true
CHANNEL=release
+64
View File
@@ -0,0 +1,64 @@
name: build canary nocturne image
on:
push:
branches:
- master
env:
REGISTRY: cr.lmt.moe
TAG: canary
PROJECT: nocturne
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup builder
uses: docker/setup-buildx-action@v3
- name: registry login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: build containers
run: |
make build
- name: tag and push
run: |
PROJECT_NAME=$(basename "$PWD")
ALL_IMAGES=$(docker compose -f prod.compose.yaml config --services 2>/dev/null)
PULLED_IMAGES=$(docker compose -f prod.compose.yaml config 2>/dev/null \
| awk '/image:/ {print $2}' \
| sort -u \
| sed 's/:.*//' \
)
TO_PUSH=$(comm -23 \
<(echo "$ALL_IMAGES" | sort) \
<(echo "$PULLED_IMAGES") \
)
FMT_STRING=$(echo "$TO_PUSH" | xargs printf '%s, ' | sed 's/, $//')
echo "services to push: $FMT_STRING"
for SERVICE in $TO_PUSH; do
LOCAL_TAG="${PROJECT_NAME}-${SERVICE}:latest"
REMOTE_TAG="${REGISTRY}/${PROJECT}/${SERVICE}:${TAG}"
if docker image inspect "$LOCAL_TAG" >/dev/null 2>&1; then
echo "Pushing $REMOTE_TAG"
docker tag "$LOCAL_TAG" "$REMOTE_TAG"
docker push "$REMOTE_TAG"
else
echo "warn: image $LOCAL_TAG not found, skipping $SERVICE"
fi
done
+64
View File
@@ -0,0 +1,64 @@
name: build release nocturne image
on:
push:
branches:
- release
env:
REGISTRY: cr.lmt.moe
TAG: release
PROJECT: nocturne
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup builder
uses: docker/setup-buildx-action@v3
- name: registry login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: build containers
run: |
make build
- name: tag and push
run: |
PROJECT_NAME=$(basename "$PWD")
ALL_IMAGES=$(docker compose -f prod.compose.yaml config --services 2>/dev/null)
PULLED_IMAGES=$(docker compose -f prod.compose.yaml config 2>/dev/null \
| awk '/image:/ {print $2}' \
| sort -u \
| sed 's/:.*//' \
)
TO_PUSH=$(comm -23 \
<(echo "$ALL_IMAGES" | sort) \
<(echo "$PULLED_IMAGES") \
)
FMT_STRING=$(echo "$TO_PUSH" | xargs printf '%s, ' | sed 's/, $//')
echo "services to push: $FMT_STRING"
for SERVICE in $TO_PUSH; do
LOCAL_TAG="${PROJECT_NAME}-${SERVICE}:latest"
REMOTE_TAG="${REGISTRY}/${PROJECT}/${SERVICE}:${TAG}"
if docker image inspect "$LOCAL_TAG" >/dev/null 2>&1; then
echo "Pushing $REMOTE_TAG"
docker tag "$LOCAL_TAG" "$REMOTE_TAG"
docker push "$REMOTE_TAG"
else
echo "warn: image $LOCAL_TAG not found, skipping $SERVICE"
fi
done
+27 -6
View File
@@ -3,21 +3,42 @@ ifeq ($(ARCH), arm64)
ARCH := aarch64 ARCH := aarch64
endif endif
ifneq (,$(wildcard ./.env))
include ./.env
export
endif
ifneq (,$(wildcard ./.env.local))
include ./.env.local
export
endif
USE_CR ?= false
CHANNEL ?= release
ifeq ($(USE_CR), true)
COMPOSE_FILE := prod.cr.compose.yaml
else
COMPOSE_FILE := prod.compose.yaml
endif
DOCKER_ENV := ARCH=$(ARCH) TAG=$(CHANNEL)
DOCKER_COMPOSE := $(DOCKER_ENV) docker compose -f $(COMPOSE_FILE)
.PHONY: all .PHONY: all
all:up all:up
.PHONY: build .PHONY: build
build: build:
ARCH=$(ARCH) docker compose -f prod.compose.yaml build $(DOCKER_COMPOSE) pull
$(DOCKER_COMPOSE) build
.PHONY: up .PHONY: up
up: up:
ARCH=$(ARCH) docker compose -f prod.compose.yaml up -d $(DOCKER_COMPOSE) up -d
.PHONY: down .PHONY: down
down: down:
ARCH=$(ARCH) docker compose -f prod.compose.yaml down $(DOCKER_COMPOSE) down
.PHONY: rm .PHONY: clean
rm: clean:
ARCH=$(ARCH) docker compose -f prod.compose.yaml rm $(DOCKER_COMPOSE) down --rmi all --volumes
+1 -1
View File
@@ -31,6 +31,6 @@ services:
postgres: postgres:
image: postgres:16.3 image: postgres:16.3
ports: ports:
- 5432:5432 - "5432:5432"
env_file: env_file:
- ./container/dev/.env - ./container/dev/.env
+1 -1
View File
@@ -32,7 +32,7 @@ function BlogPostCard({ post, highlightSelector }: Props) {
<div className={ `w-full` }> <div className={ `w-full` }>
<Card <Card
as={ Link } href={ `/blog/post/${ post.identifier }` } as={ Link } href={ `/blog/post/${ post.identifier }` }
className={ `group w-full` } className={ `group w-full dark:bg-[#353540]` }
isPressable isPressable
isHoverable isHoverable
> >
+5 -1
View File
@@ -3,6 +3,7 @@
import React from 'react'; import React from 'react';
import { Chip } from '@nextui-org/react'; import { Chip } from '@nextui-org/react';
import { useRouter, useSearchParams } from 'next/navigation'; import { useRouter, useSearchParams } from 'next/navigation';
import { cn } from '@/src/utils';
interface TagChipProps { interface TagChipProps {
tagName: string, tagName: string,
@@ -37,7 +38,10 @@ const TagChip = ({ tagName, isHighlighted }: TagChipProps) => {
className="cursor-pointer relative" className="cursor-pointer relative"
> >
<Chip <Chip
className={ 'hover:border-amber-400 hover:dark:border-amber-700 transition-all' } className={ cn(
'hover:border-amber-400 hover:dark:border-amber-700 transition-all ',
!isHighlighted && 'dark:border-amber-50/25'
) }
variant={ 'bordered' } variant={ 'bordered' }
color={ isHighlighted ? 'warning' : 'default' } color={ isHighlighted ? 'warning' : 'default' }
>{ tagName }</Chip> >{ tagName }</Chip>
@@ -12,7 +12,7 @@ const ButtonGoBack = () => {
<Button <Button
startContent={ <IoArrowBackOutline /> } startContent={ <IoArrowBackOutline /> }
variant={ 'light' } variant={ 'light' }
onClick={ () => router.back() } onPress={ () => router.back() }
> >
{ 'Back' } { 'Back' }
</Button> </Button>
@@ -33,7 +33,7 @@ const Footer = (props: Props) => {
return ( return (
<div className={ `w-full` }> <div className={ `w-full` }>
<div className={ 'flex transition bg-zinc-300/80 dark:bg-gray-600/25' }> <div className={ 'flex transition bg-zinc-300/80 dark:bg-[#1c1c22]/50' }>
<div className={ `p-8 w-full overflow-hidden` }> <div className={ `p-8 w-full overflow-hidden` }>
<div className={ 'relative' }> <div className={ 'relative' }>
<FaCreativeCommons <FaCreativeCommons
@@ -12,9 +12,9 @@ const MinifyPostCard = (props: Props) => {
const { post, desc } = props; const { post, desc } = props;
const img_url = post['header_img'] as string; const img_url = post['header_img'] as string;
return ( return (
<div className={ 'w-full transition hover:brightness-75' }> <div className={ 'w-full transition hover:brightness-90' }>
<Card isFooterBlurred <Card isFooterBlurred
className="w-full h-[300px] shadow-none border-0 rounded-none overflow-hidden" className="w-full h-[300px] shadow-none border-0 rounded-none overflow-hidden dark:bg-[#353540]"
as={ Link } as={ Link }
isPressable isPressable
href={ `/blog/post/${ post['identifier'] }` } href={ `/blog/post/${ post['identifier'] }` }
@@ -16,7 +16,7 @@ async function PostCard(props: Props) {
return ( return (
<div> <div>
<Card className={ `max-w-full relative` }> <Card className={ `max-w-full relative dark:bg-[#34343e]` }>
{/* card headers */ } {/* card headers */ }
<Headers title={ post.title } <Headers title={ post.title }
@@ -10,7 +10,7 @@ const TagChip = ({ tag }: { tag: string }) => {
return ( return (
<div onClick={ () => router.push(`/blog?tags=${ tag }`) }> <div onClick={ () => router.push(`/blog?tags=${ tag }`) }>
<Chip <Chip
className={ 'hover:border-amber-400 hover:dark:border-amber-700 transition-all' } className={ 'hover:border-amber-400 hover:dark:border-amber-700 transition-all dark:bg-[#353540] dark:border-amber-50/25' }
variant={ 'faded' } variant={ 'faded' }
>{ tag }</Chip> >{ tag }</Chip>
</div> </div>
+3 -2
View File
@@ -7,7 +7,7 @@ services:
dockerfile: ../container/release/frontend.containerfile dockerfile: ../container/release/frontend.containerfile
restart: always restart: always
ports: ports:
- "3000:3000" - "0.0.0.0:3000:3000"
env_file: env_file:
- ./.env - ./.env
@@ -22,7 +22,7 @@ services:
ARCH: ${ARCH} ARCH: ${ARCH}
restart: always restart: always
ports: ports:
- "3001:3001" - "0.0.0.0:3001:3001"
env_file: env_file:
- ./.env - ./.env
- ./.env.local - ./.env.local
@@ -57,3 +57,4 @@ services:
timeout: 3s timeout: 3s
retries: 10 retries: 10
start_period: 5s start_period: 5s
restart: always
+54
View File
@@ -0,0 +1,54 @@
services:
frontend:
depends_on:
- backend
image: cr.lmt.moe/nocturne/frontend:${TAG}
restart: always
ports:
- "0.0.0.0:3000:3000"
env_file:
- ./.env
backend:
depends_on:
- migrate
image: cr.lmt.moe/nocturne/backend:${TAG}
restart: always
ports:
- "0.0.0.0:3001:3001"
env_file:
- ./.env
- ./.env.local
dns:
- 1.1.1.1
migrate:
image: postgres:17
depends_on:
postgres:
condition: service_healthy
env_file:
- ./.env
- ./.env.local
volumes:
- ./migration/ddl:/migrations:ro
- ./migration/migration.sh:/migration.sh:ro
entrypoint: [ "/bin/sh", "/migration.sh" ]
postgres:
image: postgres:17
ports:
- "5432:5432"
env_file:
- ./.env
- ./.env.local
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
restart: always