Skip to content

Commit d6d74a6

Browse files
forrestbaoli-xin-yi
authored andcommitted
revise README
1 parent 5ce52fd commit d6d74a6

File tree

1 file changed

+79
-31
lines changed

1 file changed

+79
-31
lines changed

README.md

Lines changed: 79 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vsco
2424
to format your code before checking in.
2525
Last but not least, give us a star on Github!
2626

27-
# Citation
28-
29-
https://arxiv.org/abs/2301.02410
30-
31-
```
32-
@misc{https://doi.org/10.48550/arxiv.2301.02410,
33-
doi = {10.48550/ARXIV.2301.02410},
34-
url = {https://arxiv.org/abs/2301.02410},
35-
author = {Li, Hebi and Bao, Forrest Sheng and Xiao, Qi and Tian, Jin},
36-
title = {Codepod: A Namespace-Aware, Hierarchical Jupyter for Interactive Development at Scale},
37-
publisher = {arXiv},
38-
year = {2023},
39-
copyright = {Creative Commons Attribution 4.0 International}
40-
}
41-
```
42-
4327
# Gallery
4428

4529
Thanks to our community, we now have CodePod showcases ranging from analytical geometry to bioinformatics.
@@ -50,23 +34,47 @@ Thanks to our community, we now have CodePod showcases ranging from analytical g
5034

5135
# Developing CodePod using docker-compose
5236

53-
The docker compose files are in `compose/dev` folder. The `dev` stack mounts the
37+
First clone CodePod:
38+
39+
```bash
40+
git clone https://github.com/codepod-io/codepod.git
41+
```
42+
43+
We use the variable `CODEPOD_ROOT` to refer to the root folder of the CodePod.
44+
If you just ran the command above, then `CODEPOD_ROOT` is the folder you just cloned.
45+
46+
Now enter the `CODEPOD_ROOT/compose` folder:
47+
48+
```bash
49+
cd codepod/compose
50+
```
51+
52+
The docker compose files are in `CODEPOD_ROOT/compose/dev` folder. The `dev` stack mounts the
5453
`src` folder, so that you can edit the files on your local computer, and let the
5554
node.js process inside the container do the compiling and hot-reloading.
5655

5756
To install docker-compose, follow the official [Docker documentation](https://docs.docker.com/compose/install/linux/).
5857

5958
## .env file
6059

61-
First, create a `dev/.env` file with the following content (leave as is or change the value to
60+
Now enter the `CODEPOD_ROOT/compose/dev` folder
61+
62+
63+
```bash
64+
cd dev
65+
```
66+
67+
and create a `.env` file with the following content (leave as is or change the value to
6268
whatever you want).
6369

6470
```properties
71+
# Mandatory settings
6572
POSTGRES_USER=myusername
6673
POSTGRES_PASSWORD=mypassword
6774
POSTGRES_DB=mydbname
6875
JWT_SECRET=mysupersecretjwttoken
6976

77+
# optional settings
7078
GOOGLE_CLIENT_ID=<google oauth client id>
7179

7280
EXPORT_AWS_S3_REGION=us-west-1
@@ -80,37 +88,60 @@ Optional:
8088
- Leave the `GOOGLE_CLIENT_ID` empty if you do not need the OAuth provided by Google.
8189
- `EXPORT_AWS_S3_XXX` are used for file export. You could leave it empty if you don't use it.
8290

83-
## Start the stack
91+
## Starting the stack
92+
93+
From the `CODEPOD_ROOT/compose/dev` folder, run:
8494

8595
```bash
86-
cd dev
8796
docker compose up -d
8897
```
8998

90-
You need to initialized the database first before starting the stack. See below.
99+
If you this is your first time starting CodePod, you will also need to initialize the database. See [below](#initializing-the-database).
100+
If the database has been updated (you can tell by some errors) since you last pulled the code, you will need to update the database. See [below](#updating-the-database).
91101

92102
Wait a few minutes for the package installation and compilation. Once the `ui` and
93103
`api` containers are ready, go to `http://localhost:80` to see the app.
94104

95105
- `http://localhost:80/graphql`: Apollo GraphQL explorer for the backend APIs
96106
- `http://prisma.127.0.0.1.sslip.io`: Prisma Studio for viewing and debugging the database.
97107

98-
## Initialize the database
108+
### Initializing the database
109+
110+
To initialize the database, open a shell into the API container (by default called `dev-api-1` but please use `docker ps` to confirm):
111+
112+
```bash
113+
docker exec -it dev-api-1 /bin/bash
114+
```
99115

100-
If this is your first time running it, you would need to initialize the database as it's empty. To do that, open a shell into the API container and run:
116+
and then **from the shell of the API container** run:
101117

102118
```bash
103-
npx prisma migrate dev
119+
npx prisma migrate deploy
104120
```
105121

106-
This command is also needed after the database schema is changed. The protocol is:
122+
### Updating the database
107123

108-
- One developer changed [the schema](./api/prisma/schema.prisma). He will run
109-
`npx prisma migrate dev --name add_a_new_field`. This will generate a
110-
migration, e.g. [this
111-
migration](./api/prisma/migrations/20221206194247_add_google_login/migration.sql).
112-
The schema change along with this migration need to be checked in to git.
113-
- Another developer pulls the change, then running the `npx prisma migrate dev` (in the api container's shell) to apply the schema change.
124+
If the schema has been updated since you last pulled the code (you will most likely observe database-related issues), you will need to update the database.
125+
To do that, enter the shell of the API container (by default called `dev-api-1` but please use `docker ps` to confirm) :
126+
127+
```bash
128+
docker exec -it dev-api-1 /bin/bash
129+
```
130+
131+
and then **from the shell of the API container** run
132+
133+
```bash
134+
npx prisma migrate dev
135+
```
136+
137+
If you are a developer who wants to change the database schema for adding a feature, you can update the schema file `CODEPOD_ROOT/api/prisma/schema.prisma` and then run
138+
139+
```bash
140+
npx prisma migrate dev --name add_a_new_field
141+
```
142+
143+
to generate a migration, like [this](./api/prisma/migrations/20221206194247_add_google_login/migration.sql).
144+
The schema change along with this migration need to be checked in (add, commit, and push) to git.
114145

115146
## Auto-completion & Linting
116147

@@ -123,3 +154,20 @@ cd ./api/
123154
# Run 'npm install' instead if you are using npm
124155
yarn
125156
```
157+
158+
159+
# Citation
160+
161+
https://arxiv.org/abs/2301.02410
162+
163+
```
164+
@misc{https://doi.org/10.48550/arxiv.2301.02410,
165+
doi = {10.48550/ARXIV.2301.02410},
166+
url = {https://arxiv.org/abs/2301.02410},
167+
author = {Li, Hebi and Bao, Forrest Sheng and Xiao, Qi and Tian, Jin},
168+
title = {Codepod: A Namespace-Aware, Hierarchical Jupyter for Interactive Development at Scale},
169+
publisher = {arXiv},
170+
year = {2023},
171+
copyright = {Creative Commons Attribution 4.0 International}
172+
}
173+
```

0 commit comments

Comments
 (0)