Conversation
| # as both mampf-experimental and mampf-next also run in production mode. | ||
| production_name = ENV.fetch("PRODUCTION_NAME", nil) | ||
| return unless production_name == "mampf" | ||
| return if production_name != "mampf" && production_name != "mampf-vignettes" |
There was a problem hiding this comment.
For vignettes, the user cleaner should be disabled. Otherwise, study data may be destroyed as a result.
There was a problem hiding this comment.
But the line I wrote above does exactly that, right? Since production_name == "mampf-vignettes" for the Vignettes, so we early-return in that case. Same for mampf-next and mampf-experimental.
There was a problem hiding this comment.
Note the unless keyword.
There was a problem hiding this comment.
But the unless is gone. If production_name == "mampf-vignettes" the second condition is violated, so the code continues.
There was a problem hiding this comment.
Oh fail, my bad, you're absolutely right. I will just revert this change I guess.
fosterfarrell9
left a comment
There was a problem hiding this comment.
LGTM, only minor remarks. Of course, the big test will be when we deploy this when production_name is just mampf, not mampf-vignettes.
It appears that the time users spend on Vignettes slide was not correctly transmitted to the backend after the first slide. This PR fixes this and adds a new Playwright test for the Vignette Export. - Note that some tests report statistic results off by 1 second, even though we use the precise Playwright clock. For one issue, I was able to trace this back to an implementation bug. I've noted it, but we probably don't want to fix it now to avoid skewing the data. Another off-by-1-second test error is unexplainable to me. But let's not waste more energy into this, I think a variance of 1s is quite fine here. - We couldn't get the test to run correctly in CI, so we disable it for now. Locally it runs through fine. This is probably due to the option `PLAYWRIGHT_HTML_OPEN=never` we use for `npx playwright test` in the CI. We will get back to this later, but right now Müsli has priority. ## Off-topic - Decreases playwright test timeout to 45s (was 90s beforehand) --------- Co-authored-by: Splines <info@splines.me> Co-authored-by: Splines <37160523+Splines@users.noreply.github.com>
Don't worry, we weren't much behind in terms of version numbers, but Pagy made a leap: > We needed a leap version to unequivocally signaling that it's not just a major version: it's a complete redesign of the legacy code at all levels, usage and API included. > Why 43? Because it's exactly one step beyond "The answer to the ultimate question of life, the Universe, and everything." Not necessarily modest, but it still seems promising. And as I'd like to use infinite scroll for the new dashboard lecture browsing, it's better to upgrade now than later. I've essentially followed the [upgrade guide](https://ddnexus.github.io/pagy/guides/upgrade-guide/). There were some major redesigns in the API, especially the fact that you don't use `Pagy.new(...)` anymore, but instead use `include Pagy::Method` in the `ApplicationController`, and then just call `pagy()` wherever you need it. Also see [this section](https://ddnexus.github.io/pagy/toolbox/paginators/#the-pagy-method).
This PR sets up Kamal such that we can deploy MaMpf for Vignettes on https://vignettes.mampf.media/. As reviewers, please read about the basics of Kamal such that terminology is clear here.
I rewrote the production Dockerfile (see
Dockerfile-vignettes) and set up adeploy.ymlfile. It contains all the steps to deploy the Vignettes-MaMpf. This way, it should take like only a few hours to setup a completely new MaMpf server in the future (but with limitations right now, see below).Deploying
In Kamal, I've configured MaMpf as the main web app. This will experience zero-downtime deploys using kamal proxies. Separately managed are so-called accessories like the database. They are separate Docker containers with their own lifecycle and not affected by
kamal deploy. Instead they are managed bykamal accessory.In the latest version of this PR, I've set
local: falsein thebuildersection ofdeploy.ymland configured our server to also build the image. This way, you don't have to do this on your local machine (which consumes much CPU/RAM). If you still want to, just comment outlocal: false. It will then build locally (but only if your local architecture matches amd64).Note that Kamal only takes into account any changes that you've committed. Your commit doesn't have to be published with git push, but at least you must have a local commit. You can later still amend your commit to create a new one without having to spam 1000 Git commits when you try things out. Important: this commit restrictions appears to not apply to the Kamal accessories, there it also works without committing first. So watch out a bit.
To be able to deploy, you need to generate an SSH key for the kamal user. Then, use the following ssh config (
mampf.mediapoints to the same server asvignettes.mampf.media)You also need the
.envfile with all the secrets. Ask for it on Basecamp.Limitations / Future ideas
X-Accel-Redirect. See also this discussion without any answers.config.public_file_server.enabledinproduction.rb. This is something for future PRs. It still feels blazing fast from first experiments..envfile at the moment. Security-wise, this is not the best idea. But a password manager integration is only nice to have, not essential, so let's set this up in a future PR. Note that due to us using the.envfile, all kamal command should be preprended bybundle exec dotenv,e .g.bundle exec dotenv kamal deployinstead ofkamal deploy. Otherwise you will get missing key errors.New dependencies
dotenvandkamalOff-topic
⚠ To be done for this PR
.envfile