biff

chromalchemy 2024-09-01T19:41:39.210259Z

I just finished upgraded my Biff instance to latest commit šŸ˜Ž It was pretty painstaking to carefully go through the (6 month) series of code changes, (especially if you are unsure of the implications, and all characters are mysterious/precious). But on the flip side I appreciate the demand to get hands-on with the boilerplate, to demystify the framework via forced transparency, as a tradeoff to promote and encourage flexibility (modify/use/keep the parts you want!).

2024-09-01T20:15:10.411449Z

glad to hear the upgrade wasn't too painful šŸ™‚ the config/bb->clj changes earlier this year were pretty hefty too--going forward there hopefully shouldn't be big migrations like that. The only one on the radar is XTDB2, whenever that becomes stable.

chromalchemy 2024-09-01T19:42:41.544869Z

Can I upgrade HTMX to 2.0? Any other dependencies that should definitely be held back? (I think we covered before that ring-defaults could use latest version.. )

2024-09-01T20:19:47.958829Z

htmx 2 should be fine. I see there's a migration guide here: https://htmx.org/migration-guide-htmx-1/ looks like the main thing is if you have any :hx-on or :hx-ws keywords in your code, you'll need to make some slight changes. Other than that... info.sunng/ring-jetty9-adapter has breaking changes in its websocket interface if you upgrade it; see https://github.com/jacobobryant/biff/issues/217. So if you're using websockets I'd probably leave that as-is. I'm not aware of any other deps with breaking changes, so everything else might be safe to upgrade. In general I'd always check the release notes for each dependency first though.

chromalchemy 2024-09-01T23:09:14.430609Z

Cool. I’ll update HTMX, but probably not the other deps for now. Will report back if any issues.

šŸ™ŒšŸ¼ 1
jf 2024-09-02T02:24:14.322789Z

šŸ™‚ please report back if you dont encounter any issues too!

šŸ‘ 1
chromalchemy 2024-09-01T20:02:15.648169Z

I have a reload issue: I have a page that requires a component from another namespace. In the component namespace, if I update the css style definition, the local dev web view does not reload; until i go back to the page namespace, modify the file, and save it (for watcher fn to trigger). Can I add https://github.com/tonsky/clj-reload (or something like that) to reload pipleline, so that upstream changes trigger a view refresh?

chromalchemy 2024-09-01T20:05:32.355179Z

I do use a different hiccup compiler than rum (Ornament). But I basically follow the same patter from biffweb library.

chromalchemy 2024-09-01T20:10:42.527399Z

I think I’ve tried adding :reload-all in the page ns, in the past. But it felt like it added unacceptable latency to be constant re-evaluating everything.. ? But that doesnt even necessarily solve triggering the reload from the upstream ns right?

2024-09-01T20:22:40.837459Z

this should work out-of-the-box--let me test it out myself just to verify. clj-reload is basically just an alternative to clojure.tools.namespace.reload which Biff already uses and should work fine.

2024-09-01T20:30:20.589229Z

yeah, seems to work for me. I made a my-new-component function in the ui.clj file and used it in home.clj. When I change the text from "foo" to "bar" and save ui.clj, both files get evaled and the web page reloads. even saving the file without making any changes triggers a reload. so would be good to figure out where things are going wrong. e.g. first step is the file watcher--if you save the file with the component, do you see any new output in the terminal at all? Is this file under src like the rest of your code?

chromalchemy 2024-09-01T23:10:25.399899Z

Thanks for testing. I’ll create the same test in my repo for comparison. Might be something with my css build. You tested a text change, right? Would this be any different than a pure css change?

2024-09-01T23:12:08.656669Z

oh, you meant you updated the css file, not the clj file? that might be different

chromalchemy 2024-09-01T23:23:07.091019Z

My clj file declares the css, then it is generated to .css files in generate-assets fn. https://github.com/chromalchemy/groundedsol/blob/32fa1359c415650ca9bf643a053e60c9ae1482db/src/gs/groundedsol.clj#L39C1-L43C45 So I guess the question is, if a hiccup fn is not being updated, but a style definition is, will it trigger reload. The defstyled defnition is a macro. So maybe code is not seeing linkages correctly?

2024-09-02T02:44:16.477169Z

if any file under src or resources is being saved, the on-save function should get called. shouldn't matter what's in the file beyond that. is that happening? There are several steps that could be broken, so just wanting to verify if this first step is the one having issues

chromalchemy 2024-09-01T23:12:27.819629Z

I’m am trying to deploy with update repo. clj -M:dev deploy seems to be getting stuck on Rebuilding... message. Server logs are just showing normal requests. Where should I look into this?

chromalchemy 2024-09-02T14:12:36.503759Z

I actually did complete the deploy, after I left my computer. Tried again, and it seems to have succeeded again. But it takes almost 2 hours! Heres the message

Identity added: /Users/ryan/.ssh/id_rsa (ryan@Ryans-MacBook-Pro-2.local)
Started an ssh-agent session. If you set up `keychain`, you won't have to enter your password each time you run this command: 
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: 

Rebuilding...

Done in 6370159ms.
building file list ... done
dev/tasks.clj
resources/public/css/main.css

sent 69031 bytes  received 628 bytes  27863.60 bytes/sec
total size is 352589158  speedup is 5061.65

chromalchemy 2024-09-02T15:08:06.012499Z

I took about 70mb of unused images out of public and am trying again. I do have rysnc

chromalchemy 2024-09-02T15:08:46.122459Z

All I see in server logs is a bunch of request chatter, then eventual restart, like this:

Sep 02 07:58:32 groundedsol systemd[1]: Stopping app...
Sep 02 07:58:33 groundedsol systemd[1]: app.service: Deactivated successfully.
Sep 02 07:58:33 groundedsol systemd[1]: Stopped app.
Sep 02 07:58:33 groundedsol systemd[1]: app.service: Consumed 2min 39.524s CPU time.
Sep 02 07:58:33 groundedsol systemd[1]: Started app.
Sep 02 07:59:14 groundedsol sh[2683796]: WARNING: abs already refers to: #'clojure.core/abs in namespace: garden.color, being replaced by: #'garden.color/abs
Sep 02 07:59:45 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_aero_config@769d3543
Sep 02 07:59:45 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_xtdb@29322d53
Sep 02 07:59:53 groundedsol sh[2683796]: [main] INFO xtdb.tx - Started tx-ingester
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO com.biffweb.impl.xtdb - Indexed #:xtdb.api{:tx-time #inst "2023-09-20T17:17:02.794-00:00", :tx-id 0}
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_queues@30e7d21b
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_xtdb_tx_listener@7e4c1242
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_htmx_refresh@1a41c4e9
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_jetty@705bf0
Sep 02 07:59:55 groundedsol sh[2683796]: [main] INFO org.eclipse.jetty.server.Server - jetty-10.0.7; built: 2021-10-06T19:34:02.766Z; git: da8a4553af9dd84080931fa0f8c678cd2d60f3d9; jvm 11.0.24+8-post-Ubuntu-1ubuntu322.04
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@2972298{/,null,AVAILABLE}
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@4b57aa53{HTTP/1.1, (http/1.1)}{localhost:8080}
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO org.eclipse.jetty.server.Server - Started Server@7c7c3bcb{STARTING}[10.0.7,sto=0] @83076ms
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO com.biffweb.impl.misc - Jetty running on 
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_chime@8a4eff3
Sep 02 07:59:56 groundedsol sh[2683796]: [main] INFO gs.groundedsol - starting: com.biffweb$use_beholder@51f07bf0
Sep 02 07:59:59 groundedsol sh[2683796]: Wrote Compiled CSS to main.css
Sep 02 07:59:59 groundedsol sh[2683796]: [main] INFO gs.groundedsol - System started.
Sep 02 07:59:59 groundedsol sh[2683796]: [main] INFO gs.groundedsol - Go to 
Sep 02 07:59:59 groundedsol sh[2683796]: [qtp1467484716-20] INFO com.biffweb.impl.middleware - 442ms 200 get  /
Sep 02 08:00:10 groundedsol sh[2683796]: nREPL server started on port 7888 on host localhost - 

chromalchemy 2024-09-02T15:11:40.111999Z

I wonder if something is getting hung up thinking it’s a docker build? Im just trying to do the orginal deploy. And maybe i still have to update the server with new server setup script? Or blow it away and re-deploy fresh like you said.

2024-09-02T21:51:51.495319Z

>

Rebuilding...
> 
> Done in 6370159ms.
wow, 10 minutes to build CSS. (That message is from tailwind). Definitely want to figure that out, and then we can see if anything else is slow. Try running this command and see how long it takes?
time bin/tailwindcss -c resources/tailwind.config.js -i resources/tailwind.css -o target/resources/public/css/main.css
Also maybe try restarting your local machine right before running it 🤷 I know on WSL I sometimes had weird problems where it would get super slow after being on for a while, though I wouldn't expect to see that outside of WSL...

2024-09-02T21:52:40.508209Z

So far the server part looks fine, so I wouldn't worry about that just yet.

chromalchemy 2024-09-03T14:11:25.324399Z

You are right. Its definitely the tailwind build. With the above command, keeps getting stuck on ā€œRebuildingā€¦ā€ Tried running clean and install-tailwind tasks.

chromalchemy 2024-09-03T14:46:07.145489Z

Tailwind was choking on trying to evaluate my resources folder. When I disabled Tailwind from checking that folder in tailwind.config , the css task succeeds in normal time. Thus deploy tasks are working now! šŸ™Œ Thank you for your insight to narrow it down. My resources folder does contain a generated .css file in public/css/ , written by my custom generate-assets! fn). Maybe that’s the trip-up? (tailwind trying to eval a file with lots of custom class names). Not sure. But since I’m not using Tailwind right now anyway, I’m fine with it just not stalling. Is there a way to formally disable or substitute tailwind build? Mayb without re-creating the task stack?

2024-09-03T16:30:13.603759Z

Nice, glad you've got it working! You can override the css task to disable the tailwind build:

diff --git a/starter/dev/tasks.clj b/starter/dev/tasks.clj
index 1f4f7f2..ab86623 100644
--- a/starter/dev/tasks.clj
+++ b/starter/dev/tasks.clj
@@ -6,9 +6,12 @@
   []
   (println "Hello"))
 
+(defn no-op [& args])
+
 ;; Tasks should be vars (#'hello instead of hello) so that `clj -M:dev help` can
 ;; print their docstrings.
 (def custom-tasks
-  {"hello" #'hello})
+  {"hello" #'hello
+   "css" #'no-op})
 
 (def tasks (merge tasks/tasks custom-tasks))
(Search for run-task "css" in https://github.com/jacobobryant/biff/blob/master/libs/tasks/src/com/biffweb/tasks.clj to see where that task is called). Also, if you want you can also have generate-assets! write the .css file to target/resources/public/css instead of resources/public/css , either way works.

chromalchemy 2024-09-03T23:42:26.173759Z

Will demo this no-op option. I will need to integrate my css-build fn into the tasks anyway, because while I found the new reload being more reliable, pure css changes still require a manual reload (probably because a race condition with current setup)

chromalchemy 2024-09-01T23:15:46.789629Z

Here is repo for reference https://github.com/chromalchemy/groundedsol

chromalchemy 2024-09-01T23:17:43.809009Z

Digital ocean web console says there’s 1 zombie process. Not sure if that’s related.

chromalchemy 2024-09-01T23:30:35.019469Z

At any point in the upgrade process would I have had to re-generate config, or run any of these tasks (to ā€œrebootā€ state)?

{"clean" #'com.biffweb.tasks/clean,
 "css" #'com.biffweb.tasks/css,
 "deploy" #'com.biffweb.tasks/deploy,
 "dev" #'com.biffweb.tasks/dev,
 "generate-config" #'com.biffweb.tasks/generate-config,
 "generate-secrets" #'com.biffweb.tasks/generate-secrets,
 "hello" #'tasks/hello,
 "install-tailwind" #'com.biffweb.tasks/install-tailwind,
 "logs" #'com.biffweb.tasks/logs,
 "nrepl" #'com.biffweb.tasks/nrepl,
 "prod-dev" #'com.biffweb.tasks/prod-dev,
 "prod-repl" #'com.biffweb.tasks/prod-repl,
 "restart" #'com.biffweb.tasks/restart,
 "soft-deploy" #'com.biffweb.tasks/soft-deploy,
 "uberjar" #'com.biffweb.tasks/uberjar}

chromalchemy 2024-09-01T23:42:10.663239Z

I tried to run deploy task from the repl. (after starting clj -M:dev dev and using nrepl port.) (ps. I cant seem to jack into repl with :dev alias directly. Says ā€œJack in interruptedā€) only got this message:

Started an ssh-agent session. If you set up `keychain`, you won't have to enter your password each time you run this command: 
Terminal just says ā€œrebuilding..ā€ , like when i tried clj -M:dev deploy`` from terminal.

chromalchemy 2024-09-02T00:55:46.605039Z

Would I would need to run the server set up script again? Since that was updated..

chromalchemy 2024-09-02T00:56:09.314809Z

Or reboot the server or anything like that?

2024-09-02T02:53:51.986909Z

hm, not immediately obvious to me what's going wrong. if all else fails and you don't mind some down time you could just provision a new server. but happy to try to figure out what's going on. what's the full output you're getting for the deploy command?