Open jurgen1c opened 1 year ago
Hey @jurgen1c, thanks for giving Kuby a try! There's a lot here, so let me try to respond to each of your questions in turn.
sidekiq (using plugin, unclear if there is a way to get the plugin to use managed db since seems to always spin up a redis instance)
The kuby-sidekiq plugin currently doesn't support using a managed Redis instance, but certainly could. I would welcome a PR, or you could file a separate issue on that repo and I would be happy to look into it.
had to add this bundle binstubs bundler --force to docker file to get it to work
Hmm that's weird. What specifically wasn't working, and what error message did you get? What version of bundler were you using?
i see there is a task to migrate but couldn't get it to work. Only fix to run migrations on remote db from local and then deploy
Migrations are run automatically on every deploy. In the past I considered requiring devs to run migrations manually, and maybe that's the right thing to do - after all, migrations can be tricky and/or dangerous. At the very least I think you should be able to disable automatic migrations in your Kuby config. I've filed an issue to that effect.
You can run individual rake tasks using the Kuby CLI, for example:
bundle exec kuby -e production remote exec -- bin/rails db:migrate
In a CD pipeline what is the right way to deal with deploys that might need migrations?
That's a tricky question because as I mentioned earlier, migrations can be tricky and/or dangerous. For example, if a migration fails before it finishes, it could leave your database in a broken state. Depending on the size of your team and your application's tolerance to downtime, there are a few options. If it's ok for the app to be down once and a while and/or you have a small team, then automatic migrations are probably fine. If you have a larger team and/or the app must be as available as possible, then you might consider performing online schema changes or migrating in several steps (eg. 1. deploy a code change that only reads from a new column if it exists, otherwise reads the old data, 2. add column, 3. remove old code, 4. drop old column). For the most part, migrations are something Kuby can't (and probably shouldn't) help with.
my app seems to not be getting css/js served is there a config change needed to point the js/stylesheet tags pointed at the right place?
No, assets should work out-of-the-box. I know Sprockets works because that's what I use in one of the websites I deploy with Kuby. Can you verify the assets pod is running in your Kubernetes cluster (bundle exec kuby -e production remote status
), and that you see assets being built when you run kuby build
?
Hi @camertron, thanks for response!
Your `bin/bundle` was not generated by Bundler, so this binstub cannot run
and suggested adding the force command.bluestreak-math-rails-assets-5bdd9d6b98-d69lf 1/1 Running 0 87s
bluestreak-math-rails-sidekiq-worker-default-7d6f76459-fhn22 0/1 CrashLoopBackOff 3 87s
bluestreak-math-rails-sidekiq-worker-default-7d6f76459-fsldq 0/1 CrashLoopBackOff 3 87s
bluestreak-math-rails-web-5db7496659-fvds6 1/1 Running 0 86s
rfr-bluestreak-math-rails-sidekiq-0 1/1 Running 0 86s
rfs-bluestreak-math-rails-sidekiq-7769fff4cc-kbcf9 1/1 Running 0 86s
Cradhloop from sidekiq is new, but i have seen it come up and be healthy. Possibly missing something in development env config, will try with staging. Do i need to define the asset host?
# config.action_controller.asset_host = 'http://assets.example.com'```
assets work fine on staging
When deploying the app deployment would fail with
Your `bin/bundle` was not generated by Bundler, so this binstub cannot run
and suggested adding the force command.
Very interesting, I've never seen that before. I wonder if it's happening with newer versions of bundler 🤔
Interesting, so what happened was the app got into an infinite loop trying to find the schema migrations table, since migrations had never been run on the db. Sorry no trace i have since run the migrations manually and all is working.
Ok no problem. The schema_migrations
table should have been created by db:create
automatically on the first deploy. Something must have gone wrong, probably here. If anyone else stumbles on this issue in the future, some log output would be great to see 😄
I do see assets copied over and image built
Yeah, the assets pod appears to be running successfully and should be serving assets. Are you able to request any single asset from your app, i.e. https://my-app.com/assets/application.css? (double-check that URL, I can't remember the right path)
Do i need to define the asset host?
No, that shouldn't be necessary. The asset and web pods are available behind the same Kubernetes service object, i.e. they should be accessible via the same domain as the Rails app.
Happy to pair on debugging this if you've got the time and inclination 😄
Hi, not really an issue more general inquiry. Awesome gem! Really simplified the kubernetes deploy for me, how ever have run into a few things that I can't seem to overcome any guidance is appreciated. I am running kuby with kind first as a proof of concept before actually moving to staging and production. I am on a rails 6.1 app with sprockets( no webpack since its a legacy app, upgraded to rails 6,1 from 5.0 but kept sprockets to minimize the changes need. Planning on moving to esbuild in the near future), sidekiq (using plugin, unclear if there is a way to get the plugin to use managed db since seems to always spin up a redis instance), redis and postgesql Using managed dbs for both).
Got everything deployed and healthy, side note got a weird issue with bundler bin stubs had to add this
bundle binstubs bundler --force
to docker file to get it to work. now only got two hurdles left to call it working. First migrations, i see there is a task to migrate but couldn't get it to work. Only fix to run migrations on remote db from local and then deploy. In a CD pipeline what is the right way to deal with deploys that might need migrations? Second the assets, might be due to the use of sprockets but my app seems to not be getting css/js served is there a config change needed to point the js/stylesheet tags pointed at the right place?