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

Feature sram #20

Merged
merged 7 commits into from
Dec 16, 2024
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
stepup/gateway/surfnet_yubikey.yaml
stepup/.env
/.idea
/.idea
.env
4 changes: 4 additions & 0 deletions core/dbschema/createdbs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CREATE DATABASE IF NOT EXISTS spdashboard;
CREATE DATABASE IF NOT EXISTS invite;
CREATE DATABASE IF NOT EXISTS userlifecycle;
CREATE DATABASE IF NOT EXISTS spdashboard;
CREATE DATABASE IF NOT EXISTS sbs;

CREATE USER IF NOT EXISTS 'ebrw'@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON eb.* TO 'ebrw'@'%';
Expand All @@ -30,3 +31,6 @@ GRANT ALL PRIVILEGES ON userlifecycle.* TO 'userlifecyclerw'@'%';

CREATE USER IF NOT EXISTS 'spdrwrw'@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON spdashboard.* TO 'spdrwrw'@'%';

CREATE USER IF NOT EXISTS 'sbs'@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON sbs.* TO 'sbs'@'%';
51 changes: 50 additions & 1 deletion core/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- spdashboard.dev.openconext.local
- mujina-idp.dev.openconext.local
- invite.dev.openconext.local
- sbs.dev.openconext.local
hostname: haproxy.docker

mariadb:
Expand All @@ -42,7 +43,6 @@ services:

mongo:
image: bitnami/mongodb:7.0
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: secret
Expand Down Expand Up @@ -416,6 +416,55 @@ services:
coreconextdev:
hostname: mailcatcher.docker

redis:
image: "redis"
healthcheck:
test: ["CMD", "redis-cli","ping"]
timeout: 5s
retries: 10
networks:
coreconextdev:
hostname: redis.docker
profiles:
- "sbs"

# This is apache RP
# client -> docroot
# api -> sbs-server:8080
sbs:
image: ghcr.io/surfscz/sram-sbs-client:openconext-dev
networks:
coreconextdev:
hostname: sbs.docker
depends_on:
sbs-server:
condition: service_healthy
profiles:
- "sbs"

sbs-server:
image: ghcr.io/surfscz/sram-sbs-server:openconext-dev
environment:
TESTING: 1
PROFILE: "local"
ALLOW_MOCK_USER_API: 1
volumes:
- ./sbs/config:/opt/sbs/config
networks:
coreconextdev:
healthcheck:
test: ["CMD", "curl", "--fail", "-s", "http://localhost:8080/health"]
timeout: 5s
retries: 10
hostname: sbs-server.docker
depends_on:
redis:
condition: service_healthy
mariadb:
condition: service_healthy
profiles:
- "sbs"

networks:
coreconextdev:
driver: bridge
Expand Down
73 changes: 73 additions & 0 deletions core/sbs/config/alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = migrations

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# timezone to use when rendering the date
# within the migration file as well as the filename.
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =

# max length of characters to apply to the
# "slug" field
#truncate_slug_length = 40

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false

# version location specification; this defaults
# to alembic/versions. When using multiple version
# directories, initial revisions must be specified with --version-path
# version_locations = %(here)s/bar %(here)s/bat alembic/versions

# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = mysql+mysqldb://sbs:secret@mariadb/sbs?charset=utf8mb4


# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = NOTSET
handlers = console

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = DEBUG
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
Loading
Loading