Skip to content

Commit

Permalink
chore: move docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tc-imba committed Jul 16, 2024
1 parent fce1946 commit 40878e5
Show file tree
Hide file tree
Showing 35 changed files with 3,262 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.idea
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@

## Clone the repositories

First, we need to clone `sbos-minimal`, `sbos-playground`, `sbos-frontend`, and `genie-brickified` repos into a same directory.
First, we need to clone the repository and work in the project directory.

```bash
mkdir brick
git clone https://github.com/BrickSchema/brick-example-server
git clone https://github.com/BrickSchema/playground
git clone
cd playground
```

## Configuration

Create a `.env` file in the playground directory. The file can be used to configure the playground server.
Create a `.env` file in the project root directory. The file can be used to configure the playground server.
The detailed configurable items can be found [here](config/index.md).

```bash
cd playground
touch .env

```

## Deploy the server
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added docs/tutorial/buildsys2024.md
Empty file.
File renamed without changes.
3,169 changes: 3,169 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions projects/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbos-frontend
8 changes: 4 additions & 4 deletions projects/sbos-minimal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM tiangolo/uvicorn-gunicorn:python3.10-slim

ENV HOME="/root"
WORKDIR /root
WORKDIR /root/sbos-minimal

# install apt dependencies
RUN --mount=type=cache,target=/var/cache/apt \
Expand All @@ -27,10 +27,10 @@ RUN python3 -m virtualenv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# install dependencies
COPY pyproject.toml poetry.lock README.md /root/
COPY sbos/minimal/__init__.py /root/sbos/minimal/
COPY pyproject.toml poetry.lock README.md /root/sbos-minimal/
COPY sbos/minimal/__init__.py /root/sbos-minimal/sbos/minimal/
RUN --mount=type=cache,target=/root/.cache poetry install --without dev
COPY . /root
COPY . /root/sbos-minimal
RUN --mount=type=cache,target=/root/.cache poetry install --without dev

EXPOSE $PORT
Expand Down
29 changes: 12 additions & 17 deletions projects/sbos-minimal/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3.5'
services:
sbos-postgres:
container_name: sbos-postgres
postgres:
image: timescale/timescaledb-postgis:latest-pg13
environment: # Below secrets should be matched with the information in `.env` too.
- POSTGRES_USER=bricker
Expand All @@ -18,34 +17,30 @@ services:
target: /docker-entrypoint-initdb.d/003_init_postgis.sh
read_only: true
- ../psqlData:/var/lib/postgresql/data # change the path to yours accordingly
sbos-graphdb:
container_name: sbos-graphdb
graphdb:
image: w1zzard/graphdb-free:9.9.0
networks:
- sbos-network
ports:
- "37200:7200"
sbos-mongo:
container_name: sbos-mongo
mongo:
image: mongo:4.2.3-bionic
networks:
- sbos-network
ports:
- "37017:27017"
sbos-redis:
container_name: sbos-redis
redis:
image: 'redis:5.0.8'
command: redis-server --requirepass brick-demo
networks:
- sbos-network
ports:
- "36379:6379"
sbos:
container_name: sbos
image: sbos:minimal
core:
image: tcimba/sbos:minimal
restart: on-failure
volumes:
- ./sbos:/root/sbos
- ./sbos/minimal:/root/sbos-minimal/sbos/minimal
- ./tests:/root/tests
- ./examples:/root/examples
- /var/run/docker.sock:/var/run/docker.sock
Expand All @@ -60,11 +55,11 @@ services:
- isolated_nw
environment:
- DEBUG=true
- HOST=sbos
- MONGO_HOST=sbos-mongo
- TIMESCALE_HOST=sbos-postgres
- BRICK_HOST=sbos-virtuoso
- GRAPHDB_HOST=sbos-graphdb
- HOST=core
- MONGO_HOST=mongo
- TIMESCALE_HOST=postgres
- BRICK_HOST=virtuoso
- GRAPHDB_HOST=graphdb
- OAUTH_GOOGLE_CLIENT_ID=${OAUTH_GOOGLE_CLIENT_ID}
- OAUTH_GOOGLE_CLIENT_SECRET=${OAUTH_GOOGLE_CLIENT_SECRET}
# - GRAFANA_HOST=sbos-grafana
Expand Down
1 change: 1 addition & 0 deletions projects/sbos-minimal/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"openapi": "3.0.2",
"info": {
"title": "Brick Server",

"version": "0.1.0"
},
"paths": {
Expand Down
1 change: 1 addition & 0 deletions projects/sbos-playground/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ poetry.toml
venv
.git
app_static
data

# Created by https://www.toptal.com/developers/gitignore/api/vscode,python
# Edit at https://www.toptal.com/developers/gitignore?templates=vscode,python
Expand Down
17 changes: 9 additions & 8 deletions projects/sbos-playground/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
rm -rf /var/lib/apt/lists/*

# install dockerize
ENV DOCKERIZE_VERSION v0.6.1
ENV DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
Expand All @@ -36,17 +36,18 @@ RUN python3 -m virtualenv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# install dependencies
COPY ./sbos-minimal/pyproject.toml ./sbos-minimal/poetry.lock ./sbos-minimal/README.md /root/sbos-minimal/
COPY ./sbos-playground/pyproject.toml ./sbos-playground/poetry.lock ./sbos-playground/README.md /root/sbos-playground/
COPY ./sbos-minimal/sbos/minimal/__init__.py /root/sbos-minimal/sbos/minimal/
COPY ./sbos-playground/sbos/playground/__init__.py /root/sbos-playground/sbos/playground/
COPY pyproject.toml poetry.lock README.md /root/sbos-playground/
COPY sbos/playground/__init__.py /root/sbos-playground/sbos/playground/
COPY --from=sbos:minimal /root/sbos-minimal/pyproject.toml /root/sbos-minimal/poetry.lock /root/sbos-minimal/README.md /root/sbos-minimal/
COPY --from=sbos:minimal /root/sbos-minimal/sbos/minimal/__init__.py /root/sbos-minimal/sbos/minimal/
RUN --mount=type=cache,target=/root/.cache poetry install --without dev
RUN --mount=type=cache,target=/root/.cache pip3 install torch --index-url https://download.pytorch.org/whl/cpu
COPY ./sbos-minimal /root/sbos-minimal/
COPY ./sbos-playground /root/sbos-playground/
# RUN rm /root/sbos-playground/.env/
COPY . /root/sbos-playground
COPY --from=sbos:minimal /root/sbos-minimal /root/sbos-minimal
RUN --mount=type=cache,target=/root/.cache poetry install --without dev

# RUN rm /root/sbos-playground/.env/

EXPOSE $PORT

CMD python3 -m sbos.playground
10 changes: 10 additions & 0 deletions projects/sbos-playground/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ version: '3.5'
services:
# mongo:
# image: mongo:5.0-focal
core-minimal:
image: tcimba/sbos:minimal
build:
context: ../sbos-minimal
args:
DOCKER_BUILDKIT: 1
restart: no
entrypoint: [ "echo", "core-minimal is a dummy service for development" ]
core:
depends_on:
- core-minimal
environment:
DEBUG: true
WORKERS: 1
Expand Down
10 changes: 4 additions & 6 deletions projects/sbos-playground/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
ports:
- "35432:5432"
volumes:
- ../psqlData:/var/lib/postgresql/data # change the path to yours accordingly
- ./data/psqlData:/var/lib/postgresql/data # change the path to yours accordingly
command: /bin/bash -c "echo \"$$INIT_POSTGIS\" > /docker-entrypoint-initdb.d/002_init_postgis.sh; docker-entrypoint.sh postgres;"
graphdb:
image: w1zzard/graphdb-free:9.9.0
Expand All @@ -25,15 +25,15 @@ services:
ports:
- "37200:7200"
volumes:
- ../graphdbData:/opt/graphdb/home
- ./data/graphdbData:/opt/graphdb/home
mongo:
image: mongo:4.4-focal
networks:
- sbos-network
ports:
- "37017:27017"
volumes:
- ../mongoData:/data/db
- ./data/mongoData:/data/db
redis:
image: 'redis:5.0.8'
command: redis-server --requirepass brick-demo
Expand All @@ -44,15 +44,13 @@ services:
core:
image: tcimba/sbos:playground
build:
context: ..
dockerfile: ./sbos-playground/Dockerfile
context: .
args:
DOCKER_BUILDKIT: 1
restart: on-failure
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./app_static:/root/sbos-playground/app_static

ports:
- "9000:9000"
networks:
Expand Down
2 changes: 1 addition & 1 deletion projects/sbos-playground/sbos/playground/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_docs():
]

docs_generated_path = (
pathlib.Path(__file__).parent.parent.parent.absolute() / "docs" / "generated"
pathlib.Path.cwd() / "docs" / "generated"
)
docs_generated_path.mkdir(parents=True, exist_ok=True)

Expand Down
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[tool.poetry]
name = "sbos"
version = "0.1.0"
description = ""
authors = ["Liu Yihao <[email protected]>"]
license = "MIT"
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.10"
mkdocs-material = "^9.5.29"
mkdocs-include-markdown-plugin = "^6.2.1"
sbos-minimal = {develop = true, path = "projects/sbos-minimal"}
sbos-playground = {develop = true, path = "projects/sbos-playground"}
settings-doc = "^4.0.1"
poethepoet = "^0.27.0"

[tool.poe.tasks."minimal:build"]
cmd = "docker build . -t tcimba/sbos:minimal"
cwd = "projects/sbos-minimal"

[tool.poe.tasks."_playground:build"]
cmd = "docker build . -t tcimba/sbos:playground"
cwd = "projects/sbos-playground"

[tool.poe.tasks."playground:dev"]
cmd = "docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build"
cwd = "projects/sbos-playground"

[tool.poe.tasks."_playground:prod"]
cmd = "docker compose up -d"
cwd = "projects/sbos-playground"

[tool.poe.tasks]
"doc:gen" = "python -m sbos.playground generate-docs"
"_doc:dev" = "mkdocs serve"
"doc:dev" = ["doc:gen", "_doc:dev"]
"playground:build" = ["minimal:build", "_playground:build"]
"playground:prod" = ["playground:build", "_playground:prod"]


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 40878e5

Please sign in to comment.