mirror of
https://github.com/immich-app/yucca.git
synced 2026-09-30 13:33:00 +08:00
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Restic API
|
||||
#
|
||||
|
||||
# RESTIC_API_PORT=
|
||||
|
||||
### JWT Verify
|
||||
|
||||
# JWT_PUBLIC_KEY=
|
||||
|
||||
### S3
|
||||
|
||||
# S3_ACCESS_KEY_ID=
|
||||
# S3_SECRET_ACCESS_KEY=
|
||||
# S3_REGION=
|
||||
# S3_ENDPOINT=
|
||||
# S3_FORCE_PATH_STYLE=
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Yucca API
|
||||
#
|
||||
|
||||
# YUCCA_API_PORT=
|
||||
|
||||
### JWT Signing
|
||||
|
||||
# Generate with:
|
||||
# openssl ecparam -name prime256v1 -genkey -noout -out priv.pem
|
||||
# openssl pkcs8 -topk8 -nocrypt -in priv.pem -out priv-pkcs8.pem
|
||||
# openssl ec -in priv.pem -pubout -out pub.pem
|
||||
|
||||
# JWT_PRIVATE_KEY=
|
||||
# JWT_EXPIRES_IN=
|
||||
|
||||
### Postgres DB
|
||||
|
||||
# POSTGRES_HOST=
|
||||
# POSTGRES_PORT=
|
||||
# POSTGRES_USERNAME=
|
||||
# POSTGRES_PASSWORD=
|
||||
# POSTGRES_DATABASE=
|
||||
# POSTGRES_SSL=
|
||||
|
||||
### Customer OIDC configuration
|
||||
OIDC_ISSUER="https://external-dev-gkhk8b.us1.zitadel.cloud"
|
||||
OIDC_CLIENT_ID="op://yucca_tf_dev/CUSTOMER_ZITADEL_OAUTH_CLIENT_ID_DEV_TEST/password"
|
||||
OIDC_CLIENT_SECRET="op://yucca_tf_dev/CUSTOMER_ZITADEL_OAUTH_CLIENT_SECRET_DEV_TEST/password"
|
||||
# OIDC_ALLOW_INSECURE=
|
||||
# OIDC_REQUIRE_PKCE=
|
||||
# OIDC_REDIRECT_URI=
|
||||
# OIDC_LOGOUT_REDIRECT_URI=
|
||||
# OIDC_SCOPE=
|
||||
|
||||
### ... temp
|
||||
# RESTIC_API_HOST=
|
||||
# RESTIC_API_PORT=
|
||||
# RESTIC_ENDPOINT=
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Development only
|
||||
#
|
||||
|
||||
# WEB_PORT=
|
||||
# ORCHESTRATOR_WEB_PORT=
|
||||
+1
-33
@@ -45,41 +45,9 @@ description = "Run all possible code fixes"
|
||||
run = [{ task = "*:fix" }, { task = "web:lingui" }]
|
||||
|
||||
[env]
|
||||
# default environment variables for development
|
||||
NODE_ENV = "development"
|
||||
YUCCA_API_PORT = 3020
|
||||
RESTIC_API_PORT = 3010
|
||||
S3_ACCESS_KEY_ID = "minio"
|
||||
S3_SECRET_ACCESS_KEY = "miniominio"
|
||||
S3_REGION = "minio"
|
||||
S3_ENDPOINT = "http://localhost:9000"
|
||||
S3_FORCE_PATH_STYLE = true
|
||||
POSTGRES_HOST = "localhost"
|
||||
POSTGRES_USERNAME = "postgres"
|
||||
POSTGRES_PASSWORD = "postgres"
|
||||
POSTGRES_DATABASE = "yucca"
|
||||
POSTGRES_PORT = 15432
|
||||
# openssl ecparam -name prime256v1 -genkey -noout -out priv.pem
|
||||
# openssl pkcs8 -topk8 -nocrypt -in priv.pem -out priv-pkcs8.pem
|
||||
# openssl ec -in priv.pem -pubout -out pub.pem
|
||||
JWT_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgCla79+Sip4o2hZ1K
|
||||
nQJYp2xU/nsCJmRoZmvXjeX6cW+hRANCAASkubBRIE7Sns/VS8ZF5XEVO8CwJ+AZ
|
||||
Ls1C0ncCcmRhqKA7UxLknn0ji5FcKaku1zBOhxQYcxFVmsYtAxZ1ljgN
|
||||
-----END PRIVATE KEY-----
|
||||
"""
|
||||
JWT_PUBLIC_KEY = """-----BEGIN PUBLIC KEY-----
|
||||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEpLmwUSBO0p7P1UvGReVxFTvAsCfg
|
||||
GS7NQtJ3AnJkYaigO1MS5J59I4uRXCmpLtcwTocUGHMRVZrGLQMWdZY4DQ==
|
||||
-----END PUBLIC KEY-----
|
||||
"""
|
||||
OIDC_ISSUER = "http://localhost:8092"
|
||||
OIDC_CLIENT_ID = "client ID"
|
||||
OIDC_CLIENT_SECRET = "client secret"
|
||||
OIDC_ALLOW_INSECURE = true
|
||||
OIDC_REDIRECT_URI = 'http://localhost:5173/api/auth/oidc/callback'
|
||||
OIDC_LOGOUT_REDIRECT_URI = 'http://localhost:5173'
|
||||
LOG_LEVEL = "debug"
|
||||
|
||||
OTLP_METRICS_ENDPOINT = "localhost:8428"
|
||||
OTLP_METRICS_URL_PATH = "/opentelemetry/v1/metrics"
|
||||
OTLP_LOGS_ENDPOINT = "localhost:9428"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run michael in development mode"
|
||||
set -e
|
||||
source "$(dirname "$0")/../restic-api/env"
|
||||
|
||||
cd packages/michael && go run .
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run end-to-end tests for michael"
|
||||
#MISE description="Run integration tests for michael"
|
||||
set -e
|
||||
|
||||
cd packages/michael && go test -tags integration ./... "$@"
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run restic-api in development mode"
|
||||
set -e
|
||||
source "$(dirname "$0")/env"
|
||||
|
||||
pnpm --filter restic-api start:dev
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export RESTIC_API_PORT=${RESTIC_API_PORT:-3010}
|
||||
|
||||
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY:------BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgCla79+Sip4o2hZ1K
|
||||
nQJYp2xU/nsCJmRoZmvXjeX6cW+hRANCAASkubBRIE7Sns/VS8ZF5XEVO8CwJ+AZ
|
||||
Ls1C0ncCcmRhqKA7UxLknn0ji5FcKaku1zBOhxQYcxFVmsYtAxZ1ljgN
|
||||
-----END PRIVATE KEY-----
|
||||
}
|
||||
export JWT_PUBLIC_KEY=${JWT_PUBLIC_KEY:------BEGIN PUBLIC KEY-----
|
||||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEpLmwUSBO0p7P1UvGReVxFTvAsCfg
|
||||
GS7NQtJ3AnJkYaigO1MS5J59I4uRXCmpLtcwTocUGHMRVZrGLQMWdZY4DQ==
|
||||
-----END PUBLIC KEY-----
|
||||
}
|
||||
|
||||
export S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID:-minio}
|
||||
export S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY:-miniominio}
|
||||
export S3_REGION=${S3_REGION:-minio}
|
||||
export S3_ENDPOINT=${S3_ENDPOINT:-http://localhost:9000}
|
||||
export S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE:-true}
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run unit tests for restic-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter restic-api test "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run integration tests for restic-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter restic-api test:integration "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run unit tests in watch mode for restic-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter restic-api test --watch "$@"
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
#MISE description="Run all end-to-end tests"
|
||||
#MISE depends=["test:e2e:wait"]
|
||||
set -e
|
||||
source "$(dirname "$0")/../../restic-api/env"
|
||||
source "$(dirname "$0")/../../yucca-api/env"
|
||||
|
||||
pnpm --filter e2e test "$@"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Wait for development environment to be ready"
|
||||
set -e
|
||||
source "$(dirname "$0")/../../restic-api/env"
|
||||
source "$(dirname "$0")/../../yucca-api/env"
|
||||
|
||||
echo Ensure dev environment is running before invoking tests.
|
||||
|
||||
@@ -16,6 +18,6 @@ while ! nc -z localhost "22676" 2>/dev/null; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
while ! nc -z localhost "5173" 2>/dev/null; do
|
||||
while ! nc -z localhost "36033" 2>/dev/null; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
+3
-1
@@ -2,5 +2,7 @@
|
||||
#MISE description="Run web in development mode"
|
||||
#MISE depends=["yucca-api-client:build", "common:build", "web:lingui:compile", "yucca-sdk:orchestration-ui:build"]
|
||||
set -e
|
||||
source "$(dirname "$0")/../yucca-api/env"
|
||||
export WEB_PORT=${WEB_PORT:-36033}
|
||||
|
||||
pnpm --filter web dev --host
|
||||
pnpm --filter web dev --host --port $WEB_PORT
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run yucca-api in development mode"
|
||||
#MISE depends=["common:build"]
|
||||
#MISE dir="{{config_root}}"
|
||||
set -e
|
||||
source "$(dirname "$0")/env"
|
||||
|
||||
pnpm --filter yucca-api start:dev
|
||||
op run --env-file="./.env" -- pnpm --filter yucca-api start:dev
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export YUCCA_API_PORT=${YUCCA_API_PORT:-3020}
|
||||
|
||||
export POSTGRES_HOST=${POSTGRES_HOST:-localhost}
|
||||
export POSTGRES_USERNAME=${POSTGRES_USERNAME:-postgres}
|
||||
export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
|
||||
export POSTGRES_DATABASE=${POSTGRES_DATABASE:-yucca}
|
||||
export POSTGRES_PORT=${POSTGRES_PORT:-15432}
|
||||
|
||||
export JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY:------BEGIN PRIVATE KEY-----
|
||||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgCla79+Sip4o2hZ1K
|
||||
nQJYp2xU/nsCJmRoZmvXjeX6cW+hRANCAASkubBRIE7Sns/VS8ZF5XEVO8CwJ+AZ
|
||||
Ls1C0ncCcmRhqKA7UxLknn0ji5FcKaku1zBOhxQYcxFVmsYtAxZ1ljgN
|
||||
-----END PRIVATE KEY-----
|
||||
}
|
||||
|
||||
export OIDC_ISSUER=${OIDC_ISSUER:-http://localhost:8092}
|
||||
export OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-client ID}
|
||||
export OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-client secret}
|
||||
export OIDC_ALLOW_INSECURE=${OIDC_ALLOW_INSECURE:-true}
|
||||
export OIDC_REDIRECT_URI=${OIDC_REDIRECT_URI:-http://localhost:36033/api/auth/oidc/callback}
|
||||
export OIDC_LOGOUT_REDIRECT_URI=${OIDC_LOGOUT_REDIRECT_URI:-http://localhost:36033}
|
||||
|
||||
# ... temp
|
||||
export RESTIC_API_PORT=${RESTIC_API_PORT:-3010}
|
||||
@@ -2,5 +2,6 @@
|
||||
#MISE description="yucca-api: database migrations script"
|
||||
#MISE dir="{{config_root}}/packages/yucca-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/env"
|
||||
|
||||
pnpm exec sql-tools -u "postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}" "$@"
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
#MISE dir="{{config_root}}/packages/yucca-api"
|
||||
#MISE depends=["yucca-api:build"]
|
||||
set -e
|
||||
source "$(dirname "$0")/env"
|
||||
|
||||
node dist/bin/sync-openapi.js
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run unit tests for yucca-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter yucca-api test "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run integration tests for yucca-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter yucca-api test:integration "$@"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run unit tests in watch mode for yucca-api"
|
||||
set -e
|
||||
source "$(dirname "$0")/../env"
|
||||
|
||||
pnpm --filter yucca-api test --watch "$@"
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#MISE description="Run yucca-sdk/orchestration-ui in development mode"
|
||||
#MISE depends=["yucca-sdk:orchestration-ui:generate-fetch-client"]
|
||||
set -e
|
||||
export ORCHESTRATOR_WEB_PORT=${ORCHESTRATOR_WEB_PORT:-36066}
|
||||
|
||||
pnpm --filter orchestration-ui dev --host
|
||||
pnpm --filter orchestration-ui dev --host --port $ORCHESTRATOR_WEB_PORT
|
||||
|
||||
@@ -4,10 +4,19 @@ Ensure you have prerequisites installed:
|
||||
|
||||
- [Docker](https://docs.docker.com/engine/install/)
|
||||
- [mise](https://mise.jdx.dev/getting-started.html)
|
||||
- [1password CLI](https://developer.1password.com/docs/cli/)
|
||||
|
||||
If necessary, copy `.env.example` to `.env` and customise.
|
||||
|
||||
Then use mise:
|
||||
|
||||
```bash
|
||||
mise dev # install deps, prep environment, start servers
|
||||
mise check # run all CI checks
|
||||
|
||||
mise check # lint, format check, svelte check
|
||||
|
||||
mise test # unit tests
|
||||
mise test:integration # integration tests
|
||||
mise test:e2e # e2e tests
|
||||
mise test:e2e:web # e2e web tests
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('user can log in and see backups page', async ({ page }) => {
|
||||
await page.goto('http://localhost:5173/');
|
||||
await page.goto('http://localhost:36033/');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.getByRole('button', { name: 'Login' })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Login' }).click();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"test:unit": "vitest run",
|
||||
"test": "npm run test:unit -- --run && npm run test:e2e",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:create": "playwright codegen http://localhost:5173",
|
||||
"test:e2e:create": "playwright codegen http://localhost:36033",
|
||||
"lingui:extract": "lingui extract",
|
||||
"lingui:compile": "lingui compile --typescript"
|
||||
},
|
||||
|
||||
@@ -5,12 +5,12 @@ import { ORCHESTRATION_PORT, OrchestrationApiModule } from '../src';
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(
|
||||
OrchestrationApiModule.forRoot({
|
||||
yuccaProductionApi: 'http://localhost:5173',
|
||||
yuccaProductionApi: 'http://localhost:36033',
|
||||
developmentMode: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.enableCors({ origin: 'http://localhost:5174' });
|
||||
app.enableCors({ origin: 'http://localhost:36066' });
|
||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
|
||||
app.setGlobalPrefix('api');
|
||||
await app.listen(ORCHESTRATION_PORT, '127.0.0.1');
|
||||
|
||||
@@ -10,7 +10,7 @@ test.beforeAll(async () => {
|
||||
});
|
||||
|
||||
test('user can log in', async ({ page }) => {
|
||||
await page.goto('http://localhost:5174/');
|
||||
await page.goto('http://localhost:36066/');
|
||||
await expect(page.getByText('Welcome to backups')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
@@ -32,7 +32,7 @@ test('user can log in', async ({ page }) => {
|
||||
});
|
||||
|
||||
test('user can create backup', async ({ page }) => {
|
||||
await page.goto('http://localhost:5174/');
|
||||
await page.goto('http://localhost:36066/');
|
||||
await page.getByRole('button', { name: 'Backups', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Create new backup' }).click();
|
||||
await page.getByRole('textbox', { name: 'Name' }).fill('My Backup');
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"test:unit": "vitest --run",
|
||||
"test": "npm run test:unit && npm run test:e2e",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:create": "playwright codegen http://localhost:5174",
|
||||
"test:e2e:create": "playwright codegen http://localhost:36066",
|
||||
"generate:fetch-client": "oazapfts --optimistic ../orchestration-api/openapi-specs.json src/lib/fetch-client.ts"
|
||||
},
|
||||
"files": [
|
||||
|
||||
Reference in New Issue
Block a user