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

View event history #179

Merged
merged 18 commits into from
Oct 17, 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
4 changes: 2 additions & 2 deletions .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ jobs:
REACT_APP_BASE_URL=${{ secrets.REACT_APP_BASE_URL_DEV }}
REACT_APP_API_BASE_URL=${{ secrets.REACT_APP_API_BASE_URL }}
REACT_APP_GIT_COMMIT_HASH=${{ github.event.pull_request.head.sha }}
PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
REACT_APP_GIT_COMMIT_HASH: ${{ github.event.pull_request.head.sha }}
tags: ${{ secrets.DOCKER_REGISTRY }}/dbe7-images/${{ inputs.DOCKER_IMAGE_NAME }}:${{ inputs.DOCKER_IMAGE_TAG }}
- name: Authenticate and set context for tools namespace
uses: redhat-actions/oc-login@v1.1.2
Expand All @@ -107,4 +108,3 @@ jobs:
IMAGE_NAME: ${{ inputs.DOCKER_IMAGE_NAME }}
run: |
oc import-image $IMAGE_NAME:latest --confirm

330 changes: 162 additions & 168 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,177 +1,172 @@
version: '3.1'

services:

rabbitmq:
build: ./rabbitmq
environment:
# The RABBITMQ_DEFAULT_USER is used
# to connect to the web admin
RABBITMQ_DEFAULT_USER: "${RABBITMQ_USER}"
RABBITMQ_DEFAULT_PASS: "${RABBITMQ_PASS}"
RABBITMQ_LOGS: "DEBUG"
networks:
- docker-network
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 5s
timeout: 15s
retries: 5
ports:
- "15672:15672" # Web admin port
- "5672:5672" # Do not expose this port in production

# form_handler:
# build:
# context: python
# dockerfile: form_handler/Dockerfile-local
# depends_on:
# rabbitmq:
# condition: service_healthy
# restart: on-failure:20

# networks:
# - docker-network
# environment:
# RABBITMQ_URL: "${RABBITMQ_URL}"
# RABBITMQ_USER: "${RABBITMQ_USER}"
# RABBITMQ_PASS: "${RABBITMQ_PASS}"
# VIPS_API_USERNAME: "${VIPS_API_USERNAME}"
# VIPS_API_PASSWORD: "${VIPS_API_PASSWORD}"
# VIPS_API_ROOT_URL: "${VIPS_API_ROOT_URL}"
# COMM_SERV_AUTH_URL: "${COMM_SERV_AUTH_URL}"
# COMM_SERV_API_ROOT_URL: "${COMM_SERV_API_ROOT_URL}"
# COMM_SERV_REALM: "${COMM_SERV_REALM}"
# COMM_SERV_CLIENT_ID: "${COMM_SERV_CLIENT_ID}"
# COMM_SERV_CLIENT_SECRET: "${COMM_SERV_CLIENT_SECRET}"
# ADMIN_EMAIL_ADDRESS: "${ADMIN_EMAIL_ADDRESS}"
# BCC_EMAIL_ADDRESSES: "${BCC_EMAIL_ADDRESSES}"
# LOG_LEVEL: "INFO"
# ENCRYPT_KEY: "${ENCRYPT_KEY}"
version: "3.1"

services:
rabbitmq:
build: ./rabbitmq
environment:
# The RABBITMQ_DEFAULT_USER is used
# to connect to the web admin
RABBITMQ_DEFAULT_USER: "${RABBITMQ_USER}"
RABBITMQ_DEFAULT_PASS: "${RABBITMQ_PASS}"
RABBITMQ_LOGS: "DEBUG"
networks:
- docker-network
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 5s
timeout: 15s
retries: 5
ports:
- "15672:15672" # Web admin port
- "5672:5672" # Do not expose this port in production

# web_app:
# build:
# context: roadside-forms-frontend/frontend_web_app
# dockerfile: Dockerfile-local
# args:
# REACT_APP_BASE_URL: "${REACT_APP_BASE_URL_DEV}"
# REACT_APP_KEYCLOAK_URL: "${KEYCLOAK_AUTH_URL}"
# REACT_APP_KEYCLOAK_REALM: "${KEYCLOAK_REALM}"
# REACT_APP_KEYCLOAK_CLIENT_ID: "${KEYCLOAK_CLIENT_ID}"
# REACT_APP_API_BASE_URL: "${REACT_APP_API_BASE_URL}"
# env_file:
# - .env
# depends_on:
# - roadside-forms-api
# networks:
# - docker-network
# ports:
# - "3000:5000"
# form_handler:
# build:
# context: python
# dockerfile: form_handler/Dockerfile-local
# depends_on:
# rabbitmq:
# condition: service_healthy
# restart: on-failure:20

# networks:
# - docker-network
# environment:
# RABBITMQ_URL: "${RABBITMQ_URL}"
# RABBITMQ_USER: "${RABBITMQ_USER}"
# RABBITMQ_PASS: "${RABBITMQ_PASS}"
# VIPS_API_USERNAME: "${VIPS_API_USERNAME}"
# VIPS_API_PASSWORD: "${VIPS_API_PASSWORD}"
# VIPS_API_ROOT_URL: "${VIPS_API_ROOT_URL}"
# COMM_SERV_AUTH_URL: "${COMM_SERV_AUTH_URL}"
# COMM_SERV_API_ROOT_URL: "${COMM_SERV_API_ROOT_URL}"
# COMM_SERV_REALM: "${COMM_SERV_REALM}"
# COMM_SERV_CLIENT_ID: "${COMM_SERV_CLIENT_ID}"
# COMM_SERV_CLIENT_SECRET: "${COMM_SERV_CLIENT_SECRET}"
# ADMIN_EMAIL_ADDRESS: "${ADMIN_EMAIL_ADDRESS}"
# BCC_EMAIL_ADDRESSES: "${BCC_EMAIL_ADDRESSES}"
# LOG_LEVEL: "INFO"
# ENCRYPT_KEY: "${ENCRYPT_KEY}"

# web_app:
# build:
# context: roadside-forms-frontend/frontend_web_app
# dockerfile: Dockerfile-local
# args:
# REACT_APP_BASE_URL: "${REACT_APP_BASE_URL_DEV}"
# REACT_APP_KEYCLOAK_URL: "${KEYCLOAK_AUTH_URL}"
# REACT_APP_KEYCLOAK_REALM: "${KEYCLOAK_REALM}"
# REACT_APP_KEYCLOAK_CLIENT_ID: "${KEYCLOAK_CLIENT_ID}"
# REACT_APP_API_BASE_URL: "${REACT_APP_API_BASE_URL}"
# env_file:
# - .env
# depends_on:
# - roadside-forms-api
# networks:
# - docker-network
# ports:
# - "3000:5000"

minio:
image: 'minio/minio:latest'
ports:
- '${FORWARD_MINIO_PORT:-9000}:9000'
- '${FORWARD_MINIO_CONSOLE_PORT:-9090}:9090'
environment:
MINIO_ROOT_USER: 'root'
MINIO_ROOT_PASSWORD: 'password'
BITNAMI_DEBUG: "true"
SSL_ENABLED: "false"
MINIO_NOTIFY_AMQP_ENABLE_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_URL_DF_RABBITMQ: "amqp://admin:password@rabbitmq:5672"
MINIO_NOTIFY_AMQP_EXCHANGE_DF_RABBITMQ: "amq.direct"
MINIO_NOTIFY_AMQP_EXCHANGE_TYPE_DF_RABBITMQ: "direct"
MINIO_NOTIFY_AMQP_ROUTING_KEY_DF_RABBITMQ: "dfevents"
MINIO_NOTIFY_AMQP_AUTO_DELETED_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_DELIVERY_MODE_DF_RABBITMQ: "2"
MINIO_NOTIFY_AMQP_MANDATORY_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_IMMEDIATE_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_INTERNAL_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_NO_WAIT_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_DURABLE_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_QUEUE_DIR_DF_RABBITMQ: "/opt/events"
MINIO_NOTIFY_AMQP_QUEUE_LIMIT_DF_RABBITMQ: "100"
MINIO_ACCESS_KEY: "minio"
MINIO_SECRET_KEY: "minio123"
volumes:
- 'minio:/data/minio'
command: minio server /data/minio --console-address ":9090"
networks:
- docker-network

minio:
image: "minio/minio:latest"
ports:
- "${FORWARD_MINIO_PORT:-9000}:9000"
- "${FORWARD_MINIO_CONSOLE_PORT:-9090}:9090"
environment:
MINIO_ROOT_USER: "root"
MINIO_ROOT_PASSWORD: "password"
BITNAMI_DEBUG: "true"
SSL_ENABLED: "false"
MINIO_NOTIFY_AMQP_ENABLE_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_URL_DF_RABBITMQ: "amqp://admin:password@rabbitmq:5672"
MINIO_NOTIFY_AMQP_EXCHANGE_DF_RABBITMQ: "amq.direct"
MINIO_NOTIFY_AMQP_EXCHANGE_TYPE_DF_RABBITMQ: "direct"
MINIO_NOTIFY_AMQP_ROUTING_KEY_DF_RABBITMQ: "dfevents"
MINIO_NOTIFY_AMQP_AUTO_DELETED_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_DELIVERY_MODE_DF_RABBITMQ: "2"
MINIO_NOTIFY_AMQP_MANDATORY_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_IMMEDIATE_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_INTERNAL_DF_RABBITMQ: "off"
MINIO_NOTIFY_AMQP_NO_WAIT_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_DURABLE_DF_RABBITMQ: "on"
MINIO_NOTIFY_AMQP_QUEUE_DIR_DF_RABBITMQ: "/opt/events"
MINIO_NOTIFY_AMQP_QUEUE_LIMIT_DF_RABBITMQ: "100"
MINIO_ACCESS_KEY: "minio"
MINIO_SECRET_KEY: "minio123"
volumes:
- "minio:/data/minio"
command: minio server /data/minio --console-address ":9090"
networks:
- docker-network

roadside-forms-api:
build:
context: python
dockerfile: prohibition_web_svc/Dockerfile-local
env_file:
- .env
environment:
FLASK_SECRET_KEY: "${FLASK_SECRET_KEY}"
ICBC_API_ROOT: "http://icbc_mock_svc:5000/vips/icbc"
ICBC_LOGIN_USER_ID: "${ICBC_LOGIN_USER_ID}"
ICBC_API_USERNAME: "${ICBC_API_USERNAME}"
ICBC_API_PASSWORD: "${ICBC_API_PASSWORD}"
ACCESS_CONTROL_ALLOW_ORIGIN: "*"
LOG_LEVEL: "DEBUG"
KEYCLOAK_REALM: "${KEYCLOAK_REALM}"
KEYCLOAK_AUTH_URL: "${KEYCLOAK_AUTH_URL}"
KEYCLOAK_CLIENT_ID: "${KEYCLOAK_CLIENT_ID}"
ADMIN_USERNAME: "${ADMIN_USERNAME}"
FLASK_BASIC_AUTH_USER: "${FLASK_BASIC_AUTH_USER}"
FLASK_BASIC_AUTH_PASS: "${FLASK_BASIC_AUTH_PASS}"
MINIO_SK: "${MINIO_SK}"
MINIO_AK: "${MINIO_AK}"
command: bash -c "cd /home/appuser/python/prohibition_web_svc && flask db upgrade && gunicorn --bind 0.0.0.0:5000 --pythonpath /home/appuser/python/prohibition_web_svc 'app:create_app()'"
networks:
- docker-network
# network_mode: "host"
ports:
- "5002:5000"
x-develop:
watch:
- action: rebuild
path: "./python/prohibition_web_svc"
depends_on:
db:
condition: service_healthy

# roadside-forms-api:
# build:
# context: python
# dockerfile: prohibition_web_svc/Dockerfile-local
# env_file:
# - .env
# environment:
# FLASK_SECRET_KEY: "${FLASK_SECRET_KEY}"
# ICBC_API_ROOT: "http://icbc_mock_svc:5000/vips/icbc"
# ICBC_LOGIN_USER_ID: "${ICBC_LOGIN_USER_ID}"
# ICBC_API_USERNAME: "${ICBC_API_USERNAME}"
# ICBC_API_PASSWORD: "${ICBC_API_PASSWORD}"
# ACCESS_CONTROL_ALLOW_ORIGIN: "*"
# LOG_LEVEL: "DEBUG"
# KEYCLOAK_REALM: "${KEYCLOAK_REALM}"
# KEYCLOAK_AUTH_URL: "${KEYCLOAK_AUTH_URL}"
# KEYCLOAK_CLIENT_ID: "${KEYCLOAK_CLIENT_ID}"
# ADMIN_USERNAME: "${ADMIN_USERNAME}"
# FLASK_BASIC_AUTH_USER: "${FLASK_BASIC_AUTH_USER}"
# FLASK_BASIC_AUTH_PASS: "${FLASK_BASIC_AUTH_PASS}"
# MINIO_SK: "${MINIO_SK}"
# MINIO_AK: "${MINIO_AK}"
# command: bash -c "cd /home/appuser/python/prohibition_web_svc && flask db upgrade && gunicorn --bind 0.0.0.0:5000 --pythonpath /home/appuser/python/prohibition_web_svc 'app:create_app()'"
# networks:
# - docker-network
# # network_mode: "host"
# ports:
# - "5002:5000"
# x-develop:
# watch:
# - action: rebuild
# path: './python/prohibition_web_svc'
# depends_on:
# db:
# condition: service_healthy

db:
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=testuser
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=test
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
networks:
- docker-network
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "test", "-U", "testuser"]
interval: 5s
timeout: 5s
retries: 5
db:
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=testuser
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=test
ports:
- "5432:5432"
volumes:
- db:/var/lib/postgresql/data
networks:
- docker-network
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "test", "-U", "testuser"]
interval: 5s
timeout: 5s
retries: 5

# mock_svcs:
# build:
# context: mock_services
# dockerfile: all_mock_svc/Dockerfile-local
# environment:
# FLASK_SECRET_KEY: 1234
# API_USERNAME: user
# API_PASSWORD: password
# LOG_LEVEL: "DEBUG"
# networks:
# - docker-network
# ports:
# - "5003:5000"
# mock_svcs:
# build:
# context: mock_services
# dockerfile: all_mock_svc/Dockerfile-local
# environment:
# FLASK_SECRET_KEY: 1234
# API_USERNAME: user
# API_PASSWORD: password
# LOG_LEVEL: "DEBUG"
# networks:
# - docker-network
# ports:
# - "5003:5000"

networks:
docker-network:
Expand All @@ -180,4 +175,3 @@ volumes:
db: {}
minio:
driver: local

33 changes: 14 additions & 19 deletions python/prohibition_web_svc/blueprints/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,20 @@
CORS(bp, resources={Config.URL_PREFIX + "/api/v1/event/*": {"origins": Config.ACCESS_CONTROL_ALLOW_ORIGIN}})


@bp.route('', methods=['GET'])
def index(form_type):
"""
List all forms for a user
"""
# if request.method == 'GET':
# kwargs = helper.middle_logic(
# get_authorized_keycloak_user() + [
# {"try": splunk_middleware.log_form_index, "fail": []},
# {"try": form_middleware.list_all_users_forms, "fail": [
# {"try": http_responses.server_error_response, "fail": []},
# ]},
# {"try": splunk.log_to_splunk, "fail": []}
# ],
# required_permission='forms-index',
# request=request,
# form_type=form_type,
# config=Config)
# return kwargs.get('response')
@bp.route('/event', methods=['GET'])
def index():
if request.method == 'GET':
kwargs = middle_logic(
get_authorized_keycloak_user() + [
{"try": splunk.log_to_splunk, "fail": []},
{"try": event_middleware.get_events_for_user, "fail": [
{"try": http_responses.server_error_response, "fail": []}
]}
],
required_permission='forms-get',
request=request,
config=Config)
return kwargs.get('response')


@bp.route('', methods=['GET'])
Expand Down
Empty file.
Loading
Loading