|
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 |
| 5 | +# Development |
6 | 6 |
|
7 | | -Binary release available for Linux and MacOS. See release page. |
| 7 | +``` |
| 8 | +cd ./compose/dev/ |
| 9 | +touch .env |
| 10 | +``` |
8 | 11 |
|
9 | | -For Debian/Ubuntu: |
| 12 | +Add your choice of secrets to the .env file (replace the placeholders): |
10 | 13 |
|
11 | 14 | ``` |
12 | | -sudo dpkg -i codepod_0.1.0_amd64.deb |
| 15 | +POSTGRES_USER=<username> |
| 16 | +POSTGRES_PASSWORD=<password> |
| 17 | +POSTGRES_DB=<dbname> |
| 18 | +JWT_SECRET=<yoursecret> |
13 | 19 | ``` |
14 | 20 |
|
15 | | -On Mac, use the `codepod_0.1.0_arm64.dmg` image (for M1 Macs with Apple Sillicon). |
| 21 | +Start the docker-compose stack: |
| 22 | + |
| 23 | +``` |
| 24 | +docker compose up -d |
| 25 | +``` |
16 | 26 |
|
17 | | -You can run `codepod` either in application launcher or through the `codepod` command line tool. |
| 27 | +The docker-compose file declares a set of services: |
18 | 28 |
|
19 | | -# Install Jupyter kernels |
| 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 |
20 | 34 |
|
21 | | -These kernels are Jupyter kernels. CodePod should detect them and work as long |
22 | | -as they are properly installed to work in Jupyter. |
| 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). |
23 | 39 |
|
24 | | -## python |
| 40 | +Then, initialize a DB by shell into the api container and run: |
25 | 41 |
|
26 | 42 | ``` |
27 | | -sudo apt install python3 |
| 43 | +npx prisma migrate dev --name init |
28 | 44 | ``` |
29 | 45 |
|
30 | | -Install ipykernel: |
| 46 | +The nginx server expects `codepod.test` as the domain name. You can add a local |
| 47 | +DNS record to your /etc/hosts: |
31 | 48 |
|
32 | 49 | ``` |
33 | | -python3 -m pip install ipykernel |
34 | | -python3 -m ipykernel install --user |
| 50 | +10.43.1.148 codepod.test |
35 | 51 | ``` |
36 | 52 |
|
37 | | -## racket |
| 53 | +This allows codepod.test to be resolved to your server machine. Then, go to |
38 | 54 |
|
39 | | -Install on Ubuntu: |
| 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 |
40 | 58 |
|
41 | | -``` |
42 | | -sudo add-apt-repository ppa:plt/racket |
43 | | -sudo apt-get update |
44 | | -sudo apt install racket |
45 | | -``` |
| 59 | +# Deployment |
46 | 60 |
|
47 | | -Install zmq: |
| 61 | +Build the docker images: |
48 | 62 |
|
49 | 63 | ``` |
50 | | -brew install zmq |
51 | | -sudo apt install libzmq5 |
| 64 | +docker build -t lihebi/codepod-ui:v0.1.0 ./ui |
| 65 | +docker build -t lihebi/codepod-api:v0.1.0 ./api |
| 66 | +docker build -t lihebi/codepod_kernel_python:v0.1.0 ./api/kernels/python |
52 | 67 | ``` |
53 | 68 |
|
| 69 | +Push to registry: |
| 70 | + |
54 | 71 | ``` |
55 | | -raco pkg install --auto iracket |
56 | | -raco iracket install |
| 72 | +docker push lihebi/codepod-ui:v0.1.0 |
| 73 | +docker push lihebi/codepod-api:v0.1.0 |
| 74 | +docker push lihebi/codepod_kernel_python:v0.1.0 |
57 | 75 | ``` |
58 | 76 |
|
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): |
| 77 | +Create a cloud VM with docker support. Add DNS from domain name to the cloud |
| 78 | +server. Setup TLS, e.g., `app-v1.codepod.io`: |
62 | 79 |
|
63 | 80 | ``` |
64 | | -cp /opt/homebrew/Cellar/zeromq/4.3.4/lib/libzmq.5.dylib ~/Library/Racket/8.2/lib |
| 81 | +ufw allow 80 |
| 82 | +certbot certonly --standalone |
65 | 83 | ``` |
66 | 84 |
|
67 | | -## julia |
68 | | - |
69 | | -Install julia from the official binaries. On Ubuntu: |
| 85 | +Clone this repo on the cloud VM, and go to the production folder: |
70 | 86 |
|
71 | 87 | ``` |
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 |
| 88 | +cd compose/prod |
| 89 | +touch .env |
76 | 90 | ``` |
77 | 91 |
|
78 | | -<!-- |
| 92 | +Add your choice of secrets to the .env file (replace the placeholders): |
| 93 | + |
79 | 94 | ``` |
80 | | -julia |
81 | | -]add add IJulia |
82 | | -import IJulia |
83 | | -IJulia.installkernel("Julia nodeps", "--depwarn=no") |
| 95 | +POSTGRES_USER=<username> |
| 96 | +POSTGRES_PASSWORD=<password> |
| 97 | +POSTGRES_DB=<dbname> |
| 98 | +JWT_SECRET=<yoursecret> |
84 | 99 | ``` |
85 | 100 |
|
86 | | -Or just --> |
| 101 | +Change the domain name to your DNS in nginx.conf, e.g., `app-v1.codepod.io`: |
87 | 102 |
|
88 | | -Install kernel: |
| 103 | +Start the docker-compose stack: |
89 | 104 |
|
90 | 105 | ``` |
91 | | -julia -e 'import Pkg; Pkg.add("IJulia"); using IJulia; installkernel("Julia nodeps", "--depwarn=no")' |
| 106 | +docker compose up -d |
92 | 107 | ``` |
93 | 108 |
|
94 | | -## Javascript |
| 109 | +Then, initialize a DB by shell into the api container and run: |
95 | 110 |
|
96 | 111 | ``` |
97 | | -npm install -g ijavascript |
98 | | -ijsinstall |
| 112 | +npx prisma migrate dev --name init |
99 | 113 | ``` |
100 | 114 |
|
101 | | -# Using remote runtime |
102 | | - |
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 |
120 | | - |
121 | | -Develop |
| 115 | +Pull the kernel image: |
122 | 116 |
|
123 | 117 | ``` |
124 | | -cd app |
125 | | -npm run dev |
| 118 | +docker pull lihebi/codepod_kernel_python:v0.1.0 |
| 119 | +docker tag lihebi/codepod_kernel_python:v0.1.0 codepod_kernel_python |
126 | 120 | ``` |
127 | 121 |
|
128 | | -Build: |
| 122 | +Now go to |
129 | 123 |
|
130 | | -``` |
131 | | -cd app |
132 | | -npm run build:all |
133 | | -``` |
| 124 | +- https://app-v1.codepod.io the web app |
| 125 | + |
| 126 | +# (TODO) Architecture |
0 commit comments