Application fails to start (SZ-17)
Artur Hefczyc opened 1 week ago

I am following README file instructions to build and run docker image. Building works and running works to some extent. It fails with the following error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

It seems there is some instructions missing in the README file about how to fully set the system to run Sztab. If I am correct there should be some instructions about data source setup. Maybe we could have a docker compose file to run both Sztab and database to have a working system.

  • rk@tigase.net commented 5 days ago

    The only blocker was a mismatch between the configured DB name (sztab_db) and the volume-persisted state from earlier runs (which lacked this database). I've isolated the issue — once the PostgreSQL volume is reset via docker-compose down -v, everything comes up cleanly with the new schema and data inserts.

    I’ll wrap this up first thing tomorrow after confirming a fresh bootstrap end-to-end.

  • rk@tigase.net changed state to 'In Progress' 5 days ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 4 days ago

    SZ-17 Goal Achieved

    The docker-compose deployment of Sztab now runs successfully with:

    • PostgreSQL backend
    • basic-auth Spring profile enabled
    • Secure endpoints (e.g., /api/users) protected by HTTP Basic Authentication
    • README updated with instructions on how to stand up Sztab using docker compose.

    Known Issue (to be tracked separately)

    The admin user is not being authenticated, even though it is defined in:

    • application-basic-auth.yml
    • Initialized by DataBootstrapper (during application startup)

    Attempts to access secured endpoints using the expected credentials (e.g., admin@sztab.local / admin123) result in HTTP 401 Unauthorized.

    This appears to be a bug in the basic-auth bootstrap flow, and will be tracked under a separate issue (e.g., SZ-7-1 or SZ-20).


    Note on Unit Tests

    Unit and integration tests for basic-auth functionality will be added in a follow-up issue (SZ-7-1).

  • rk@tigase.net commented 4 days ago

    Supporting both OIDC and Basic Authentication required modularizing the Spring Security setup to enable profile-driven conditional configuration. I had to create separate security configuration classes — each annotated with @Profile("oidc") or @Profile("basic-auth") — to ensure only the relevant authentication mechanism is active during runtime.

    For Basic Auth, there is the bootstrap mechanism that seeds the admin user from application-basic-auth.yml and delegates all other users to the database via DataBootstrapper. Plase note that the naked admin credentials in application-basic-auth.yml is only for test and development; it will eventually go away.

    To prevent Spring Boot’s default test auto-configuration from interfering (e.g., H2 or JPA being loaded unnecessarily during Basic Auth tests), I disabled DataSourceAutoConfiguration and HibernateJpaAutoConfiguration in test contexts.

    These setup choices, while increasing initial complexity, allow Sztab to cleanly support multiple authentication strategies without entangling their logic. Unit and integration tests for the Basic Auth flow will follow in .

  • rk@tigase.net commented 4 days ago

    Merging proactively per Artur’s guidance — tracking remaining work under a new defect.

    Merged bugfix/issue-17 → wolnosc using --no-ff for a clear merge commit

  • rk@tigase.net changed state to 'Closed' 4 days ago
    Previous Value Current Value
    In Progress
    Closed
  • rk@tigase.net commented 4 days ago

    Estimated Time to Resolve

    TaskDescriptionEstimated Time
    Docker Compose SetupWrite and verify docker-compose.yml with PostgreSQL and backend services2–3 hours
    Profile ConfigCreate application-basic-auth.yml, test SPRING_PROFILES_ACTIVE, and integrate admin bootstrap2–3 hours
    TestingRun manual tests (curl, browser) to verify secured endpoints work1 hour
    DocsUpdate README.md with docker setup and curl usage instructions1 hour
    CoordinationPR creation, communication with Artur, git merge workflow1 hour

    Total: 7–9 hours

issue 1 of 1
Type
Documentation
Priority
Normal
Assignee
Version
none
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-17
Please wait...
Page is in error, reload to recover