Skip to content
Snippets Groups Projects
Commit 2f850a6a authored by Dima Rosmait's avatar Dima Rosmait Committed by Christof Bauer
Browse files

HOLI-6117 - Add new app chat integration

parent db9f45f6
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,7 @@ Please install [`gcloud` CLI](https://cloud.google.com/sdk/docs/install), as wel
Please note that all topics, subscriptions, and messages published to the emulator are only maintained for the lifetime of the emulator session.
Currently, `okuna` stands as the sole `publisher` of Google Pub/Sub. Similarly, `holi-ocis-integration`, which is referred to as `ocis-subscriber` in `mprocs-local-backend.yaml`, is the only `subscriber` of this service. This means that `okuna` is responsible for pushing messages to the Pub/Sub topic, and `ocis-subscriber` is the only client that receives and consumes those messages.
Currently, `okuna` stands as the sole `publisher` of Google Pub/Sub and is responsible for pushing messages to the Pub/Sub topic. There are 2 currently `subscribers` of this service, `holi-ocis-integration` (`ocis-subscriber` in `mprocs-local-backend.yaml`) and `holi-chat-integration` (`chat-subscriber` in `mprocs-local-backend.yaml`), both receive and consume those messages.
To obtain further information on the `holi-ocis-integration` project, please refer to the accompanying [`README.md`](https://gitlab.holi.team/app/holi-ocis-integration/-/blob/a876e59b1985685827f937243f9d0b286060efc9/README.md).
......@@ -222,6 +222,7 @@ The following table lists all ports that are used for local execution.
| pubsub-emulator | 8085 |
| ocis-subscriber | 8086 |
| ocis-postgres | 8087 |
| chat-subscriber | 8088 |
| ocis | 9200 |
| onlyoffice | 9201 |
| wopiserver | 8880 |
......
......@@ -105,6 +105,7 @@ checkoutAndPrepare git@gitlab.holi.team:app/holi-chat-server.git holi-chat-serve
checkoutAndPrepare git@gitlab.holi.team:app/holi-ocis.git holi-ocis
checkoutAndPrepare git@gitlab.holi.team:app/holi-meet.git holi-meet
checkoutAndPrepare git@gitlab.holi.team:app/holi-ocis-integration.git holi-ocis-integration
checkoutAndPrepare git@gitlab.holi.team:app/holi-chat-integration.git holi-chat-integration
# these are technically not used in a local development environment, but they
# make use of common definitions from holi-meta. If you want to check them out,
......
......@@ -31,18 +31,6 @@ procs:
send-keys:
- <C-c>
- <C-c>
ocis-subscriber:
cwd: <CONFIG_DIR>/holi-ocis-integration
shell: >
if [ "$LOCAL_BACKEND_OCIS" = "true" ]; then
./mprocs-start.sh;
else
echo "Not starting local ocis subscriber because LOCAL_BACKEND_OCIS is not set to 'true'";
fi;
stop:
send-keys:
- <C-c>
- <C-c>
oathkeeper:
cwd: <CONFIG_DIR>/holi-unified-api/oathkeeper
shell: ../mprocs-start-oathkeeper.sh
......@@ -66,24 +54,24 @@ procs:
# Before starting the server process, the services need to be up. Therefore, we wait until the services are up via a small until loop.
shell: >
./mprocs-start.sh;
donations-api:
cwd: <CONFIG_DIR>/holi-app-donations
geo-api:
cwd: <CONFIG_DIR>/holi-geo-api
shell: >
. ../.envrc.local.backends;
. ./.envrc.local;
vr install;
if [ "$LOCAL_BACKEND_DONATIONS" = "true" ]; then
if [ "$LOCAL_BACKEND_GEOAPI" = "true" ]; then
./mprocs-start.sh;
else
echo starting fake;
FAKE="true" ./mprocs-start.sh;
fi;
geo-api:
cwd: <CONFIG_DIR>/holi-geo-api
donations-api:
cwd: <CONFIG_DIR>/holi-app-donations
shell: >
. ../.envrc.local.backends;
. ./.envrc.local;
vr install;
if [ "$LOCAL_BACKEND_GEOAPI" = "true" ]; then
if [ "$LOCAL_BACKEND_DONATIONS" = "true" ]; then
./mprocs-start.sh;
else
echo starting fake;
......@@ -125,6 +113,18 @@ procs:
send-keys:
- <C-c>
- <C-c>
ocis-subscriber:
cwd: <CONFIG_DIR>/holi-ocis-integration
shell: >
if [ "$LOCAL_BACKEND_OCIS" = "true" ]; then
./mprocs-start.sh;
else
echo "Not starting local ocis subscriber because LOCAL_BACKEND_OCIS is not set to 'true'";
fi;
stop:
send-keys:
- <C-c>
- <C-c>
chat-server:
cwd: <CONFIG_DIR>/holi-chat-server
shell: >
......@@ -138,3 +138,15 @@ procs:
send-keys:
- <C-c>
- <C-c>
chat-subscriber:
cwd: <CONFIG_DIR>/holi-chat-integration
shell: >
if [ "$LOCAL_BACKEND_CHAT" = "true" ]; then
./mprocs-start.sh;
else
echo "Not starting local chat subscriber because LOCAL_BACKEND_CHAT is not set to 'true'";
fi;
stop:
send-keys:
- <C-c>
- <C-c>
from google.cloud import pubsub_v1
PUBSUB_PROJECT_ID = 'holi-dev'
PUBSUB_SUBSCRIBER_ENDPOINT = 'http://localhost:8086'
PUBSUB_SUBSCRIBER_ENDPOINT = 'http://localhost'
topic_names = ['okuna_local']
subscribers = [['ocis', 8086], ['chat', 8088]]
publisher = pubsub_v1.PublisherClient()
for topic_name in topic_names:
topic_path = publisher.topic_path(PUBSUB_PROJECT_ID, topic_name)
topic = publisher.create_topic(request={"name": topic_path})
subscriber = pubsub_v1.SubscriberClient()
print(f"Topic: {topic.name}")
subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(PUBSUB_PROJECT_ID, f"{topic_name}-sub")
push_config = pubsub_v1.types.PushConfig(push_endpoint=f"{PUBSUB_SUBSCRIBER_ENDPOINT}/{topic_path}")
for sub in subscribers:
subscription_path = subscriber.subscription_path(PUBSUB_PROJECT_ID, f"{sub[0]}-{topic_name}-sub")
push_config = pubsub_v1.types.PushConfig(push_endpoint=f"{PUBSUB_SUBSCRIBER_ENDPOINT}:{sub[1]}/{topic_path}")
with subscriber:
subscription = subscriber.create_subscription(
request={
"name": subscription_path,
......@@ -27,5 +25,6 @@ for topic_name in topic_names:
}
)
print(f"Push subscription: {subscription.name}")
print(f"Subscription endpoint: {subscription.push_config.push_endpoint}")
\ No newline at end of file
print(f"Push subscription: {subscription.name}")
print(f"Subscription endpoint: {subscription.push_config.push_endpoint}")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment