You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/compute/compute/dev/README.md
+26-10
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,17 @@ The scripts here are helpful for developing the compute\-server manager, which i
2
2
3
3
1. Create the directory /tmp/user and make sure you can read it. Maybe even mount it from the target project.
4
4
5
-
2.Make the conf/ directory here, with the same files as on /cocalc/conf in an actual compute\-server, except:
6
-
- replace api_server by something like `http://localhost:5000/6659c2e3-ff5e-4bb4-9a43-8830aa951282/port/5000`, where the port is what you're using for your dev server and the project id is of your dev server. The point is that we're going to connect directly without going through some external server.
7
-
- api_key: the one from an actual server will get deleted when you turn that server off, so make a different project level api key.
5
+
2.The conf/ directory here has the same files as on /cocalc/conf in an actual compute\-server, except:
6
+
- replace api_server by something like `http://127.0.0.1:5000/6659c2e3-ff5e-4bb4-9a43-8830aa951282/port/5000`, where the port is what you're using for your dev server and the project id is of your dev server. The point is that we're going to connect directly without going through some external server.
7
+
- api_key: the one from an actual server will get deleted when you turn that server off, so make a different project level api key.
8
8
9
-
This is obviously very confusing, and when developing this it was 10x worse... Maybe you'll be confused for 2 hours instead of 2 days.
9
+
Type `tar xvf conf.tar` to get a template for the conf directory.
10
+
You will need to change the contents of all the files you get, as
11
+
mentioned above! Also, regarding the api_server, be especially careful
12
+
about ipv4 versus ipv6, e.g., use 127.0.0.1 instead of localhost to
13
+
nail down the protocol.
14
+
15
+
This is potentially confusing, and when developing this it was 10x worse... Maybe you'll be confused for 2 hours instead of 2 days.
10
16
11
17
3. Run each of the following four shell scripts in different terminals, in order.
12
18
@@ -17,17 +23,27 @@ This is obviously very confusing, and when developing this it was 10x worse... M
17
23
4-startup-script.sh
18
24
```
19
25
20
-
However, a bunch of things are likely to go wrong. The scripts `1-websocketfs.sh` and `2-syncfs.sh` will definitely fail if support for FUSE isn't enabled for normal users where you are working! Test bindfs locally. You probably have to add `user_allow_other` to `/etc/fuse.conf`. For `2-syncfs.sh`, you must also install unionfs-fuse via `sudo apt install unionfs-fuse` . Also, you need to do the following so that testing of tmp being a "fast local data directory that isn't sync"'d can be done:
26
+
However, a bunch of things are likely to go wrong.
**Problem:** Regarding the id of the compute server in the file [conf/compute\_server\_id](./conf/compute_server_id), create a self\-hosted compute server in the project on your dev server, then find the record in the postgresql database by querying the `compute_servers` table, and copy the id field from that. Note that the displayed id in the UI starts from 1 for each project, but `compute_server_id` must be the id in the database.
29
+
30
+
**Problem:** Get the [conf/api_key](./conf/api_key) by clicking start on the self\-hosted compute server, inspect the URL, and copy it from there. If you stop the server explicitly, then the api key is deleted from the project, so you need to make it again.
31
+
32
+
**Problem:** The scripts `1-websocketfs.sh` and `2-syncfs.sh` will definitely fail if support for FUSE isn't enabled for normal users where you are working! Test bindfs locally.
33
+
34
+
**Problem:** For `2-syncfs.sh`, you must also install unionfs\-fuse via `sudo apt install unionfs-fuse,` since the cocalc package @cocalc/sync\-fs assumes unionfs\-fuse is installed.
35
+
36
+
**Problem:** You need to do the following so that you can fully test the scratch functionality \(see [conf/exclude_from_sync](./conf/exclude_from_sync)\):
Once you get the 4 scripts above to run, the net result is basically the same as using a compute server, but you can run it all locally, and debugging is massively easier. Without something like this, development is impossible, and even figuring out what configuration goes where could cost me days of confusion (even though I wrote it all!). It's complicated.
42
+
Once you get the 4 scripts above to run, the net result is basically the same as using a compute server, but you can run it all locally, and development and debugging is ~~massively easier~~ possible! Without something like this, development is impossible, and even figuring out what configuration goes where could cost me days of confusion \(even though I wrote it all!\). It's complicated.
28
43
29
44
For debugging set the DEBUG env variable to different things according to the debug npm module. E.g.,
"fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf\n\n\nFix this:\n\n sudo sed -i 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf\n\n\n",
0 commit comments