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

feat: Support Aptible deployments #4340

Merged
merged 16 commits into from
Aug 12, 2024
Merged

feat: Support Aptible deployments #4340

merged 16 commits into from
Aug 12, 2024

Conversation

rolodato
Copy link
Contributor

@rolodato rolodato commented Jul 15, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

This PR adds functionality to enable deploying to Aptible, which an Enterprise prospect is currently evaluating. They have been able to work around these changes by forking open-source Flagsmith and making similar changes (i.e. removing waitfordb instead of making it optional). They would however need the changes to be upstreamed to deploy the Flagsmith Enterprise image.

Add /healthcheck as a health check route

Exposes the same health check endpoint on /healthcheck in addition to /health. Aptible (surprisingly) does not allow configuring a custom health check route and forces it to be /healthcheck. Strict health checks also do not accept redirects as responses.

There are some alternatives to directly adding /healthcheck as an alias of /health:

  1. Add an option to make the health check route configurable. This would require a more thorough documentation review and is potentially error prone. YAGNI also applies since we have never needed to customise the health check route at the API level (i.e. not using a proxy in front of it) until now.
  2. Add an option to opt in to the /healthcheck route, using some sort of "Aptible mode". I don't see a downside to always aliasing /health so this seems like extra complexity for no benefit.
  3. Add an option for additional configurable health check routes, i.e. in addition to /health. I believe YAGNI also applies here and we can add it later if needed.

Add SKIP_WAIT_FOR_DB environment variable

When Aptible is deploying an application, it first checks for successful health checks before it is added to the same network as an Aptible-hosted database. This means that trying to deploy Flagsmith to Aptible without these changes will always fail when health checks fail while waitfordb is hanging.

This PR adds an environment variable that skips waiting for the database before running migrations or starting the API.

It seemed to me that an environment variable is the least intrusive and Aptible-specific way we could support this - happy to consider different approaches and variable/parameter names.

How did you test this code?

Deployed Flagsmith to a trial Aptible account here using the steps described in the docs from this PR: https://app-76164.on-aptible.com/. I'll add a link in the docs to the actual Flagsmith release that contains these changes once ready.

Please describe.

Copy link

vercel bot commented Jul 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 12, 2024 2:05pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Aug 12, 2024 2:05pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Aug 12, 2024 2:05pm

@github-actions github-actions bot added the api Issue related to the REST API label Jul 15, 2024
Copy link
Contributor

github-actions bot commented Jul 15, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4340 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-4340 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-4340 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-4340 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4340 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4340 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 15, 2024

Uffizzi Preview deployment-54225 was deleted.

@rolodato rolodato force-pushed the feat/custom-healthcheck-url branch from 23d9f2b to b3cd868 Compare July 15, 2024 23:09
@rolodato rolodato changed the title WIP use /healthcheck endpoint feat: add configurable health endpoint Jul 15, 2024
@rolodato rolodato changed the title feat: add configurable health endpoint feat: (WIP) add configurable health endpoint Jul 15, 2024
@rolodato rolodato marked this pull request as ready for review July 15, 2024 23:16
@rolodato rolodato requested a review from a team as a code owner July 15, 2024 23:16
@rolodato rolodato requested review from novakzaballa, a team and matthewelwell and removed request for a team and novakzaballa July 15, 2024 23:16
@github-actions github-actions bot added the feature New feature or request label Jul 15, 2024
@rolodato rolodato removed the request for review from matthewelwell July 15, 2024 23:16
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.84%. Comparing base (b32a6ca) to head (305de0c).
Report is 50 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4340      +/-   ##
==========================================
+ Coverage   96.77%   96.84%   +0.06%     
==========================================
  Files        1159     1166       +7     
  Lines       38069    38675     +606     
==========================================
+ Hits        36842    37453     +611     
+ Misses       1227     1222       -5     

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

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Jul 15, 2024
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Jul 16, 2024
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Jul 16, 2024
@github-actions github-actions bot removed the feature New feature or request label Jul 16, 2024
@github-actions github-actions bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Jul 25, 2024
@github-actions github-actions bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Jul 25, 2024
@github-actions github-actions bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Jul 25, 2024
@rolodato
Copy link
Contributor Author

Got feedback from the prospect that this is working for them. The only thing that I haven't got working yet on Aptible is the task processor. It is possible to run it but need to keep experimenting with different settings.

@matthewelwell
Copy link
Contributor

matthewelwell commented Aug 9, 2024

Got feedback from the prospect that this is working for them. The only thing that I haven't got working yet on Aptible is the task processor. It is possible to run it but need to keep experimenting with different settings.

Should we mark this PR as draft until this is done then? Or merge this and submit another PR for the task processor?

@dabeeeenster
Copy link
Contributor

I vote to merge and then additional PRs if there's a need

@github-actions github-actions bot added docs Documentation updates and removed feature New feature or request docs Documentation updates labels Aug 12, 2024
@github-actions github-actions bot added the feature New feature or request label Aug 12, 2024
@rolodato rolodato added this pull request to the merge queue Aug 12, 2024
Merged via the queue into main with commit 3b47ae0 Aug 12, 2024
24 checks passed
@rolodato rolodato deleted the feat/custom-healthcheck-url branch August 12, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants