Skip to content

Commit 0b9b0c3

Browse files
pcrespovodeimaiz
andcommitted
✨ Announcements entrypoint at the web-api (⚠️ devops) (#4487)
Co-authored-by: Odei Maiz <[email protected]>
1 parent 5c7173d commit 0b9b0c3

File tree

26 files changed

+673
-100
lines changed

26 files changed

+673
-100
lines changed

.env-devel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ TRAEFIK_SIMCORE_ZONE=internal_simcore_stack
107107
# NOTE: WEBSERVER_SESSION_SECRET_KEY = $(python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key())")
108108
PROJECTS_MAX_COPY_SIZE_BYTES=30Gib
109109
PROJECTS_MAX_NUM_RUNNING_DYNAMIC_NODES=5
110+
WEBSERVER_ANNOUNCEMENTS=1
110111
WEBSERVER_DEV_FEATURES_ENABLED=0
111112
WEBSERVER_HOST=webserver
112113
WEBSERVER_LOGIN_REGISTRATION_CONFIRMATION_REQUIRED=0

.env-wb-db-event-listener

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Docs plugins config of services/web/server/src/simcore_service_webserver/application_settings.py
44
#
55

6-
6+
WEBSERVER_ANNOUNCEMENTS=0
77
WEBSERVER_ACTIVITY=null
88
WEBSERVER_CATALOG=null
99
WEBSERVER_NOTIFICATIONS=0

.env-wb-garbage-collector

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55

66

7+
WEBSERVER_ANNOUNCEMENTS=0
78
WEBSERVER_ACTIVITY=null
89
WEBSERVER_CATALOG=null
910
WEBSERVER_NOTIFICATIONS=0
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
paths:
2+
/announcements:
3+
get:
4+
tags:
5+
- announcements
6+
summary: List Announcements
7+
operationId: list_announcements
8+
responses:
9+
'200':
10+
description: Successful Response
11+
content:
12+
application/json:
13+
schema:
14+
$ref: '#/components/schemas/Envelope_list_simcore_service_webserver.announcements._models.Announcement__'
15+
components:
16+
schemas:
17+
Announcement:
18+
properties:
19+
id:
20+
type: string
21+
title: Id
22+
products:
23+
items:
24+
type: string
25+
enum:
26+
- osparc
27+
- s4l
28+
- s4llite
29+
- tis
30+
type: array
31+
title: Products
32+
start:
33+
type: string
34+
format: date-time
35+
title: Start
36+
end:
37+
type: string
38+
format: date-time
39+
title: End
40+
title:
41+
type: string
42+
title: Title
43+
description:
44+
type: string
45+
title: Description
46+
link:
47+
type: string
48+
title: Link
49+
widgets:
50+
items:
51+
type: string
52+
enum:
53+
- login
54+
- ribbon
55+
- user-menu
56+
type: array
57+
title: Widgets
58+
type: object
59+
required:
60+
- id
61+
- products
62+
- start
63+
- end
64+
- title
65+
- description
66+
- link
67+
- widgets
68+
title: Announcement
69+
Envelope_list_simcore_service_webserver.announcements._models.Announcement__:
70+
properties:
71+
data:
72+
items:
73+
$ref: '#/components/schemas/Announcement'
74+
type: array
75+
title: Data
76+
error:
77+
title: Error
78+
type: object
79+
title: Envelope[list[simcore_service_webserver.announcements._models.Announcement]]

api/specs/webserver/openapi.yaml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.0.0
22
info:
33
title: "osparc-simcore web API"
4-
version: 0.24.0
4+
version: 0.25.0
55
description: "API designed for the front-end app"
66
contact:
77
name: IT'IS Foundation
@@ -23,28 +23,16 @@ servers:
2323
enum:
2424
- v0
2525
default: v0
26-
tags:
27-
- name: activity
28-
- name: admin
29-
- name: authentication
30-
- name: catalog
31-
- name: cluster
32-
- name: configuration
33-
- name: maintenance
34-
- name: nih-sparc
35-
- name: project
36-
- name: publication
37-
- name: repository
38-
- name: storage
39-
- name: tag
40-
- name: tasks
41-
- name: user
4226

4327
paths:
4428
# ADMIN -------------
4529
/email:test:
4630
$ref: "./openapi-admin.yaml#/paths/~1email:test"
4731

32+
# ANNOUNCEMENTS ---------------------------------------------------------
33+
/announcements:
34+
$ref: "./openapi-announcements.yaml#/paths/~1announcements"
35+
4836
# DIAGNOSTICS ---------------------------------------------------------
4937
/:
5038
$ref: "./openapi-diagnostics.yaml#/paths/~1"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
""" Helper script to generate OAS automatically
2+
"""
3+
4+
# pylint: disable=redefined-outer-name
5+
# pylint: disable=unused-argument
6+
# pylint: disable=unused-variable
7+
# pylint: disable=too-many-arguments
8+
9+
10+
from enum import Enum
11+
12+
from fastapi import FastAPI
13+
from models_library.generics import Envelope
14+
from simcore_service_webserver.announcements._handlers import Announcement
15+
16+
app = FastAPI(redoc_url=None)
17+
18+
TAGS: list[str | Enum] = [
19+
"announcements",
20+
]
21+
22+
23+
@app.get(
24+
"/announcements",
25+
response_model=Envelope[list[Announcement]],
26+
tags=TAGS,
27+
operation_id="list_announcements",
28+
)
29+
async def list_announcements():
30+
...
31+
32+
33+
if __name__ == "__main__":
34+
from _common import CURRENT_DIR, create_openapi_specs
35+
36+
create_openapi_specs(app, CURRENT_DIR.parent / "openapi-announcements.yaml")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Extra reqs, besides webserver's
22

3-
fastapi
3+
fastapi<0.100
44
jsonref

packages/settings-library/src/settings_library/redis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class RedisDatabase(int, Enum):
1414
VALIDATION_CODES = 2
1515
SCHEDULED_MAINTENANCE = 3
1616
USER_NOTIFICATIONS = 4
17+
ANNOUNCEMENTS = 5
1718

1819

1920
class RedisSettings(BaseCustomSettings):

services/docker-compose-ops.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ services:
8686
image: rediscommander/redis-commander:latest
8787
init: true
8888
environment:
89-
- REDIS_HOSTS=resources:${REDIS_HOST}:${REDIS_PORT}:0,locks:${REDIS_HOST}:${REDIS_PORT}:1,validation_codes:${REDIS_HOST}:${REDIS_PORT}:2,scheduled_maintenance:${REDIS_HOST}:${REDIS_PORT}:3,user_notifications:${REDIS_HOST}:${REDIS_PORT}:4
89+
- REDIS_HOSTS=resources:${REDIS_HOST}:${REDIS_PORT}:0,locks:${REDIS_HOST}:${REDIS_PORT}:1,validation_codes:${REDIS_HOST}:${REDIS_PORT}:2,scheduled_maintenance:${REDIS_HOST}:${REDIS_PORT}:3,user_notifications:${REDIS_HOST}:${REDIS_PORT}:4,announcements:${REDIS_HOST}:${REDIS_PORT}:5
9090
# If you add/remove a db, do not forget to update the --databases entry in the docker-compose.yml
9191
ports:
9292
- "18081:8081"

services/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ services:
560560
"--loglevel",
561561
"verbose",
562562
"--databases",
563-
"5",
563+
"6",
564564
"--appendonly",
565565
"yes"
566566
]

0 commit comments

Comments
 (0)