secondary testing pds

main
Charlotte Som 2024-11-26 20:02:15 +00:00
parent a1786688b8
commit 4f7eaf864a
10 changed files with 4235 additions and 1 deletions

View File

@ -8,6 +8,7 @@
];
source_directories = [
"/srv/pds"
"/srv/pds-testing/data"
];
encryption_passcommand = "${pkgs.coreutils}/bin/cat /root/.borg_password";

View File

@ -2,7 +2,11 @@
environment.systemPackages = with pkgs; [
vim
tmux
] ++ [ unstable-pkgs.deno ];
] ++ [
unstable-pkgs.deno
unstable-pkgs.sqlite-interactive
unstable-pkgs.httpie
];
programs.vim.defaultEditor = true;
environment.variables = {

View File

@ -4,3 +4,4 @@ mkdir out 2>/dev/null || true
deno run ./default.ts > out/default.conf
deno run ./pds.ts > out/pds.conf
deno run ./char-bun-how.ts > out/char-bun-how.conf
deno run ./pds-testing.ts > out/pds-testing.conf

29
ngx/pds-testing.ts Normal file
View File

@ -0,0 +1,29 @@
import ngx from "jsr:@char/ngx@0.1";
export const config = ngx("", [
ngx("map $http_upgrade $connection_upgrade", [
"default upgrade",
"'' close"
]),
[],
ngx("server", [
[
"server_name pds-testing.bun.how",
...ngx.listen(),
...ngx.letsEncrypt("pds-testing.bun.how"),
],
ngx("location /", [
"client_max_body_size 1G",
"proxy_pass http://127.0.0.8:2583",
"proxy_http_version 1.1",
"proxy_set_header Upgrade $http_upgrade",
"proxy_set_header Connection $connection_upgrade",
"proxy_set_header Host $host",
"proxy_read_timeout 300s",
]),
ngx("location = /hi-res-bnuy.png", ["root /srv/www/pds.bun.how"]),
ngx("location = /", ["root /srv/www/pds.bun.how", "index hi-res-bnuy.png"]),
]),
]);
if (import.meta.main) console.log(config.build());

3
pds-testing/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/data
/node_modules
/.env

23
pds-testing/flake.lock Normal file
View File

@ -0,0 +1,23 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
"path": "/nix/store/ly4s3hw35dd1c2vsd694y2715pc1d2c1-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

14
pds-testing/flake.nix Normal file
View File

@ -0,0 +1,14 @@
{
description = "pds-testing";
outputs = { self, nixpkgs }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
devShells."x86_64-linux".default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs_22
pkgs.pnpm
];
};
};
}

31
pds-testing/index.js Normal file
View File

@ -0,0 +1,31 @@
"use strict"
require("dotenv").config();
const { envStr } = require("@atproto/common");
const { PDS, envToCfg, envToSecrets, readEnv } = require("@atproto/pds");
const pkg = require("@atproto/pds/package.json");
const process = require("node:process")
const main = async () => {
const env = readEnv();
env.version ||= pkg.version;
const cfg = envToCfg(env);
const secrets = envToSecrets(env);
const pds = await PDS.create(cfg, secrets);
// allow listening on non-0.0.0.0 addresses
const host = envStr("BIND_HOST") ?? "127.0.0.1";
const oListen = pds.app.listen;
pds.app.listen = (port, ...args) => {
return oListen(port, host, ...args);
}
await pds.start();
process.on("SIGTERM", async () => {
await pds.destroy();
});
};
main();

17
pds-testing/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "pds-testing",
"private": true,
"version": "0.0.0",
"description": "Service entrypoint for atproto personal data server",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@atproto/common": "^0.4.4",
"@atproto/pds": "0.4.71",
"dotenv": "^16.4.5",
"express": "^4.21.1"
},
"devDependencies": {
"@types/express": "^5.0.0"
}
}

4111
pds-testing/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff