635 Sub-compose files #985

Merged
a24julot merged 9 commits from 635-Sub-compose-files-re-branch into team_1_week_6 2026-05-20 07:08:25 +00:00
Collaborator

Added sub-compose (will be calling them stacks) files for all (at the time) mockups and services. Some ongoing PR for other services will have to make their own stacks to later be added to the Rebuild script.

As of now, the Test script (both .bat and .sh) starts the all the stacks and create their own databases for each stacks, except frontend and "core" (consisting of middleware and MQTT). This PR only implements the stacks and the reviewer(s) are mostly to focus on if services work in a sub format.

Further issues for cleanup, addition of other services and expansion of the create service scripts will be made.

To start using stacks, remove (system prune) everything from docker, including images and compose files, and use the Test scripts.

The Test scripts and other cleanup will be done at the weekly merge so everything sync for both teams.

Relevant issue: #635

Added sub-compose (will be calling them stacks) files for all (at the time) mockups and services. Some ongoing PR for other services will have to make their own stacks to later be added to the Rebuild script. As of now, the Test script (both .bat and .sh) starts the all the stacks and create their own databases for each stacks, except frontend and "core" (consisting of middleware and MQTT). This PR only implements the stacks and the reviewer(s) are mostly to focus on if services work in a sub format. Further issues for cleanup, addition of other services and expansion of the create service scripts will be made. To start using stacks, remove (system prune) everything from docker, including images and compose files, and use the Test scripts. The Test scripts and other cleanup will be done at the weekly merge so everything sync for both teams. Relevant issue: #635
Modified existing services so that they work with their specific database.
Changes for parking, login and layout services. Everything boots and is at least reachable
Removed redundant networks from sub-compose files.
Updated/Created scripts as placeholders, Test will eventually replace the existing Rebuild scripts
For some reason my branch wanted the cron jobs gone. Re-added them to their right place (only affects the temperature database)
a22erigr 2026-05-18 09:11:24 +00:00
b24idalu requested changes 2026-05-18 11:19:10 +00:00
Dismissed
b24idalu left a comment
Collaborator

Review on #635

Whats done

Implemented sub-compose/stacks

Tested on Windows using Chrome/Firefox

  • App starts
    • After having switched branch to current one, all docker containers/images/volumes were removed. Ran installation and then the test file.
    • All cards requiring databases work
      • Default temperature does not update every 15s anymore, do not think it has to do with this compose however.

Inspected following files

  • DockerCompose/stacks/roomBooking/compose.yaml
    • Has a comment in it saying "change this line back", unsure if the comment is solved.
    • Same with file: DockerCompose/stacks/user/compose.yaml & DockerCompose/stacks/parking/compose.yaml
  • middleware/middleware/Program.cs
    • DeleteMessage and updatemessage has been commented out (?)
  • Test files
    • Should compose error in core cause cancelation, has this comment been discussed?
      +scripts/Test.sh
    • See prior comment, this comment uses :: instead of #
  • service/roomBookingService/roomBookingService/DatabaseLogic/DatabaseQueries.cs
    • Can comment on line 72/112/149 be removed? Or what use do they have

What needs to be done

  • scripts/Test.sh
    • Change to the right comment format

Conclusion

  • Should be tested by a unix user as well probably before merge. Cannot test Test.sh other than looking at it
  • Should code that is commented out be removed?
# Review on #635 ## Whats done Implemented sub-compose/stacks ### Tested on Windows using Chrome/Firefox + App starts + After having switched branch to current one, all docker containers/images/volumes were removed. Ran installation and then the test file. + All cards requiring databases work + Default temperature does not update every 15s anymore, do not think it has to do with this compose however. ### Inspected following files + DockerCompose/stacks/roomBooking/compose.yaml + Has a comment in it saying "change this line back", unsure if the comment is solved. + Same with file: DockerCompose/stacks/user/compose.yaml & DockerCompose/stacks/parking/compose.yaml + middleware/middleware/Program.cs + DeleteMessage and updatemessage has been commented out (?) + Test files + Should compose error in core cause cancelation, has this comment been discussed? +scripts/Test.sh - See prior comment, this comment uses :: instead of # - service/roomBookingService/roomBookingService/DatabaseLogic/DatabaseQueries.cs - Can comment on line 72/112/149 be removed? Or what use do they have ## What needs to be done + scripts/Test.sh + Change to the right comment format ## Conclusion + Should be tested by a unix user as well probably before merge. Cannot test Test.sh other than looking at it + Should code that is commented out be removed?
Author
Collaborator
  • Default temperature does not update every 15s anymore, do not think it has to do with this compose however.

It shouldn't, I at least haven't touched anything within the poll frequency. According to the config file it should happen every minute for the graph and default view.

// Define base time units for easier math
const SECOND = 1000;
const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;

export const POLL_FREQUENCY_CONFIG = {
	// Temperature Views
	TEMPERATURE_GRAPH: MINUTE,
	TEMPERATURE_ALL: 5 * MINUTE,
	TEMPERATURE_WEEK: 15 * MINUTE,
	TEMPERATURE_DEFAULT: MINUTE,

	// SMHI Views
	SMHI_FORECAST: HOUR,
	SMHI_TEMPERATURE: 30 * MINUTE,

	// Other Views
	PARKING: MINUTE,
	BOOKING: 5 * MINUTE,
	SCHEDULE: HOUR,
};
  • DockerCompose/stacks/roomBooking/compose.yaml

    • Has a comment in it saying "change this line back", unsure if the comment is solved.
    • Same with file: DockerCompose/stacks/user/compose.yaml & DockerCompose/stacks/parking/compose.yaml

This comment in the compose file ha been existing for a while, and I don't really know where it comes from or if it has been solved. When looking through the history of the file it seems to never have changed (?). As it works and don't seem to be an issue anymore I will remove it.

  • DeleteMessage and updatemessage has been commented out (?)

    • Test files

    • Should compose error in core cause cancelation, has this comment been discussed?
      +scripts/Test.sh

  • See prior comment, this comment uses :: instead of #

Will fix.

  • service/roomBookingService/roomBookingService/DatabaseLogic/DatabaseQueries.cs

  • Can comment on line 72/112/149 be removed? Or what use do they have

I've been trying to keep most of other peoples code as they are. Some things have been commented out because they were not working with the new setup or they have always been there. I don't know if anything should be removed permanently or just commented out as I feel like I'm stepping on peoples toes. People are writing code so differently from each other that it feels hard whether to change their code or adapt mine.

I think I'll leave middleware as the mess that it is due to how it already needs a major cleanup (will create an issue about this). But I'll remove every other unnecessary comment.

> * Default temperature does not update every 15s anymore, do not think it has to do with this compose however. It shouldn't, I at least haven't touched anything within the poll frequency. According to the config file it should happen every minute for the graph and default view. ``` js // Define base time units for easier math const SECOND = 1000; const MINUTE = 60 * SECOND; const HOUR = 60 * MINUTE; export const POLL_FREQUENCY_CONFIG = { // Temperature Views TEMPERATURE_GRAPH: MINUTE, TEMPERATURE_ALL: 5 * MINUTE, TEMPERATURE_WEEK: 15 * MINUTE, TEMPERATURE_DEFAULT: MINUTE, // SMHI Views SMHI_FORECAST: HOUR, SMHI_TEMPERATURE: 30 * MINUTE, // Other Views PARKING: MINUTE, BOOKING: 5 * MINUTE, SCHEDULE: HOUR, }; ``` > * DockerCompose/stacks/roomBooking/compose.yaml > > * Has a comment in it saying "change this line back", unsure if the comment is solved. > * Same with file: DockerCompose/stacks/user/compose.yaml & DockerCompose/stacks/parking/compose.yaml This comment in the compose file ha been existing for a while, and I don't really know where it comes from or if it has been solved. When looking through the history of the file it seems to never have changed (?). As it works and don't seem to be an issue anymore I will remove it. > * DeleteMessage and updatemessage has been commented out (?) > * Test files > > * Should compose error in core cause cancelation, has this comment been discussed? > +scripts/Test.sh > > > * See prior comment, this comment uses :: instead of # Will fix. > * service/roomBookingService/roomBookingService/DatabaseLogic/DatabaseQueries.cs > > * Can comment on line 72/112/149 be removed? Or what use do they have I've been trying to keep most of other peoples code as they are. Some things have been commented out because they were not working with the new setup or they have always been there. I don't know if anything should be removed permanently or just commented out as I feel like I'm stepping on peoples toes. People are writing code so differently from each other that it feels hard whether to change their code or adapt mine. I think I'll leave middleware as the mess that it is due to how it already needs a major cleanup (will create an issue about this). But I'll remove every other unnecessary comment.
Removed unused variables and comments due to feedback
Due to how the --wait parameter works in Docker, the script will cancel if the compose file fails to start.
b24idalu approved these changes 2026-05-18 14:06:40 +00:00
b24idalu left a comment
Collaborator

Looks good, ready for merge.

Looks good, ready for merge.
Collaborator

I can test on linux

I can test on linux
Collaborator

Waiting to merge this until it has been reviewed for linux as well.

Waiting to merge this until it has been reviewed for linux as well.
a24sakma requested changes 2026-05-19 11:02:34 +00:00
Dismissed
a24sakma left a comment
Collaborator

The change above needed for linux. I am testing on linux again and it is not up. I will test again.

The change above needed for linux. I am testing on linux again and it is not up. I will test again.
@ -0,0 +15,4 @@
$$ LANGUAGE plpgsql;
-- If job already exists, unschedule to avoid duplicates
SELECT cron.unschedule('calculate_daily_averages_job');
Collaborator

This change was needed for cron job

	SELECT cron.unschedule(jobid)
	FROM cron.job
	WHERE jobname = 'calculate_daily_averages_job';
This change was needed for cron job ``` SELECT cron.unschedule(jobid) FROM cron.job WHERE jobname = 'calculate_daily_averages_job'; ```
a24sakma marked this conversation as resolved
@ -0,0 +42,4 @@
# user
docker compose -f stacks/user/compose.yaml --env-file ./.env down --volumes
docker build -t loginservice ../service/loginService/loginservice
Collaborator

loginservice shall be changed to loginService

loginservice shall be changed to loginService
a24sakma marked this conversation as resolved
@ -0,0 +50,4 @@
# Note: It is important that frontend runs last, as all endpoints have to be established
docker compose -f stacks/frontend/compose.yaml --env-file ./.env down --volumes
docker build -t frontend ../frontend
docker build -t entrypoint ../entrypoint
Collaborator

entrypoint shall be changed to entryPoint.

entrypoint shall be changed to entryPoint.
a24sakma marked this conversation as resolved
Collaborator

Notes:

The branch runs without error when applying the above changes.
When that is done we can merge it

Notes: The branch runs without error when applying the above changes. When that is done we can merge it
- Fixed pathing to loginService and entryPoint
- Fixed a misspelling of "frontend"
- Commented out all cron related code in the temperature database, as it would still make the container unhealthy on my machine (sometimes). This can be fixed later.
a24sakma approved these changes 2026-05-20 07:08:08 +00:00
a24sakma left a comment
Collaborator

Awesome! Really good change.

Ready to be merged.

Awesome! Really good change. Ready to be merged.
a24julot merged commit 9707220a0a into team_1_week_6 2026-05-20 07:08:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!985
No description provided.