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

ci, dev: remove frontend nginx version, dev stack with bundled front … #10502

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

ElysaSrc
Copy link
Member

@ElysaSrc ElysaSrc commented Jan 23, 2025

The goal of this PR is to simplify the stack by:

  • Removing the nginx front image
  • Using the gateway front image by default
  • Removing various duplications between dockerfiles
  • Adding a script to manage all the docker compose stuff

Due to a limitation in Docker Compose not supporting targeting custom targets inside other Dockerfile in additional contexts, I've moved a part of the building system for the front on the Gateway Dockerfile. Not ideal, but does the trick.

NOTE : Before merging we should modify the protrected branch requirement

@github-actions github-actions bot added area:front Work on Standard OSRD Interface modules area:ci Work on Continous Integration Pipeline Service area:gateway labels Jan 23, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.89%. Comparing base (13d0dd3) to head (4c75436).
Report is 8 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #10502   +/-   ##
=======================================
  Coverage   81.89%   81.89%           
=======================================
  Files        1078     1079    +1     
  Lines      107178   107205   +27     
  Branches      724      729    +5     
=======================================
+ Hits        87771    87795   +24     
- Misses      19367    19370    +3     
  Partials       40       40           
Flag Coverage Δ
editoast 74.17% <ø> (-0.01%) ⬇️
front 89.46% <ø> (+<0.01%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 88.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch 4 times, most recently from 0cbd80a to 26def6a Compare January 23, 2025 13:36
@ElysaSrc ElysaSrc marked this pull request as ready for review January 23, 2025 13:38
@ElysaSrc ElysaSrc requested review from a team as code owners January 23, 2025 13:38
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch 2 times, most recently from 2cb59cf to 7327fa6 Compare January 23, 2025 15:36
@flomonster flomonster self-requested a review January 23, 2025 15:57
Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Maybe we should delete the scripts/host-compose.sh file?

@emersion emersion self-requested a review January 23, 2025 17:18
docker/docker-compose.front.yml Outdated Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
osrd-compose Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
osrd-compose Outdated Show resolved Hide resolved
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 7327fa6 to cf4852e Compare January 23, 2025 19:22
@ElysaSrc ElysaSrc requested a review from Khoyo January 23, 2025 19:23
osrd-compose Outdated Show resolved Hide resolved
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from cf4852e to 9ca9543 Compare January 23, 2025 19:35
@ElysaSrc ElysaSrc requested a review from Khoyo January 23, 2025 19:36
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 9ca9543 to 46fc9d4 Compare January 23, 2025 19:37
osrd-compose Outdated Show resolved Hide resolved
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 46fc9d4 to c1ea288 Compare January 23, 2025 19:41
@ElysaSrc ElysaSrc requested a review from Khoyo January 23, 2025 19:41
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch 3 times, most recently from 96338f2 to 1b70748 Compare January 24, 2025 09:31
@ElysaSrc
Copy link
Member Author

Various updates : the order of the overrides matters more than I thought, so I switched the way I pars env flags.

@ElysaSrc
Copy link
Member Author

Due to a limitation in Docker Compose not supporting targeting custom targets inside other Dockerfile in additional contexts, I've moved a part of the building system for the front on the Gateway Dockerfile. Not ideal, but does the trick.

Hm, what is the issue here? Why can't we use the latest stage (with everything built) as the front context for gateway?

(If we really can't do that, we could probably still use a separate Dockerfile in front/.)

Either way we must use additional contexts:

  • The gateway needs the built front, or
  • The front needs the built gateway

No matter how we integrate it, it does require additional contexts that can reference a specific stage of a docker file, a feature allowed by bakefiles but not compose file.

Since in production the front doesn't exist as a service but is bundled in the gateway, I've put the front building in the gateway dockerfile.

@emersion
Copy link
Member

emersion commented Jan 27, 2025

Sorry, I still don't understand why we need to reference a specific stage in additional_contexts. Let's say front/docker/Dockerfile builds the frontend (runs these npm commands). Can't gateway use that Dockerfile (specifically, its last stage) and copy the built files over?

I'd prefer to keep the NPM commands inside front/.

@ElysaSrc
Copy link
Member Author

ElysaSrc commented Jan 27, 2025

Sorry, I still don't understand why we need to reference a specific stage in additional_contexts. Let's say front/docker/Dockerfile builds the frontend (runs these npm commands). Can't gateway use that Dockerfile (specifically, its last stage) and copy the built files over?

From my understanding you can give it a path but not the built result of another dockerfile. If you find a way to achieve this without a bakefile we can do so, but I've tried without any success.

I'd prefer to keep the NPM commands inside front/.

I'd prefer too.

.github/workflows/build.yml Show resolved Hide resolved
osrd-compose Show resolved Hide resolved
@emersion
Copy link
Member

From my understanding you can give it a path but not the built result of another dockerfile. If you find a way to achieve this without a bakefile we can do so, but I've tried without any success.

Eh, you're correct. It seems like this is compose-spec/compose-spec#336.

@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from a88e08a to 5623b9b Compare January 27, 2025 14:54
@emersion
Copy link
Member

Is host+front mode really useful? If one runs in host mode and wants to hack on the front, they'll probably just run it outside docker, no?

@ElysaSrc
Copy link
Member Author

ElysaSrc commented Jan 27, 2025

Is host+front mode really useful? If one runs in host mode and wants to hack on the front, they'll probably just run it outside docker, no?

I feel that making this assumption is risky : we do not know each configuration the user is going to have relative to Docker and I believe we should keep it as unopinionated as possible on those subjects.

Also, the same issue exists with Single Worker and Front, there is no guarantee that someone working on Core could not require modifications on the front. I feel we should not remove an easy option for the developers, starting the stack outside docker can be cumbersome.

@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 5623b9b to fe1b2d6 Compare January 31, 2025 15:48
@ElysaSrc ElysaSrc requested a review from emersion January 31, 2025 15:49
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from fe1b2d6 to 488354a Compare February 4, 2025 08:55
@clarani
Copy link
Contributor

clarani commented Feb 4, 2025

I think we need to update the README ?

EDIT (by @bougue-pe ):
-> done in #10530

@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 488354a to 864e740 Compare February 5, 2025 12:57
@ElysaSrc ElysaSrc requested a review from clarani February 5, 2025 12:57
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 864e740 to 1767027 Compare February 5, 2025 12:59
Copy link
Contributor

@clarani clarani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

…by default

- Use the gateway-front in the e2e tests
- Simplify the integration tests step removing gateway and front images
- Use the gateway front image for the front, removing the container front
  of the default stack
- Create a Docker compose for the front devel stack

Signed-off-by: Élyse Viard <[email protected]>
Signed-off-by: Élyse Viard <[email protected]>
@ElysaSrc ElysaSrc force-pushed the ev/trash-nginx-front-devenv branch from 1767027 to 4c75436 Compare February 5, 2025 14:00
@ElysaSrc ElysaSrc enabled auto-merge February 5, 2025 14:04
@ElysaSrc ElysaSrc disabled auto-merge February 5, 2025 14:05
Copy link
Contributor

@RomainValls RomainValls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Mac, Docker desktop, works great 💪

@ElysaSrc ElysaSrc added this pull request to the merge queue Feb 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 5, 2025
@ElysaSrc ElysaSrc added this pull request to the merge queue Feb 5, 2025
Merged via the queue into dev with commit 018833a Feb 5, 2025
27 checks passed
@ElysaSrc ElysaSrc deleted the ev/trash-nginx-front-devenv branch February 5, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ci Work on Continous Integration Pipeline Service area:front Work on Standard OSRD Interface modules area:gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants