Compare commits
8 Commits
346d7b8bcd
...
0.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 726d9c5a09 | |||
| 7826018d61 | |||
| 16d72f40ce | |||
| 50cee580de | |||
| fb4bb63335 | |||
| f07e688bf1 | |||
| 7d1c7a6c75 | |||
| e90ffabf8b |
@ -4,7 +4,7 @@ on: [push]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: rust-latest
|
runs-on: rust-nextest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: rust-latest
|
runs-on: rust-nextest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
@ -41,7 +41,7 @@ jobs:
|
|||||||
run: cargo build --release --locked
|
run: cargo build --release --locked
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: rust-latest
|
runs-on: rust-nextest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
@ -55,8 +55,8 @@ jobs:
|
|||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
backend/target
|
backend/target
|
||||||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
|
||||||
- name: Build Binary with Shutdown
|
- name: Build Binary
|
||||||
run: cargo build --features shutdown --bin nuchat
|
run: cargo build --locked --bin nuchat
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: ./scripts/test.sh
|
run: ./scripts/test.sh
|
||||||
- name: Upload Test Logs
|
- name: Upload Test Logs
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
.env
|
.env
|
||||||
|
package/
|
||||||
|
package.tar.zst
|
||||||
|
|||||||
@ -28,5 +28,6 @@ path = "src/main.rs"
|
|||||||
name ="nuchat"
|
name ="nuchat"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = [ "shutdown" ]
|
||||||
|
all = ["shutdown"]
|
||||||
shutdown = []
|
shutdown = []
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
build:
|
build:
|
||||||
cargo build --features shutdown
|
cargo build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
cargo run --features shutdown
|
cargo run
|
||||||
|
|
||||||
start:
|
start:
|
||||||
cargo run --features shutdown 2>&1 > logs/nuchat.log
|
cargo run 2>&1 > logs/nuchat.log
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./scripts/test.sh
|
./scripts/test.sh
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
# Backend
|
# Backend
|
||||||
|
|
||||||
Generate random secret using. This secret will be used to authenticate users on all `/admin` routes
|
Generate random secret using openssl. This secret will be used to authenticate users on all `/admin` routes.
|
||||||
|
If no secret is given then no authentication will be required
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ADMIN_SECRET=$(openssl rand --base64 32)
|
nuchat --admin-secret $(openssl rand --base64 32)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@ -11,5 +12,5 @@ ADMIN_SECRET=$(openssl rand --base64 32)
|
|||||||
### shutdown
|
### shutdown
|
||||||
this feature enables an endpoint that allows you to shutdown the server.
|
this feature enables an endpoint that allows you to shutdown the server.
|
||||||
|
|
||||||
**WARNING**: If the `ADMIN_SECRET` env var is not set then this endpoint is completely exposed and allows anyone to shutdown the server.
|
**WARNING**: If the `admin-secret` flag is not set then this endpoint is completely exposed and allows anyone to shutdown the server.
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! command -v cargo-nextest > /dev/null 2>&1; then
|
||||||
|
echo "Command not found cargo-nextest"
|
||||||
|
echo "Try installing with cargo install cargo-nextest"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d logs ]; then
|
if [ ! -d logs ]; then
|
||||||
mkdir logs
|
mkdir logs
|
||||||
fi
|
fi
|
||||||
@ -8,7 +14,7 @@ fi
|
|||||||
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
|
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
|
||||||
|
|
||||||
# start server
|
# start server
|
||||||
cargo run --features shutdown -- --port 7001 2>&1 > logs/nuchat.log &
|
cargo run -- --port 7001 2>&1 > logs/nuchat.log &
|
||||||
|
|
||||||
# run tests
|
# run tests
|
||||||
cargo nextest run 2>&1 | tee logs/test-output.log
|
cargo nextest run --color=always 2>&1 | tee logs/test-output.log
|
||||||
|
|||||||
36
scripts/environ.sh
Normal file
36
scripts/environ.sh
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function check_tags() {
|
||||||
|
TAGS="$(git tag --points-at HEAD)"
|
||||||
|
if [ -n "$TAGS" ]; then
|
||||||
|
TAG=$(echo "$TAGS" | grep -E '^v[0-9]+.[0-9]+.[0-9]+$' | sort -V | tail -1)
|
||||||
|
else
|
||||||
|
echo "No release tag found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function package() {
|
||||||
|
PACKAGE_DIR="${PACKAGE_DIR:-package}"
|
||||||
|
mkdir "$PACKAGE_DIR" > /dev/null 2>&1
|
||||||
|
|
||||||
|
pushd backend
|
||||||
|
cargo build --release
|
||||||
|
cp -v target/release/nuchat ../package/
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd ui
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
cp -rv .output ../package/ui
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
OUT_FILE="${OUT_FILE:-package.tar.zst}"
|
||||||
|
if [ -f "$OUT_FILE" ]; then
|
||||||
|
rm "$OUT_FILE" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar -cf - package/ | zstd -19 -T0 -o "${OUT_DIR}${OUT_FILE}"
|
||||||
|
}
|
||||||
|
|
||||||
25
scripts/release.sh
Executable file
25
scripts/release.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
. ./scripts/environ.sh
|
||||||
|
|
||||||
|
check_tags
|
||||||
|
if [ -n "$TAG" ]; then
|
||||||
|
echo "Found tag $TAG"
|
||||||
|
RELEASE_VERSION=$(echo "$TAG" | sed 's/v//')
|
||||||
|
echo "Releasing $RELEASE_VERSION"
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
package
|
||||||
|
|
||||||
|
if [ ! -f package.tar.zst ]; then
|
||||||
|
echo "failed to generate package"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -s -X PUT \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
--upload-file "$OUT_DIR$OUT_FILE" \
|
||||||
|
"https://git.molloy.xyz/api/packages/fergus-molloy/generic/nuchat/$RELEASE_VERSION/nuchat.tar.zst"
|
||||||
@ -2,11 +2,5 @@
|
|||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: '2025-07-15',
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
|
modules: ['@nuxt/eslint', '@nuxt/icon', '@nuxt/test-utils']
|
||||||
modules: [
|
})
|
||||||
'@nuxt/eslint',
|
|
||||||
'@nuxt/icon',
|
|
||||||
'@nuxt/image',
|
|
||||||
'@nuxt/test-utils'
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|||||||
14387
ui/package-lock.json
generated
Normal file
14387
ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,11 +11,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/eslint": "1.6.0",
|
"@nuxt/eslint": "1.6.0",
|
||||||
"@nuxt/icon": "1.15.0",
|
"@nuxt/icon": "^1.15.0",
|
||||||
"@nuxt/image": "1.10.0",
|
"@nuxt/test-utils": "^3.19.2",
|
||||||
"@nuxt/test-utils": "3.19.2",
|
"nuxt": "^4.0.1",
|
||||||
"eslint": "^9.31.0",
|
|
||||||
"nuxt": "^4.0.0",
|
|
||||||
"vue": "^3.5.17",
|
"vue": "^3.5.17",
|
||||||
"vue-router": "^4.5.1"
|
"vue-router": "^4.5.1"
|
||||||
}
|
}
|
||||||
|
|||||||
9958
ui/pnpm-lock.yaml
generated
9958
ui/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user