This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-11
Channels
- # adventofcode (52)
- # announcements (3)
- # aws (2)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (69)
- # biff (45)
- # calva (9)
- # cider (3)
- # clara (8)
- # clj-kondo (24)
- # clojure (20)
- # clojure-dev (12)
- # clojure-europe (12)
- # clojurescript (2)
- # conjure (1)
- # emacs (17)
- # lsp (69)
- # malli (12)
- # off-topic (32)
- # polylith (2)
- # re-frame (4)
- # releases (2)
- # scittle (6)
- # shadow-cljs (21)
- # tools-deps (10)
- # vim (11)
- # xtdb (11)
just skimmed this, and it sounds like this might be handy for developing-in-prod with biff? if i understood it correctly it sounds like you could just install a cli utility on the server and you're good to go, no need for rsync-on-save. I assume VS code handles stuff so there's no lag when editing files like there would be over eg plain ssh https://code.visualstudio.com/blogs/2022/12/07/remote-even-better
if so, this would make biff fully supported on plain windows (as long as you use VS code) since develop-in-prod is the only thing that doesn't work there
if so, this would make biff fully supported on plain windows (as long as you use VS code) since develop-in-prod is the only thing that doesn't work there
👋
I wanted to continue with the tutorial today, https://biffweb.com/docs/tutorial/deploy/, bb logs
gives me
Dec 11 14:37:16 ubuntu-s-1vcpu-1gb-fra1-01 sh[1074]: Type: java.lang.Exception
Dec 11 14:37:16 ubuntu-s-1vcpu-1gb-fra1-01 sh[1074]: Message: File does not exist: run-cmd
Dec 11 14:37:16 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: app.service: Main process exited, code=exited, status=1/FAILURE
Dec 11 14:37:16 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: app.service: Failed with result 'exit-code'.
Dec 11 14:37:21 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: app.service: Scheduled restart job, restart counter is at 6.
Dec 11 14:37:21 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: Stopped app.
Dec 11 14:37:21 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: app.service: Start request repeated too quickly.
Dec 11 14:37:21 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: app.service: Failed with result 'exit-code'.
Dec 11 14:37:21 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: Failed to start app.
Did anyone else run into this?I think I ran into this bug and fixed it. what version of biff was your project created with?
(I've been thinking of trying out Fly with Biff instead of digitalocean, and it occurs to me that this would be another advantage of doing so: it'd be easy for me to push out upgrades to the production environment/setup along regular biff releases)
{:paths ["src" "resources" "target/resources"]
:deps {com.biffweb/biff {:git/url "" :sha "6353c406adef0344484b49a5ef2282eab77c2347"}
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}
org.slf4j/slf4j-simple {:mvn/version "2.0.0-alpha5"}}}
the relevant line is here: https://github.com/jacobobryant/biff/blob/9c11643516e8526a75c761f77139014241d5f114/example/setup.sh#L63
bb run-cmd
is supposed to return a shell command that starts with clj ...
. the command should be defined in the /home/app/bb.edn file on the server, here: https://github.com/jacobobryant/biff/blob/9c11643516e8526a75c761f77139014241d5f114/example/bb.edn#L15
that error message makes it looks if the run-cmd isn't actually defined in the bb.edn file, and thus bb tries to look for a run-cmd
file (which doesn't exist, as expected)
https://github.com/jacobobryant/biff/commit/6353c406adef0344484b49a5ef2282eab77c2347
And funny you mention fly: When I started the deploy chapter I thought about trying it out on fly or asking here if anyone tried it
But I only ever ssh'd into fly apps with fly ssh <appname>
and concluded it wouldn't work as is
But especially fly machines ability to scale to zero would make it very attractive for tutorials/costs
hm, well that commit has all the up-to-date code around deployment. so it's possible that there's still a bug in there.
could you ssh into the server (`ssh app@...`) and paste output of cat bb.edn
? and try running bb run-cmd
as well
yeah, it'll need a bit of work to get it working on fly--mainly need to convert (parts of) the setup.sh script into a dockerfile.
Okay strange, when I ssh
into app@...
I don't have a bb.edn
config.edn
, repo.git
and target
, nothing else
I'm off now making dinner and won't be at the computer again today, so no hurry at all from my side.
Thanks again!
have you ran bb deploy
? that would explain the files not being there. though I'm surprised config.edn is there if you haven't ran bb deploy
yet. maybe the deploy command failed partway through
I'll try going through that part of the tutorial again myself
yes I did
do you remember if there was any error output?
I didn't see anything
Looks okay:
Rebuilding...
Done in 138ms.
Everything up-to-date
"Elapsed time: 497.944958 msecs"
that looks like there wasn't a new commit to push so it skipped the deploy
Ah yeah true
strange
maybe add a blank line to bb.edn and commit, then deploy? no need to do it right now though :)
again:
Rebuilding...
Done in 138ms.
Everything up-to-date
"Elapsed time: 498.238792 msecs"
I guess something went wrong with the setup.sh script, then?
But yeah: Off for now, thanks again 😄
well that's just weird I'll give you some more things to try later, unless I find the problem on my own!
I haven't tested the deploy process again yet, however the tutorial app was written with a version of biff two commits behind the one you're on, and there's nothing in those two commits that would affect deploys. (And I did deploy the tutorial app successfully when I was working on it.)
That Everything up-to-date
message is really fishy. The bb deploy
command is just doing a plain git push basically. If you've made a new commit, then... it really should be pushing something ha ha. Perhaps triple-check that you made a new commit? What's the output of git log
?
If that's all in order, next thing I'd check is the :tasks
section of config.edn
, specifically the values of :biff.tasks/deploy-from
, :biff.tasks/deploy-to
, and :biff.tasks/server
. and also output of git remote -v
-- make sure everything matches up.
In any case you should be able to make a new commit, type git push prod master
, and have it actually do something.
Alternatively, you can just go ahead with the rest of the tutorial (you can do it all locally, no need to have anything in production), and I'm planning to work on Fly stuff next anyway 🙂
👍 Thanks again, I'm gonna check again this evening (European time) and let you know. I guess I made a mistake somewhere, but if I can't find anything I just go ahead without the prod deployment
Yes, I'm on mac
Output of which systemctl
in the droplet:
/usr/bin/systemctl
hm. and cat /etc/sudoers.d/restart-app
shows the same as what I pasted above? If you do ssh app@<server>
and then sudo systemctl restart app
does that work?
If it does work, then I wonder if the sudoers file just wasn't taking effect until after a reboot or something. I thought I observed that not being the case, but I might be mistaken.
Looks like it:
app ALL= NOPASSWD: /bin/systemctl reset-failed app.service
app ALL= NOPASSWD: /bin/systemctl restart app
app ALL= NOPASSWD: /usr/bin/systemctl reset-failed app.service
app ALL= NOPASSWD: /usr/bin/systemctl restart app
sudo systemctl restart app
doesn't seem to work and now I receive 502 nginx Bad Gateways error 😄
Doesn't matter, I continue with the tutorial as it is
hm! well it seems the sudoers file isn't taking effect for some reason. Not sure why that would be happening.
So, this should be fixed now... it was failing because I typed resart
instead of restart
in the bb task :face_palm:
https://github.com/jacobobryant/biff/pull/144
See for the commit to upgrade to https://github.com/jacobobryant/biff/pull/144#issuecomment-1364618075