Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating Graphql to Vachan-api #735

Merged
merged 9 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/crud/files_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ def parse_with_usfm_grammar(input_usfm, output_format=usfm_grammar.Format.JSON,
output_content = extract_usx_chapter(output_content, chapter)
output_content = etree.tostring(output_content, encoding='unicode', pretty_print=True) #pylint: disable=I1101
return output_content

1 change: 1 addition & 0 deletions app/routers/filehandling_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ async def parse_uploaded_usfm(request:Request,
log.debug("output_format: %s, content_filter: %s", output_format, content_filter)
return files_crud.parse_with_usfm_grammar(
input_usfm.USFM, output_format, content_filter, chapter)

3 changes: 1 addition & 2 deletions app/test/test_file_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,4 @@ def test_usfm_to_usx():
print(resp.json())
assert resp.json().startswith("<usx")
assert resp.json().strip().endswith("</usx>")



29 changes: 28 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ services:
image: oryd/kratos:v1.0.0
ports:
- '4433:4433' # public
# - '4434:4434' # admin
# -'4434:4434' # admin
restart: unless-stopped
environment:
- DSN=${VACHAN_AUTH_DATABASE:-postgres://kratos:secret@kratos-postgresd:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4}
Expand Down Expand Up @@ -208,6 +208,33 @@ services:
networks:
- VE-network

vachan-cms-graphql:
image: athulyams/graphql-12:v2.0.0-alpha.1
ports:
- "8004:8004"
expose:
- 8004
command: uvicorn main:app --host 0.0.0.0 --port 8004
restart: always
environment:
- VACHAN_POSTGRES_HOST=vachan-db
- VACHAN_POSTGRES_USER=${VACHAN_POSTGRES_USER:-postgres}
- VACHAN_POSTGRES_PASSWORD=${VACHAN_POSTGRES_PASSWORD:-password}
- VACHAN_POSTGRES_DATABASE=${VACHAN_POSTGRES_DATABASE:-vachan_dev}
- VACHAN_POSTGRES_PORT=5432
- VACHAN_DOMAIN=${VACHAN_DOMAIN:-api.vachanengine.org}
- VACHAN_LOGGING_LEVEL=INFO
# volumes:
# - logs-vol:/app/logs
depends_on:
- vachan-api
- vachan-db
profiles:
- local-run
- deployment
networks:
- VE-network

# Web Server
web-server-local:
image: nginx:latest
Expand Down
9 changes: 9 additions & 0 deletions docker/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ server {

try_files $uri $uri/ =404;
}
location /graphql/ {
# Important, make sure you always remove the trailing slash
proxy_pass http://vachan-cms-graphql:8004;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /v2/demos/ {
# Important, make sure you always remove the trailing slash
proxy_pass http://vachan-demos:8002;
Expand Down
5 changes: 5 additions & 0 deletions docker/nginx/prod/app.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ server {
ssl_certificate /etc/nginx/ssl/live/${VACHAN_DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/${VACHAN_DOMAIN}/privkey.pem;


location /graphql/ {
proxy_pass http://vachan-cms-graphql:8004;
}

location /v2/demos/ {
proxy_pass http://vachan-demos:8002;
}
Expand Down
Loading