Crafting happiness with Free Software & Hardware

Your Next Meal: a Guile Web App

YNM Logo

I started developing a web application in Guile. The goal of this application is to help me choose the content of my meals according to my tastes, my lifestyle and my nutritional balance! If I consume better, my health and the planet can only benefit.

In this article, I share with you my current workflow!

Best wishes to all of you!

Development

I open my terminal. Using an alias, the command cdynm places me in the directory of my application.

Since I created the package definition for my application (in a file I named guix.scm), I can generate a shell prepared for its own development with the command :

$ guix environment -l guix.scm

Now I can start the app with the command :

[dev]$ art work
Loading conf/artanis.conf...done.
Session with SIMPLE backend init done!
Loading models...
Loading controllers...
Loading restful API...
Regenerating route cache ...
Server core: ragnarok
http://127.0.0.1:3000
Anytime you want to quit just try Ctrl+C, thanks!

Then it's time for the hack!

Not having yet found a way to do REPL Driven Development, I got into the habit of restarting the server manually at each modification. The restart is fast for the moment but it could become annoying.

When I am satisfied with my changes, I push them to the git repository.

Deployment

I am the admin of a Digital Ocean droplet powering a Guix System. I connect to it with ssh thanks to a small alias sshynm. Then I connect to the active Screen session in which my application runs:

screen -r

From there, I stop the application, pull the last changes in the source code of the application and restart it:

# killall .art-real && git pull && guix environment -l guix.scm -- art work &

Finally, I detach myself from the Screen session with C-a-d or C-a C-d and the droplet with C-d.

The end!

My wish list

Guile-Hall support

Until the next release of Guile-Hall, it is not possible to manage an application created with Artanis because some file types are not supported by Guile-Hall.

Guix full support

Today, Artanis is based on Guile-2.2 as well as on libraries whose versions are in conflict with the Guix distribution (guile-json for example). For my use, the workaround via a development environment is enough but it might not last!

Link to the project repository : https://framagit.org/Jeko/ynm
Link to the project website: https://yournextmeal.tech

Thank you very much for reading this article!

Don't hesitate to give me your opinion, suggest an idea for improvement, or ask a question! To do so, leave a comment below or contact me.

And more importantly, share this blog and tell your friends it's the best blog in the history of Free Software! No kidding!

#guix #gnu #linux #guile #english