1061 Rebuild script improvements #1074

Merged
a24julot merged 7 commits from 1061-Rebuild-script-improvements into team_1_week_7 2026-05-26 06:45:25 +00:00
Collaborator

Made it so that the rebuild scripts stop and remove all old containers before starting up new ones, essentially making it so that not matter which branch you come from, you will always build the correct containers.

Also, not related to this issue at all, but removed a init container from file service. I've discussed this with @a24noabe and in his words "Helt fritt fram att optimera, Mr Docker".

Related issue: #1061

Made it so that the rebuild scripts stop and remove all old containers before starting up new ones, essentially making it so that not matter which branch you come from, you will always build the correct containers. Also, not related to this issue at all, but removed a init container from file service. I've discussed this with @a24noabe and in his words _"Helt fritt fram att optimera, Mr Docker"_. Related issue: #1061
Added docker stop and docker rm before starting containers, should make building more consistent.

We should also discuss if we should prune before building.
Added pruning to the scripts. Also removed some unnecessary stuff from the file service compose file (me and Noah talked about it)
Collaborator

Review

Windows

Worked beautifully.

Unix (Parallel script)

Worked beautifully.

Unix (Debug script)

Worked beautifully.

Conclusion:

Author is beautiful, ready to merge.

# Review ## Windows Worked beautifully. ## Unix (Parallel script) Worked beautifully. ## Unix (Debug script) Worked beautifully. # Conclusion: Author is beautiful, ready to merge.
Collaborator

Has this script implemented parallelism?

Has this script implemented parallelism?
Author
Collaborator

The script doesn't currently use parallelism and with the current structure I see two possible solutions/alternatives:

  • We can either parallel the image creations for each compose file, but it would still have to wait right before every compose, it would only mildly benefit some composes. Looking something like this:
    # core
    docker build -t middleware ../middleware/middleware &
    wait
    docker compose -f core/compose.yaml --env-file ./.env up -d --wait
    
    # temperature 
    docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup &
    docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup &
    docker build -t tempservice ../service/tempService/tempService &
    wait
    docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d
    
  • Or we could build all images in the beginning in parallel and waiting before running all compose files (possibly in parallel). Looking something like this:
    # image
    
    # core
    docker build -t middleware ../middleware/middleware &
    
    # temperature
    docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup &
    docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup &
    docker build -t tempservice ../service/tempService/tempService &
    
    wait
    docker compose -f core/compose.yaml --env-file ./.env up -d --wait
    docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d &
    etc...
    
    The downside with this is that we lose a lot of readability and we are basically back to the way the old compose file looked like, and if you open it now and look you will see why this script isn't structured like that one is.
The script doesn't currently use parallelism and with the current structure I see two possible solutions/alternatives: - We can either parallel the image creations for each compose file, but it would still have to wait right before every compose, it would only mildly benefit some composes. Looking something like this: ```bash # core docker build -t middleware ../middleware/middleware & wait docker compose -f core/compose.yaml --env-file ./.env up -d --wait # temperature docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup & docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup & docker build -t tempservice ../service/tempService/tempService & wait docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d ``` - Or we could build all images in the beginning in parallel and waiting before running all compose files (possibly in parallel). Looking something like this: ```bash # image # core docker build -t middleware ../middleware/middleware & # temperature docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup & docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup & docker build -t tempservice ../service/tempService/tempService & wait docker compose -f core/compose.yaml --env-file ./.env up -d --wait docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d & etc... ``` The downside with this is that we lose a lot of readability and we are basically back to the way the old compose file looked like, and if you open it now and look you will see why this script isn't structured like that one is.
Collaborator

@a24timsv wrote in #1074 (comment):

The script doesn't currently use parallelism and with the current structure I see two possible solutions/alternatives:

* We can either parallel the image creations for each compose file, but it would still have to wait right before every compose, it would only mildly benefit some composes. Looking something like this:
  ```bash
  # core
  docker build -t middleware ../middleware/middleware &
  wait
  docker compose -f core/compose.yaml --env-file ./.env up -d --wait
  
  # temperature 
  docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup &
  docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup &
  docker build -t tempservice ../service/tempService/tempService &
  wait
  docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d
  ```

* Or we could build all images in the beginning in parallel and waiting before running all compose files (possibly in parallel). Looking something like this:
  ```bash
  # image
  
  # core
  docker build -t middleware ../middleware/middleware &
  
  # temperature
  docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup &
  docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup &
  docker build -t tempservice ../service/tempService/tempService &
  
  wait
  docker compose -f core/compose.yaml --env-file ./.env up -d --wait
  docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d &
  etc...
  ```
  
  The downside with this is that we lose a lot of readability and we are basically back to the way the old compose file looked like, and if you open it now and look you will see why this script isn't structured like that one is.

I have created a script based on your previous version that runs in parallel. Can be found here #1056 . The DebugScript does not run in parallel so if you want se the output just use that one. It copies from the regular scripts so they are always the same.(- parallel)

@a24timsv wrote in https://git.webug.se/Andras/BoundlessFlowCampus2K/pulls/1074#issuecomment-12936: > The script doesn't currently use parallelism and with the current structure I see two possible solutions/alternatives: > > * We can either parallel the image creations for each compose file, but it would still have to wait right before every compose, it would only mildly benefit some composes. Looking something like this: > ```bash > # core > docker build -t middleware ../middleware/middleware & > wait > docker compose -f core/compose.yaml --env-file ./.env up -d --wait > > # temperature > docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup & > docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup & > docker build -t tempservice ../service/tempService/tempService & > wait > docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d > ``` > > * Or we could build all images in the beginning in parallel and waiting before running all compose files (possibly in parallel). Looking something like this: > ```bash > # image > > # core > docker build -t middleware ../middleware/middleware & > > # temperature > docker build -t readtempsensormockup ../readMockup/readTempSensorMockup/readTempSensorMockup & > docker build -t tempsensormockup ../generateMockup/tempSensorMockup/tempSensorMockup & > docker build -t tempservice ../service/tempService/tempService & > > wait > docker compose -f core/compose.yaml --env-file ./.env up -d --wait > docker compose -f stacks/temperature/compose.yaml --env-file ./.env up -d & > etc... > ``` > > The downside with this is that we lose a lot of readability and we are basically back to the way the old compose file looked like, and if you open it now and look you will see why this script isn't structured like that one is. I have created a script based on your previous version that runs in parallel. Can be found here #1056 . The DebugScript does not run in parallel so if you want se the output just use that one. It copies from the regular scripts so they are always the same.(- parallel)
Collaborator

@a24timsv is this ready to be merged?

@a24timsv is this ready to be merged?
Trying a solution to execute the building in parallel, as a need of some developers parallelism fixation.
Collaborator

bild

![bild](/attachments/4f203b1c-7171-42df-82d6-0a87ed86e827)
933 KiB
Collaborator

The script does not work for me

The script does not work for me
As the PR has blown a little out of proportion, as it was only meant to add docker stop and docker rm to the Rebuild scripts, it has devolved to trying (and failing) to introduce parallelism. This is a good idea, but for another issue and PR.
Author
Collaborator

As explained in the PR scope commit, the scripts will focus on what issue #1061 was originally intended to do. As such, parallelism and all related to it has been removed. Since we are also reaching the end of this project, the relevance for faster building times become less and less relevant. A separate issue for the use of parallellism can be created if needed.

As explained in the [PR scope commit](https://git.webug.se/Andras/BoundlessFlowCampus2K/commit/6d4c3d9250cd5163fd9ddd22c57c3d344a51b663), the scripts will focus on what issue #1061 was originally intended to do. As such, parallelism and all related to it has been removed. Since we are also reaching the end of this project, the relevance for faster building times become less and less relevant. A separate issue for the use of parallellism can be created if needed.
Collaborator

So, is this ready for merge? @a24timsv

So, is this ready for merge? @a24timsv
Author
Collaborator

Yes

Yes
a24julot merged commit 9431697d16 into team_1_week_7 2026-05-26 06:45: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!1074
No description provided.