tv icon indicating copy to clipboard operation
tv copied to clipboard

Graceful deployments

Open zcesur opened this issue 1 year ago • 11 comments

Let's set up a Fly.io deployment pipeline such that machines running with an old version are shut down gracefully. This is important to ensure livestreams are not interrupted during deployments

This tweet along with this complementary repo explain how we can implement this

The only missing part is to destroy old machines after all running livestreams are terminated, which we can implement inside the end_of_stream callback using Membrane.Pipeline.list_pipelines

If anyone wants to tackle this, please include a short demo of the entire process in the PR, which should include:

  1. Starting a livestream
  2. Triggering a deployment
  3. Confirming that the livestream is still running once the new version is deployed
  4. Stopping the livestream
  5. Confirming that the old machine is destroyed automatically

zcesur avatar Sep 03 '24 16:09 zcesur

/bounty $50

zcesur avatar Sep 03 '24 16:09 zcesur

💎 $50 bounty • Algora

Steps to solve:

  1. Start working: Comment /attempt #78 with your implementation plan
  2. Submit work: Create a pull request including /claim #78 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

❗ Important guidelines:

  • To claim a bounty, you need to provide a short demo video of your changes in your pull request
  • If anything is unclear, ask for clarification before starting as this will help avoid potential rework
  • For assistance or questions, join our Discord

Thank you for contributing to algora-io/tv!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @aybanda Sep 5, 2024, 6:04:09 AM WIP
🟢 @destinedcodes Sep 12, 2024, 4:36:40 PM WIP
🟢 @vishwamartur Nov 17, 2024, 5:19:09 PM WIP
🟢 @simangaKhumalo Jan 31, 2025, 8:36:00 AM WIP

algora-pbc[bot] avatar Sep 03 '24 16:09 algora-pbc[bot]

@zcesur /attempt #78 Here is my implementation plan 1.Set up environment 2.Implement livestream status check 3.Implement old machine destruction check 4.Create livestream control endpoints 5.Test livestream start 6.Set up Fly.io deployment 7.Implement deployment monitoring 8.Run full demo deployment 9.Error handling

Algora profile Completed bounties Tech Active attempts Options
@aybanda 1 bounty from 1 project
Cancel attempt

aybanda avatar Sep 05 '24 06:09 aybanda

/attempt #78

Options

qubzes avatar Sep 12 '24 16:09 qubzes

Just checking in, is this still needed?

raphaelbernhart avatar Oct 22 '24 18:10 raphaelbernhart

Yep, still open @raphaelbernhart

zcesur avatar Oct 23 '24 00:10 zcesur

/attempt #78

Options

vishwamartur avatar Nov 17 '24 17:11 vishwamartur

/attempt #78

Implementation Plan:

  1. Set Up Fly.io Deployment Pipeline:

    • Configure Fly.io for deploying new versions of the service.
    • Ensure the deployment process does not interrupt ongoing livestreams.
  2. Handle Livestreams Gracefully:

    • Use the end of stream callback to detect when a livestream ends.
    • Implement the Membrane Pipeline list pipelines function to check for active pipelines.
  3. Shut Down Old Machines:

    • After confirming all livestreams have ended, trigger the shutdown of old machines.
  4. Create a Demo Video:

    • Record a video showing:
      • Starting a livestream.
      • Triggering a deployment.
      • Confirming the livestream is running after deployment.
      • Stopping the livestream.
      • Confirming the old machine is destroyed automatically.
  5. Submit Pull Request:

    • Create a PR with the changes and include /claim #78 in the PR body.
    • Attach the demo video in the PR.

simangaKhumalo avatar Jan 31 '25 08:01 simangaKhumalo

Hi @zcesur I'd like to work on this and wanted to clarify the scope.

Is the expectation to implement the Fly.io graceful deployment process entirely through a GitHub Actions workflow? or is having a deploy.exs script sufficient for now?

miguelnietoa avatar Apr 23 '25 15:04 miguelnietoa

Hey @miguelnietoa thanks for jumping in!

This repo is on maintenance mode, but we'll need the same feature in the new app so how about we add it there? We'll open source it this week but I just gave you access if you wanna check it out!

And yeah having a deploy.exs script works

zcesur avatar Apr 23 '25 21:04 zcesur

Hi @zcesur - sure, I'll check it out there! Thanks for the invite.

miguelnietoa avatar Apr 23 '25 21:04 miguelnietoa

@zcesur Is this feature still needed or has it been implemented in the new app?

jayantpranjal0 avatar Jun 25 '25 20:06 jayantpranjal0

Still needed in https://github.com/algora-io/algora

zcesur avatar Jun 25 '25 21:06 zcesur