biff

A web framework + self-hosted deployment solution for Clojure. Repo: https://github.com/jacobobryant/biff. Docs: https://biff.findka.com
2020-06-09T17:24:18.013500Z

@foo I am trying to follow the instructions to deploy the example app and need some help. I quite a bit out of my depth with this remote server/host linux stuff. I set up a Digital Ocean droplet and SSH access. I ran the install.sh script. It failed for me during the cert-bot part. But I went back and executed that part again and the remaining steps manually. I have a domain http://tmem.xyz connected to my droplet (with the default DNS records). I entered "<http://tmem.xyz|tmem.xyz>" string under HOST var in the example/task file, and under :hello.biff/host in example/config.edn. Everything else is the stock example. I ran release-cljs task on my local copy to generate the js. I pushed my copy of the Example project to https://github.com/ryolyo/example, and edited the biff/prod/deps.edn with the url and sha. Then systemctl restart biff.... and in the logs I get this:

Jun 09 07:21:30 hostvm task[1398]: 07:21:30.446 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
Jun 09 07:21:32 hostvm task[1398]: Starting :biff.core/toggle-nrepl :biff/init :hello/core :biff/console :biff/web-server
Jun 09 07:21:32 hostvm task[1398]: Execution error (AssertionError) at biff.system/set-defaults (system.clj:51).
Jun 09 07:21:32 hostvm task[1398]: Assert failed: (some? host)
Jun 09 07:21:32 hostvm task[1398]: Full report at:
Jun 09 07:21:32 hostvm task[1398]: /tmp/clojure-6700403488939952957.edn
Jun 09 07:21:32 hostvm systemd[1]: biff.service: Main process exited, code=exited, status=1/FAILURE
Jun 09 07:21:32 hostvm systemd[1]: biff.service: Failed with result 'exit-code'.
Jun 09 08:01:51 hostvm systemd[1]: Started Biff.
Jun 09 08:02:01 hostvm task[1522]: Checking out: <https://github.com/ryolyo/example> at 70368c2ea34ea0aa313885fe0b7e46cc1aa0d739
Jun 09 08:02:35 hostvm task[1522]: 08:02:35.517 [main] INFO  crux.hash.jnr - unknown
Jun 09 08:02:35 hostvm task[1522]: 08:02:35.526 [main] INFO  crux.hash - Using libgcrypt for ID hashing.
Jun 09 08:02:55 hostvm task[1522]: 08:02:55.363 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
Jun 09 08:02:57 hostvm task[1522]: Starting :biff.core/toggle-nrepl :biff/init :hello/core :biff/console :biff/web-server
Jun 09 08:02:57 hostvm task[1522]: Execution error (AssertionError) at biff.system/set-defaults (system.clj:51).
Jun 09 08:02:57 hostvm task[1522]: Assert failed: (some? host)
Jun 09 08:02:57 hostvm task[1522]: Full report at:
Jun 09 08:02:57 hostvm task[1522]: /tmp/clojure-613805300719854948.edn
Jun 09 08:02:57 hostvm systemd[1]: biff.service: Main process exited, code=exited, status=1/FAILURE
Jun 09 08:02:57 hostvm systemd[1]: biff.service: Failed with result 'exit-code'.
Connection reset by 157.245.95.215 port 22
Not sure what to do next. I did not understand this part in https://findka.com/biff/#deployment > Update `/root/biff/prod/config.edn` if needed (e.g. `scp config.edn <mailto:root@example.com|root@example.com>:biff/prod/`) There is no config.edn in /root/biff/prod that I can see. In the example task, there is
deploy () {
  scp config.edn biff@$HOST:biff/template/
  # ...
}

"$@"
I tried this, but am unclear on the pattern, and the results.
root@hostvm:~# scp config.edn <mailto:root@tmem.xyz|root@tmem.xyz>:biff/prod/
The authenticity of host '<http://tmem.xyz|tmem.xyz> (157.245.95.215)' can't be established.
ECDSA key fingerprint is SHA256:JLPfbVbrBRRvoO5BfM2K+fLDNYbS345yfedzknb7sfM.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '<http://tmem.xyz|tmem.xyz>,157.245.95.215' (ECDSA) to the list of known hosts.
<mailto:root@tmem.xyz|root@tmem.xyz>: Permission denied (publickey).
lost connection
Any hints? Thanks!

2020-06-09T17:41:00.014700Z

here are my DNS records in Digital Ocean CP

2020-06-09T17:50:26.014900Z

2020-06-09T19:52:56.030200Z

Hey @chromalchemy! Your DNS records look good. Were those set up before you ran install.sh? Do you remember what the error message from certbot was? (I'm guessing it failed while it was trying to verify that you control http://tmem.xyz?) Did certbot work the second time when you ran it manually (or did you skip that command)? To clarify about config.edn - the contents look correct in your repo. The issue is you have to copy it to /root/biff/prod/config.edn on the DO droplet. The scp config.edn <mailto:root@tmem.xyz|root@tmem.xyz>:biff/prod/ command should do that. However, it looks like you're running the command while already logged into your DO droplet. You'll need to run the command from your local machine, in the same directory as the example project. Alternatively, you could just edit /root/biff/prod/config.edn while logged into the DO droplet and paste in the contents of config.edn. This will fix the error you got after running systemctl restart biff. The Assert failed: (some? host) error happens because it can't find the :hello.biff/host key in config.edn. By the way, for deploying the example app, you'll probably want to add :hello.biff.crux/topology :standalone to config.edn:

{:prod {:hello.biff.crux/topology :standalone
        ...}
 ...}
By default in prod, Biff will try to use an SQL database to back crux. It's not too hard to set up managed postgres on DO, but it is an extra step and it'll cost $15/month--probably not what you want right now. Setting :standalone will make Biff use the filesystem for persistence like it does during development. Let me know how that goes! I'll update Biff/the documentation to make some of this more clear. I've been making a lot of updates starting yesterday in preparation for officially releasing it probably this week.

2020-06-09T20:01:13.036200Z

I believe the certbot worked the 2nd time, but i dont understand all the messaging

2020-06-09T20:01:37.036800Z

Oh, one more thing: I accidentally put a bug in example/task. You should set APP_NS to hello.biff instead of hello. As it is, the cljs output has been copied to the wrong directory (`resources/www/hello/cljs/app/` instead of resources/www/hello.biff/cljs/app/). I fixed that in the Biff repo yesterday (I made it so you just use hello instead of hello.biff, both in the task file and when calling start-biff), but I wouldn't recommend pulling from the Biff repo just yet as it's still in a state of flux for a day or two.

2020-06-09T20:02:12.037300Z

Yes, i set up domain in DP cp before install

2020-06-09T20:06:30.037900Z

k. well maybe the failure on the first time was just a fluke.

2020-06-09T20:08:04.038900Z

I think the certbot failure occured when i endered an illegal char in name

2020-06-09T20:09:44.040100Z

Ok i will try these corrections later and report back. Thanks for the quick response, and all your work!

2020-06-09T20:11:32.040900Z

ah that'd make sense. Sounds good, and you're welcome! hope it works this time 🙂