Leon4gr45 commited on
Commit
d381974
·
verified ·
1 Parent(s): 34ed794

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -71,9 +71,9 @@ ENV NODE_ENV=production \
71
  USER_UID=${USER_UID} \
72
  USER_GID=${USER_GID} \
73
  PAPERCLIP_CONFIG=/paperclip/instances/default/config.json \
74
- PAPERCLIP_DEPLOYMENT_MODE=authenticated \
75
  BETTER_AUTH_SECRET=hf_hf_tdYWGdkAgCjNRgshPwvOddOItzxSrhOeQY \
76
- PAPERCLIP_DEPLOYMENT_EXPOSURE=private \
77
  OPENCODE_ALLOW_ALL_MODELS=true \
78
  PAPERCLIP_ALLOWED_HOSTNAMES=leon4gr45-openagenticresearch.hf.space
79
 
 
71
  USER_UID=${USER_UID} \
72
  USER_GID=${USER_GID} \
73
  PAPERCLIP_CONFIG=/paperclip/instances/default/config.json \
74
+ PAPERCLIP_DEPLOYMENT_MODE=single_user \
75
  BETTER_AUTH_SECRET=hf_hf_tdYWGdkAgCjNRgshPwvOddOItzxSrhOeQY \
76
+ PAPERCLIP_DEPLOYMENT_EXPOSURE=public \
77
  OPENCODE_ALLOW_ALL_MODELS=true \
78
  PAPERCLIP_ALLOWED_HOSTNAMES=leon4gr45-openagenticresearch.hf.space
79
 
fix_app_routes.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ git checkout server/src/app.ts
3
+ cat << 'INNER_EOF' > patch_logs_and_url.ts
4
+
5
+ app.get("/logs", (req, res) => {
6
+ try {
7
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
8
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
9
+ res.status(200).set("Content-Type", "text/plain").send(logs);
10
+ } else {
11
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet. Please wait...");
12
+ }
13
+ } catch (e) {
14
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
15
+ }
16
+ });
17
+
18
+ app.get("/url", (req, res) => {
19
+ try {
20
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
21
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
22
+ const match = logs.match(/https?:\/\/[^\s]+/);
23
+ if (match) {
24
+ res.status(200).set("Content-Type", "text/plain").send(match[0]);
25
+ } else {
26
+ res.status(200).set("Content-Type", "text/plain").send("URL not found in logs yet.");
27
+ }
28
+ } else {
29
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet.");
30
+ }
31
+ } catch (e) {
32
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
33
+ }
34
+ });
35
+
36
+ INNER_EOF
37
+ sed -i '/const app = express();/r patch_logs_and_url.ts' server/src/app.ts
patch_logs_and_url.ts ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ app.get("/logs", (req, res) => {
3
+ try {
4
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
5
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
6
+ res.status(200).set("Content-Type", "text/plain").send(logs);
7
+ } else {
8
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet. Please wait...");
9
+ }
10
+ } catch (e) {
11
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
12
+ }
13
+ });
14
+
15
+ app.get("/url", (req, res) => {
16
+ try {
17
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
18
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
19
+ const match = logs.match(/https?:\/\/[^\s]+/);
20
+ if (match) {
21
+ res.status(200).set("Content-Type", "text/plain").send(match[0]);
22
+ } else {
23
+ res.status(200).set("Content-Type", "text/plain").send("URL not found in logs yet.");
24
+ }
25
+ } else {
26
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet.");
27
+ }
28
+ } catch (e) {
29
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
30
+ }
31
+ });
32
+
scripts/docker-entrypoint.sh CHANGED
@@ -26,59 +26,4 @@ if [ "$changed" = "1" ]; then
26
  chown -R node:node /paperclip
27
  fi
28
 
29
- export PAPERCLIP_DEPLOYMENT_MODE=authenticated
30
- export PAPERCLIP_DEPLOYMENT_EXPOSURE=private
31
-
32
- # In background, wait a bit for server to start up, then bootstrap CEO
33
- (
34
- sleep 10
35
- echo "Onboarding environment and bootstrapping CEO..."
36
- echo "Running default setup manually..." > /paperclip/bootstrap_logs.txt
37
- mkdir -p /paperclip/instances/default/db
38
- mkdir -p /paperclip/instances/default/data/logs
39
- mkdir -p /paperclip/instances/default/data/artifacts
40
-
41
- cat << 'JSONEOF' > /paperclip/instances/default/config.json
42
- {
43
- "$meta": {
44
- "version": 1,
45
- "createdAt": "2026-04-06T19:20:00.000Z",
46
- "updatedAt": "2026-04-06T19:20:00.000Z",
47
- "source": "onboard"
48
- },
49
- "instanceId": "default",
50
- "deployment": {
51
- "exposure": "private",
52
- "mode": "authenticated",
53
- "authOrigin": null,
54
- "uiMode": "static"
55
- },
56
- "database": {
57
- "engine": "embedded-postgres",
58
- "path": "/paperclip/instances/default/db"
59
- },
60
- "server": {
61
- "port": 7860
62
- },
63
- "storage": {
64
- "engine": "local",
65
- "root": "/paperclip/instances/default/data/artifacts"
66
- },
67
- "logging": {
68
- "level": "info",
69
- "dir": "/paperclip/instances/default/data/logs",
70
- "mode": "file"
71
- },
72
- "agent": {
73
- "jwtSecret": "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"
74
- }
75
- }
76
- JSONEOF
77
- echo "Wrote default config.json. Bootstrapping CEO and generating invite URL..." >> /paperclip/bootstrap_logs.txt
78
- # explicitly pass deployment mode to override env/defaults just in case
79
- PAPERCLIP_DEPLOYMENT_MODE=authenticated PAPERCLIP_DEPLOYMENT_EXPOSURE=private gosu node node --import ./server/node_modules/tsx/dist/loader.mjs ./cli/src/index.ts auth bootstrap-ceo >> /paperclip/bootstrap_logs.txt 2>&1
80
- ) &
81
-
82
- export PAPERCLIP_DEPLOYMENT_MODE=authenticated
83
- export PAPERCLIP_DEPLOYMENT_EXPOSURE=private
84
- exec gosu node node --import ./server/node_modules/tsx/dist/loader.mjs server/dist/index.js
 
26
  chown -R node:node /paperclip
27
  fi
28
 
29
+ exec gosu node "$@"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
server/src/app.ts CHANGED
@@ -88,6 +88,38 @@ export async function createApp(
88
  ) {
89
  const app = express();
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  app.get("/logs", (req, res) => {
92
  app.get("/url", (req, res) => {
93
  try {
 
88
  ) {
89
  const app = express();
90
 
91
+ app.get("/logs", (req, res) => {
92
+ try {
93
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
94
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
95
+ res.status(200).set("Content-Type", "text/plain").send(logs);
96
+ } else {
97
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet. Please wait...");
98
+ }
99
+ } catch (e) {
100
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
101
+ }
102
+ });
103
+
104
+ app.get("/url", (req, res) => {
105
+ try {
106
+ if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
107
+ const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
108
+ const match = logs.match(/https?:\/\/[^\s]+/);
109
+ if (match) {
110
+ res.status(200).set("Content-Type", "text/plain").send(match[0]);
111
+ } else {
112
+ res.status(200).set("Content-Type", "text/plain").send("URL not found in logs yet.");
113
+ }
114
+ } else {
115
+ res.status(200).set("Content-Type", "text/plain").send("Logs not available yet.");
116
+ }
117
+ } catch (e) {
118
+ res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
119
+ }
120
+ });
121
+
122
+
123
  app.get("/logs", (req, res) => {
124
  app.get("/url", (req, res) => {
125
  try {