Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zcemycl committed Aug 4, 2024
1 parent 1b70ee2 commit 83af0f5
Show file tree
Hide file tree
Showing 8 changed files with 1,030 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/containers/docker/neo4j/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ networks:
driver: bridge
services:
neo4j:
image: neo4j:latest
image: neo4j:5.22
container_name: "neo-gds1.5"
restart: always
environment:
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
- NEO4J_AUTH=neo4j/password
Expand Down
24 changes: 13 additions & 11 deletions src/containers/docker/neo4j/frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Home() {
const [y, setY] = useState(0);
const [showMenu, setShowMenu] = useState(false);
const [selectedNodes, setSelectedNodes] = useState<any>({});
const [neo4jquery, setNeo4jQuery] = useState("");
const [neo4jquery, setNeo4jquery] = useState("");
const [shiftEnterPressed, setShiftEnterPressed] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -179,23 +179,25 @@ export default function Home() {
cols={40}
className="bg-sky-800 rounded-md p-3 border border-white w-1/2 break-words"
value={neo4jquery}
onChange={(e) => {
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
console.log(e);
console.log((e.nativeEvent as any).inputType);
if (
shiftEnterPressed &&
(e.nativeEvent as any).inputType == "insertLineBreak"
) {
const inputType = (
e.nativeEvent as unknown as { inputType: string }
).inputType;
console.log(inputType);
if (shiftEnterPressed && inputType === "insertLineBreak") {
return;
}
setNeo4jQuery((e.target as HTMLTextAreaElement).value);
setNeo4jquery(e.target.value);
}}
onKeyDown={(e) => {
onKeyDown={(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
console.log(e);
if (e.key === "Enter" && e.shiftKey) {
console.log("Enter");
console.log(neo4jquery.replace(/(\r\n|\n|\r)/gm, " "));
const query = neo4jquery.replace(/(\r\n|\n|\r)/gm, " ");
console.log(query, vis !== null);
if (vis !== null) {
vis.renderWithCypher(neo4jquery.replace(/(\r\n|\n|\r)/gm, " "));
vis.renderWithCypher(query);
}
}
}}
Expand Down
Empty file.
Empty file.
72 changes: 72 additions & 0 deletions src/containers/docker/openfga/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
services:
postgres:
image: postgres:14
container_name: postgres
command: postgres -c 'max_connections=100'
networks:
- default
ports:
- "5434:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

db:
image: postgres:14
container_name: postgres
command: postgres -c 'max_connections=100'
networks:
- default
ports:
- "5435:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

migrate:
depends_on:
postgres:
condition: service_healthy
image: openfga/openfga:latest
container_name: migrate
environment:
- OPENFGA_DATASTORE_ENGINE=postgres
- OPENFGA_DATASTORE_URI=postgres://postgres:password@postgres:5432/postgres?sslmode=disable
command: migrate
networks:
- default

openfga:
depends_on:
migrate:
condition: service_completed_successfully
image: openfga/openfga:latest
container_name: openfga
command: run
environment:
- OPENFGA_DATASTORE_ENGINE=postgres
- OPENFGA_DATASTORE_URI=postgres://postgres:password@postgres:5432/postgres?sslmode=disable
- OPENFGA_DATASTORE_MAX_OPEN_CONNS=100 #see postgres container
- OPENFGA_PLAYGROUND_ENABLED=true
networks:
- default
ports:
- "8080:8080" #http
- "8081:8081" #grpc
- "3000:3000" #playground
- "2112:2112" #prometheus metrics
healthcheck:
test: ["CMD", "/usr/local/bin/grpc_health_probe", "-addr=openfga:8081"]
interval: 5s
timeout: 30s
retries: 3
928 changes: 927 additions & 1 deletion src/containers/docker/openfga/poetry.lock

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/containers/docker/openfga/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@ version = "0.1.0"
description = ""
authors = ["zcemycl <lyc010197@gmail.com>"]
readme = "README.md"
packages = [{ include = "datacore", from = "src" }]

[tool.poetry.dependencies]
python = "^3.11"
openfga-sdk = "^0.6.0"
uvicorn = "^0.30.5"
sqlalchemy = "^2.0.31"
fastapi = "^0.112.0"
loguru = "^0.7.2"


[tool.poetry.group.dev.dependencies]
isort = "^5.13.2"
black = "^24.8.0"
pytest = "^8.3.2"
flake8 = "^7.1.1"
pre-commit = "^3.8.0"


[tool.poetry.group.db.dependencies]
alembic = "^1.13.2"

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

0 comments on commit 83af0f5

Please sign in to comment.