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
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
54
53
`src` folder, so that you can edit the files on your local computer, and let the
55
54
node.js process inside the container do the compiling and hot-reloading.
56
55
57
56
To install docker-compose, follow the official [Docker documentation](https://docs.docker.com/compose/install/linux/).
58
57
59
58
## .env file
60
59
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
62
68
whatever you want).
63
69
64
70
```properties
71
+
# Mandatory settings
65
72
POSTGRES_USER=myusername
66
73
POSTGRES_PASSWORD=mypassword
67
74
POSTGRES_DB=mydbname
68
75
JWT_SECRET=mysupersecretjwttoken
69
76
77
+
# optional settings
70
78
GOOGLE_CLIENT_ID=<google oauth client id>
71
79
72
80
EXPORT_AWS_S3_REGION=us-west-1
@@ -80,37 +88,60 @@ Optional:
80
88
- Leave the `GOOGLE_CLIENT_ID` empty if you do not need the OAuth provided by Google.
81
89
-`EXPORT_AWS_S3_XXX` are used for file export. You could leave it empty if you don't use it.
82
90
83
-
## Start the stack
91
+
## Starting the stack
92
+
93
+
From the `CODEPOD_ROOT/compose/dev` folder, run:
84
94
85
95
```bash
86
-
cd dev
87
96
docker compose up -d
88
97
```
89
98
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).
91
101
92
102
Wait a few minutes for the package installation and compilation. Once the `ui` and
93
103
`api` containers are ready, go to `http://localhost:80` to see the app.
94
104
95
105
-`http://localhost:80/graphql`: Apollo GraphQL explorer for the backend APIs
96
106
-`http://prisma.127.0.0.1.sslip.io`: Prisma Studio for viewing and debugging the database.
97
107
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
+
```
99
115
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:
101
117
102
118
```bash
103
-
npx prisma migrate dev
119
+
npx prisma migrate deploy
104
120
```
105
121
106
-
This command is also needed after the database schema is changed. The protocol is:
122
+
### Updating the database
107
123
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
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.
114
145
115
146
## Auto-completion & Linting
116
147
@@ -123,3 +154,20 @@ cd ./api/
123
154
# Run 'npm install' instead if you are using npm
124
155
yarn
125
156
```
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},
0 commit comments