mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 18:36:21 +00:00
Compare commits
4
Commits
eac84307bf
...
release
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c7602123 | ||
|
|
6da6231c92 | ||
|
|
19f84d2188 | ||
|
|
20c2964242 |
No files matched your search
@@ -1,19 +1,19 @@
|
|||||||
# postgres settings
|
# postgres settings
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
POSTGRES_PASSWORD=
|
#POSTGRES_PASSWORD=
|
||||||
POSTGRES_USER=
|
POSTGRES_USER=nocturne
|
||||||
POSTGRES_DB=nocturne
|
POSTGRES_DB=nocturne
|
||||||
|
POSTGRES_HOST=postgres
|
||||||
|
|
||||||
# backend settings
|
# backend settings
|
||||||
|
|
||||||
#GIT_WORK_DIR=../blog_posts_git
|
#GIT_WORK_DIR=../blog_posts_git
|
||||||
#LOG_ROOT_DIR=/var/log/nocturne
|
#LOG_ROOT_DIR=/var/log/nocturne
|
||||||
|
#BLOG_ENDPOINT=https://github.com/Lumither/blog-posts.git
|
||||||
BLOG_ENDPOINT=https://github.com/Lumither/blog-posts.git
|
BLOG_GIT_URL=https://github.com/Lumither/blog-posts.git
|
||||||
WORK_DIR=~/.nocturne
|
WORK_DIR=/nocturne
|
||||||
BACKEND_PORT=3001
|
#BACKEND_PORT=3001
|
||||||
|
|
||||||
# frontend settings
|
# frontend settings
|
||||||
API_LOCAL_URL=http://localhost:3001
|
API_LOCAL_URL=http://backend:3001
|
||||||
API_REMOTE_URL=https://lumither.com/api
|
API_REMOTE_URL=https://lumither.com/api
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
ddev:
|
ARCH := $(shell uname -m)
|
||||||
|
ifeq ($(ARCH), arm64)
|
||||||
|
ARCH := aarch64
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: release
|
||||||
|
|
||||||
|
release:
|
||||||
|
docker compose -f prod.compose.yaml build --build-arg ARCH=$(ARCH)
|
||||||
|
|
||||||
|
dev:
|
||||||
docker-compose -f dev.compose.yaml up --build
|
docker-compose -f dev.compose.yaml up --build
|
||||||
|
|
||||||
dclean:
|
clean:
|
||||||
docker-compose -f dev.compose.yaml rm -fsv
|
docker-compose -f prod.compose.yaml -f dev.compose.yaml rm -fsv
|
||||||
|
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
# `Nocturne: personal website & CMS`
|
# `Nocturne: personal website & CMS`
|
||||||
|
|
||||||
|
> This is the last working version
|
||||||
|
|
||||||
This is the code repo of my personal website, and [here](https://github.com/Lumither/blog-posts/) is the link of the
|
This is the code repo of my personal website, and [here](https://github.com/Lumither/blog-posts/) is the link of the
|
||||||
content repo.
|
content repo.
|
||||||
|
|
||||||
Powered by Next.js and Rust, built with passion and love
|
Powered by Next.js and Rust, built with passion and love
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="https://avatars.githubusercontent.com/u/46409277?v=4" alt="GitHub Avatar"/>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
*will add more here in the future
|
*will add more here in the future
|
||||||
|
|
||||||
## Nav:
|
## Nav:
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
|
|
||||||
|
/Cargo.lock
|
||||||
@@ -7,7 +7,7 @@ pub mod check_update;
|
|||||||
pub fn get_tasks(db_connection: Pool<Postgres>) -> Vec<Box<dyn Task>> {
|
pub fn get_tasks(db_connection: Pool<Postgres>) -> Vec<Box<dyn Task>> {
|
||||||
let db_conn_clone = db_connection.clone();
|
let db_conn_clone = db_connection.clone();
|
||||||
vec![
|
vec![
|
||||||
BasicTask::new(move || check_update::task(&db_conn_clone), "0 * * * * *")
|
BasicTask::new(move || check_update::task(&db_conn_clone), "0/15 * * * * *")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_task(),
|
.to_task(),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
FROM rust:latest AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN ["cargo", "build", "-r"]
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/cc AS production
|
||||||
|
ARG ARCH
|
||||||
|
COPY --from=builder /app/target/release/api_server ./api_server
|
||||||
|
COPY --from=builder /usr/lib/${ARCH}-linux-gnu/libz.so.1 /usr/lib/${ARCH}-linux-gnu/
|
||||||
|
ENTRYPOINT ["./api_server"]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
FROM node:22 AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/nodejs22 AS production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
COPY --from=builder /app/next.config.mjs ./
|
||||||
|
COPY --from=builder /app/.next/standalone ./
|
||||||
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
CMD ["./server.js"]
|
||||||
+2
-2
@@ -5,7 +5,7 @@ services:
|
|||||||
dockerfile: ../container/dev/frontend.containerfile
|
dockerfile: ../container/dev/frontend.containerfile
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./frontend:/app
|
- ./frontend:/app
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
@@ -22,7 +22,7 @@ services:
|
|||||||
dockerfile: ../container/dev/backend.containerfile
|
dockerfile: ../container/dev/backend.containerfile
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 3001:3001
|
- "3001:3001"
|
||||||
volumes:
|
volumes:
|
||||||
- ./blog_posts_git:/app/blog_posts_git:ro
|
- ./blog_posts_git:/app/blog_posts_git:ro
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
/.next/
|
/.next
|
||||||
/out/
|
/out
|
||||||
/build
|
/build
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const Footer = (props: Props) => {
|
|||||||
const author = post['meta']['author'] ?? 'Tao';
|
const author = post['meta']['author'] ?? 'Tao';
|
||||||
const author_link = post['meta']['author_link'] ?? '/about';
|
const author_link = post['meta']['author_link'] ?? '/about';
|
||||||
const post_date = new Date(post['first_update']);
|
const post_date = new Date(post['first_update']);
|
||||||
const update_date = new Date(post['last_update']);
|
const update_date: Date | undefined = post['last_update'] ? new Date(post['last_update']) : undefined;
|
||||||
const cc = post['meta']['cc'] ?? 'by-nc-sa';
|
const cc = post['meta']['cc'] ?? 'by-nc-sa';
|
||||||
|
|
||||||
|
|
||||||
@@ -55,6 +55,7 @@ const Footer = (props: Props) => {
|
|||||||
year: `numeric`
|
year: `numeric`
|
||||||
}) }</p>
|
}) }</p>
|
||||||
</div>
|
</div>
|
||||||
|
{ update_date &&
|
||||||
<div>
|
<div>
|
||||||
<p className={ 'text-lg font-bold' }>Updated on</p>
|
<p className={ 'text-lg font-bold' }>Updated on</p>
|
||||||
<p>{ update_date.toLocaleString('default', {
|
<p>{ update_date.toLocaleString('default', {
|
||||||
@@ -63,6 +64,7 @@ const Footer = (props: Props) => {
|
|||||||
year: `numeric`
|
year: `numeric`
|
||||||
}) }</p>
|
}) }</p>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
<div>
|
<div>
|
||||||
<p className={ 'text-lg font-bold' }>Published under</p>
|
<p className={ 'text-lg font-bold' }>Published under</p>
|
||||||
<Link href={ `https://creativecommons.org/licenses/${ cc }/4.0/` }>
|
<Link href={ `https://creativecommons.org/licenses/${ cc }/4.0/` }>
|
||||||
|
|||||||
@@ -3,7 +3,16 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Button } from '@nextui-org/react';
|
import { Button } from '@nextui-org/react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { IoHome, IoInformationCircle, IoLink, IoLogoGithub, IoMail, IoPencil, IoSearch } from 'react-icons/io5';
|
import {
|
||||||
|
IoFlask,
|
||||||
|
IoHome,
|
||||||
|
IoInformationCircle,
|
||||||
|
IoLink,
|
||||||
|
IoLogoGithub,
|
||||||
|
IoMail,
|
||||||
|
IoPencil,
|
||||||
|
IoSearch
|
||||||
|
} from 'react-icons/io5';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import ThemeSwitcher from '@/components/ThemeSwitcher';
|
import ThemeSwitcher from '@/components/ThemeSwitcher';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
@@ -34,6 +43,10 @@ const entries: { display_name: string; href: string; icon: React.ReactNode }[] =
|
|||||||
icon: <IoSearch size={ `20px` }></IoSearch>,
|
icon: <IoSearch size={ `20px` }></IoSearch>,
|
||||||
display_name: 'Search',
|
display_name: 'Search',
|
||||||
href: '/search'
|
href: '/search'
|
||||||
|
}, {
|
||||||
|
icon: <IoFlask size={ '20px' } />,
|
||||||
|
display_name: 'Lab',
|
||||||
|
href: 'https://lab.lmt.moe'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -51,18 +64,6 @@ const connections: { label: string, href: string, icon: React.ReactNode }[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function Navbar() {
|
function Navbar() {
|
||||||
// const [ scrolled, setScrolled ] = useState(false);
|
|
||||||
// useEffect(() => {
|
|
||||||
// const handleScroll = () => {
|
|
||||||
// const isScrolled = window.scrollY > 0;
|
|
||||||
// setScrolled(isScrolled);
|
|
||||||
// };
|
|
||||||
// window.addEventListener('scroll', handleScroll);
|
|
||||||
// return () => {
|
|
||||||
// window.removeEventListener('scroll', handleScroll);
|
|
||||||
// };
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
|
|
||||||
const path = usePathname();
|
const path = usePathname();
|
||||||
const [ shownPath, setShownPath ] = useState(path);
|
const [ shownPath, setShownPath ] = useState(path);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const nextConfig = {
|
|||||||
hostname: 'pic.re'
|
hostname: 'pic.re'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
// output: 'standalone'
|
output: 'standalone'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: ../container/release/frontend.containerfile
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
|
||||||
|
|
||||||
|
backend:
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
build:
|
||||||
|
context: ./backend
|
||||||
|
dockerfile: ../container/release/backend.containerfile
|
||||||
|
args:
|
||||||
|
ARCH: ${ARCH}
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "3001:3001"
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
- ./.env.local
|
||||||
|
dns:
|
||||||
|
- 1.1.1.1
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:16.3
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
- ./.env.local
|
||||||
Reference in new issue
Block a user