Skip to content

Commit c28657a

Browse files
authored
Enable containerization (#178)
* Move partiql-playground to Node.js This is the first PR as part of a series of PR to new features in PartiQL Playground: This PR includes the following: - Moves the PartiQL Playground to a Node.js project. This allows using the Node features within the project, such as having a server side listerner instead of an arbitrary web-server. - Removes the `ace-builds` sub-modules as an action from previous reviews. TODO: [x] Node.js server listener [x] Remove `ace-builds` submodule. [] Containerization [] Client side URL export [] AST Graph pan and zooming bugfix
1 parent 32761d3 commit c28657a

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

partiql-playground/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log

partiql-playground/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:18
2+
# Create app directory
3+
WORKDIR /usr/src/app
4+
# Install app dependencies
5+
# A wildcard is used to ensure both package.json AND package-lock.json are copied
6+
# where available (npm@5+)
7+
COPY package*.json ./
8+
9+
RUN npm install
10+
# If you are building your code for production
11+
RUN npm ci --only=production
12+
13+
# Bundle app source
14+
COPY . .
15+
16+
EXPOSE 8080
17+
18+
CMD [ "node", "src/server.ts" ]

partiql-playground/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@ build:
22
wasm-pack --version && \
33
wasm-pack build --target web --out-dir pkg-web/ && \
44
wasm-pack build --target nodejs --out-dir pkg-node/ && \
5-
npm i
5+
npm i
6+
7+
container-build:
8+
docker build . -t partiql-team/partiql-playground
9+
10+
container-run:
11+
docker run -d -p 8000:8000 partiql-team/partiql-playground

partiql-playground/README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,52 @@ npm --version
2323
```bash
2424
git clone --recursive https://github.com/partiql/partiql-lang-rust.git
2525
```
26-
3. Enter the `partiql-playground` root directory:
26+
4. Enter the `partiql-playground` root directory:
2727
```bash
2828
cd partiql-lang-rust/partiql-playground
2929
```
30-
4. Run `make`:
30+
5. Run `make build`:
3131
```
3232
make
3333
```
34-
5. Start the node server from `partiql-playground` package's root directory:
34+
6. Start the node server from `partiql-playground` package's root directory:
3535
```bash
3636
node src/server.ts
3737
```
38-
6. your browser go to `http://localhost:8000/`
38+
7. your browser go to `http://localhost:8000/`
39+
40+
## Run via docker container
41+
42+
1. Ensure `docker` is installed on your machine, by running the following:
43+
```bash
44+
docker --version
45+
# Example output
46+
Docker version 20.10.17, build 100c701
47+
```
48+
2. Build the package:
49+
```bash
50+
make build
51+
```
52+
3. Build the container:
53+
```bash
54+
make container-build
55+
```
56+
4. Run the container:
57+
```bash
58+
make container-run
59+
```
60+
5. Confirm it's running:
61+
```bash
62+
docker ps
63+
# Example output
64+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
65+
1d666bba30c2 partiql-team/partiql-playground "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 0.0.0.0:8000->8000/tcp, 8080/tcp infallible_goldberg
66+
67+
# Ensure `connected` is in the curl output
68+
curl -v http://localhost:8000 2>&1 |grep -i connected
69+
# Example output
70+
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to localhost (127.0.0.1) port 8000 (#0)
71+
```
3972
4073
## Development
4174
`PartiQL Playground` uses [WebAssembly (Wasm)](https://webassembly.org/) for integrating the front-end with PartiQL Rust back-end.

0 commit comments

Comments
 (0)