|
1 | | -# CodePod: A Hierarchical IDE for Interactive Development at Scale |
| 1 | +# CodePod: coding on a canvas, organized. |
2 | 2 |
|
3 | 3 |  |
4 | 4 |
|
5 | | -# Installation |
6 | | - |
7 | | -Binary release available for Linux and MacOS. See release page. |
8 | | - |
9 | | -For Debian/Ubuntu: |
| 5 | +# Development |
10 | 6 |
|
11 | 7 | ``` |
12 | | -sudo dpkg -i codepod_0.1.0_amd64.deb |
| 8 | +cd ./compose/dev/ |
| 9 | +touch .env |
13 | 10 | ``` |
14 | 11 |
|
15 | | -On Mac, use the `codepod_0.1.0_arm64.dmg` image (for M1 Macs with Apple Sillicon). |
16 | | - |
17 | | -You can run `codepod` either in application launcher or through the `codepod` command line tool. |
18 | | - |
19 | | -# Install Jupyter kernels |
20 | | - |
21 | | -These kernels are Jupyter kernels. CodePod should detect them and work as long |
22 | | -as they are properly installed to work in Jupyter. |
23 | | - |
24 | | -## python |
| 12 | +Add your choice of secrets to the .env file (replace the placeholders): |
25 | 13 |
|
26 | 14 | ``` |
27 | | -sudo apt install python3 |
| 15 | +POSTGRES_USER=<username> |
| 16 | +POSTGRES_PASSWORD=<password> |
| 17 | +POSTGRES_DB=<dbname> |
| 18 | +JWT_SECRET=<yoursecret> |
28 | 19 | ``` |
29 | 20 |
|
30 | | -Install ipykernel: |
| 21 | +Start the docker-compose stack: |
31 | 22 |
|
32 | 23 | ``` |
33 | | -python3 -m pip install ipykernel |
34 | | -python3 -m ipykernel install --user |
| 24 | +docker compose up -d |
35 | 25 | ``` |
36 | 26 |
|
37 | | -## racket |
| 27 | +The docker-compose file declares a set of services: |
38 | 28 |
|
39 | | -Install on Ubuntu: |
| 29 | +- api: the backend API server |
| 30 | +- ui: the frontend React app |
| 31 | +- db: postgres DB |
| 32 | +- prisma: prisma db viewer |
| 33 | +- nginx: reverse proxy to use nice URLs |
40 | 34 |
|
41 | | -``` |
42 | | -sudo add-apt-repository ppa:plt/racket |
43 | | -sudo apt-get update |
44 | | -sudo apt install racket |
45 | | -``` |
| 35 | +You will need to perform a manual installation of node_modules into the api and |
| 36 | +ui containers. Attach a shell and run `yarn`. Without this, the initial api/ui |
| 37 | +contianers will not run. So you likely need to make changes to docker compose to |
| 38 | +do this (add `tty: true` and comment out commands line). |
46 | 39 |
|
47 | | -Install zmq: |
| 40 | +Then, initialize a DB by shell into the api container and run: |
48 | 41 |
|
49 | 42 | ``` |
50 | | -brew install zmq |
51 | | -sudo apt install libzmq5 |
| 43 | +npx prisma migrate dev --name init |
52 | 44 | ``` |
53 | 45 |
|
| 46 | +The nginx server expects `codepod.test` as the domain name. You can add a local |
| 47 | +DNS record to your /etc/hosts: |
| 48 | + |
54 | 49 | ``` |
55 | | -raco pkg install --auto iracket |
56 | | -raco iracket install |
| 50 | +10.43.1.148 codepod.test |
57 | 51 | ``` |
58 | 52 |
|
59 | | -On mac, zeromq lib cannot be found by racket due to [a known |
60 | | -issue](https://github.com/rmculpepper/racket-zeromq/issues/6). To side-step it |
61 | | -(replace the version numbers with your installation): |
| 53 | +This allows codepod.test to be resolved to your server machine. Then, go to |
62 | 54 |
|
63 | | -``` |
64 | | -cp /opt/homebrew/Cellar/zeromq/4.3.4/lib/libzmq.5.dylib ~/Library/Racket/8.2/lib |
65 | | -``` |
| 55 | +- http://codepod.test:3000 the web app |
| 56 | +- http://codepod.test:3000/graphql the grpahql explorer |
| 57 | +- http://codepod.test:5555 the prisma db viewer |
66 | 58 |
|
67 | | -## julia |
| 59 | +# (TODO) Deployment |
68 | 60 |
|
69 | | -Install julia from the official binaries. On Ubuntu: |
| 61 | +Build the docker images: |
70 | 62 |
|
71 | 63 | ``` |
72 | | -curl -O https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz |
73 | | -tar -xvzf julia-1.6.4-linux-x86_64.tar.gz |
74 | | -sudo mv julia-1.6.4/ /opt/ |
75 | | -sudo ln -s /opt/julia-1.6.4/bin/julia /usr/local/bin/julia |
| 64 | +docker build -t lihebi/codepod-ui:v0.1.0 ./ui |
| 65 | +docker build -t lihebi/codepod-api:v0.1.0 ./api |
76 | 66 | ``` |
77 | 67 |
|
78 | | -<!-- |
| 68 | +Push to registry: |
| 69 | + |
79 | 70 | ``` |
80 | | -julia |
81 | | -]add add IJulia |
82 | | -import IJulia |
83 | | -IJulia.installkernel("Julia nodeps", "--depwarn=no") |
| 71 | +docker push lihebi/codepod-ui:v0.1.0 |
| 72 | +docker push lihebi/codepod-api:v0.1.0 |
84 | 73 | ``` |
85 | 74 |
|
86 | | -Or just --> |
87 | | - |
88 | | -Install kernel: |
| 75 | +Create a cloud VM with docker support. Setup TLS: |
89 | 76 |
|
90 | 77 | ``` |
91 | | -julia -e 'import Pkg; Pkg.add("IJulia"); using IJulia; installkernel("Julia nodeps", "--depwarn=no")' |
| 78 | +sudo certbot certonly |
92 | 79 | ``` |
93 | 80 |
|
94 | | -## Javascript |
| 81 | +Clone this repo on the cloud VM, and go to the production folder, change the |
| 82 | +domain name to e.g. app-v0_1_0.codepod.io: |
95 | 83 |
|
96 | 84 | ``` |
97 | | -npm install -g ijavascript |
98 | | -ijsinstall |
| 85 | +cd compose/prod |
| 86 | +touch .env |
99 | 87 | ``` |
100 | 88 |
|
101 | | -# Using remote runtime |
| 89 | +Add your choice of secrets to the .env file (replace the placeholders): |
102 | 90 |
|
103 | | -In the runtime section in the sidebar, you can add a new runtime. For the runtime, you need to specify the two addresses: the websocket address for sending code to server, and the MQ address for receiving output. If MQ address is empty, the websocket will be used. |
104 | | - |
105 | | -The default runtime is the local runtime, which is `localhost:14321` |
106 | | - |
107 | | -To start the server, on the server machine, you need to setup the kernels. Then, you need to clone this repo, go into the cpkernel folder, and do: |
108 | | - |
109 | | -1. `docker-compose up -d`. This will setup a rabbitmq server. The MQ address is `:15674` |
110 | | -2. `npm run kernel-server`. This will run the server. The websocket address is `:14321` |
111 | | - |
112 | | -So to use this server, enter: |
113 | | - |
114 | | -- `<your-server-ip>:14321` for the socket address |
115 | | -- `<your-server-ip>:15674` for the MQ address |
116 | | - |
117 | | -We can spawn a docker container on the server for the kernels. However, it will be tricky to access files and install packages. One has to install packages for every restart of the kernel, and one has to mount a volume to exchange files between the server and the container. Thus we think it is a better experience to use the bare-metal server. |
118 | | - |
119 | | -# Development Scripts |
| 91 | +``` |
| 92 | +POSTGRES_USER=<username> |
| 93 | +POSTGRES_PASSWORD=<password> |
| 94 | +POSTGRES_DB=<dbname> |
| 95 | +JWT_SECRET=<yoursecret> |
| 96 | +``` |
120 | 97 |
|
121 | | -Develop |
| 98 | +Start the docker-compose stack: |
122 | 99 |
|
123 | 100 | ``` |
124 | | -cd app |
125 | | -npm run dev |
| 101 | +docker compose up -d |
126 | 102 | ``` |
127 | 103 |
|
128 | | -Build: |
| 104 | +Then, initialize a DB by shell into the api container and run: |
129 | 105 |
|
130 | 106 | ``` |
131 | | -cd app |
132 | | -npm run build:all |
| 107 | +npx prisma migrate dev --name init |
133 | 108 | ``` |
| 109 | + |
| 110 | +Now add DNS from domain name to the cloud server. Now go to |
| 111 | + |
| 112 | +- http://codepod.test:3000 the web app |
| 113 | +- http://codepod.test:3000/graphql the grpahql explorer |
| 114 | +- http://codepod.test:5555 the prisma db viewer |
| 115 | + |
| 116 | +# (TODO) Architecture |
0 commit comments