@laurenshof @obenland @mattwiebe trust me, we do not help you to move to Ghost!
...even if I have to write a special check for the @fediversereport that hides the UI!
thanks @johnonolan !!!
@laurenshof @obenland @mattwiebe trust me, we do not help you to move to Ghost!
...even if I have to write a special check for the @fediversereport that hides the UI!
thanks @johnonolan !!!
Experimenting with just
I took some time this weekend to experiment with just
—a modern, make-inspired command runner. I’m interested in using it for managing the routine tasks of the Cifonauta database (a Django-based app), which are currently handled by Fabric.
Fabric is a Python library for running shell commands locally or remotely via SSH. I use it for interacting with the Cifonauta’s servers, like fetching the latest database from production or running the deployment routine after code updates.
Although Fabric works mostly fine, I’ve encountered a few command quirks over the years. I also often get confused when creating tasks because of all its lower level libraries (Invoke, Paramiko, Invocations, and Patchwork…). So, in the back of my mind, I’ve been roaming for a simpler alternative.
just
seems to have a nice set of features and appears to be gaining some momentum lately.
Justfile
‘s syntax is similar to that Makefile
‘s. It was straightforward to create some recipes for the standard manage.py
commands of Django, like runserver
or shell
. Here are a few of them:
# Cifonauta's justfile
# Set the default shell to bash
set shell := ["bash", "-cu"]
# List all available recipes
default:
@just --list
# Run Django development server
runserver:
@echo "Starting Django development server..."
python manage.py runserver
# Run Django shell
shell:
@echo "Starting Django shell..."
python manage.py shell
# Run Django database shell
dbshell:
@echo "Starting Django database shell..."
python manage.py dbshell
# Run Django makemigrations
makemigrations:
@echo "Making migrations..."
python manage.py makemigrations
# Run Django migrate
migrate:
@echo "Applying migrations..."
python manage.py migrate
# Run Django collectstatic
collectstatic:
@echo "Collecting static files..."
python manage.py collectstatic --noinput
# Run Django test
test:
@echo "Running tests..."
python manage.py test
I run the manage.py
commands every time I work on the Cifonauta code. They are simple enough, but running just runserver
or just migrate
is even simpler and feels semantically right. And the autocomplete is also snappier than the standard django_bash_completion
. I liked it.
A note: just
prints the command itself to the terminal by default. Adding the @
in front hides the command; only the output is shown when running the recipe.
The first issue I had was trying to activate Cifonauta’s Python virtual environment automatically for each of the recipes above. Based on intuition, I created a recipe to activate the environment and added it as a dependency to other recipes. However, this didn’t work out.
It turns out that each line in just
runs a new shell instance. After digging a bit, the solutions I found were complicating the code too much, so for now, I’m sticking with activating the environment myself beforehand—it’s quick enough (a one-key alias).
After this initial setup, I started migrating some fabfile
tasks of the Cifonauta workflow to justfile
recipes. One very nice feature I discovered is that you can run a just
recipe in any language using shebangs. Different from regular recipes, the variables will persist across lines like in a standard script.
Here’s a simple Bash recipe to dump the local database to a file for backup:
# Backup local database
backup-local-db:
#!/usr/bin/env bash
echo "Dumping local database to file... ({{dbname}})"
set -euo pipefail
mkdir -p {{local_bkp_dir}}
FILEPATH="{{local_bkp_dir}}/$(hostname)_{{dbname}}_$(date +%Y-%m-%d_%H%M).sql.gz"
pg_dump {{dbname}} | gzip -c9 > "$FILEPATH"
echo "Backup created: $FILEPATH"
And this one is a bit more complex as it runs a couple of commands remotely via SSH to get the latest production database.
# Fetch latest database from production
get-production-db:
#!/usr/bin/env bash
echo "Fetching latest database from production..."
set -euo pipefail
mkdir -p {{local_bkp_dir}}
LATEST_DBNAME=$(ssh {{user}}@{{prod_server}} "readlink -f {{prod_bkp_dir}}/latest.sql.gz")
FILENAME=$(basename "$LATEST_DBNAME")
scp {{user}}@{{prod_server}}:"$LATEST_DBNAME" {{local_bkp_dir}}/"$FILENAME"
echo "File copied: {{local_bkp_dir}}/$FILENAME"
There was only one idea left that I wanted to test: can I run some code from the Django app within a recipe? I made a test recipe to count the number of taxa in our database using the --command
parameter of manage.py shell
and it works!
# Test recipe for counting taxacount-taxa-test:@echo "Counting taxa..."@python manage.py shell --command "\from meta.models import Taxon;\taxa = Taxon.objects.all();\print(f'Total: {taxa.count()}')\"
While this type of query is probably better as a standard Django management in the long term, just
recipes can be a handy shortcut to quickly draft and test commands before they graduate to the codebase.
To summarize, just
feels promising. And it’ll most likely be easier to maintain than Fabric, since I can just create recipes in Bash or Python. But let’s see how it goes. I still need to migrate other, more complex tasks like the staging and production deployment routines, which will be some work.
[17:24] John Gilligan’s nephew awarded €4,000 after taking €60,000 personal injury claim
A nephew of John Gilligan who was seeking up to €60,000 in damages after tripping and falling on a pavement has been awarded just €4,000.
https://www.independent.ie/irish-news/courts/john-gilligans-nephew-awarded-4000-after-taking-60000-personal-injury-claim/a43633485.html
#JohnGilligan #upto€60,000 #just€4,000
#just : not transgressing the requirement of truth and propriety
- French: juste
- Italian: giusto
- Portuguese: justo
- Spanish: sólo
------------
Report an incorrect translation @ https://wordofthehour.org/r/translations
added #Just build support to #t2sde #t2linux today, to build and install more of #Cosmic desktop https://twitch.tv/videos/2313135408 - also updated #rustlang & #Cargo while at it #linux #opensource
so, your average post on #fediverse contains maybe 30% of unhashed words, the rest is #tags; what's wrong with that, you ask me?
#well, #i #dont #know, #youTellMe. #maybe #you'll #come #across #to #an #unprepared #reader #as #someone #eager to #grab #attention #at #any #cost? maybe #youAreOverdoingIt? #and #just maybe #what you #actually #achieve #is you #mislead #someone #who is #searching for #something #specific to your #own #unrelated #shout #because it is oh so #more #important?
“BREAKING: another FOUR Just Stop Oil supporters JAILED – cementing the UK’s authoritarian state”
by The Canary @TheCanadude
“The group join 21 other Just Stop Oil political prisoners, including the Whole Truth Five who were sentenced to 4-5 years in prison in June at Southwark Crown Court, in the longest ever sentences handed out for nonviolent climate action.”
https://www.thecanary.co/uk/analysis/2024/09/06/just-stop-oil-jailed/?__s=1toyfummtp6bhspv4akg
#Just #Waves And #Sand #Beach By Kaye Menner #Photography Quality #prints lovely #products at:
https://buff.ly/430G5ps
“Arizona leaders like McCain & Sen #MarkKelly have embodied the commitment to #CountryOverParty. And it’s that same high caliber of character & leadership I see in VP #Harris.
“That’s why I’m standing w/her. #KamalaHarris is the #competent, #just & #fair leader our country deserves. This year too much is at stake to vote #Republican at the top of the ticket.
Guarda il testo della canzone “Just” di Radiohead
#Radiohead #Just
https://daletra.online/radiohead/testi/just.html
小米手環 9 支援 Switch《Just Dance》 升級線性摩打 + 20 種震動模式
小米智慧生態近日表示將與 Switch 獨家合作,旗下小米手環 9 將支援 Switch 跳舞遊戲《Just […]
The post 小米手環 9 支援 Switch《Just Dance》 升級線性摩打 + 20 種震動模式 appeared first on 香港 unwire.hk 玩生活.樂科技.
#遊戲情報 #Just Dance #小米 #小米手環 9
https://unwire.hk/2024/07/22/just-dance/game-channel/?utm_source=rss&utm_medium=rss&utm_campaign=just-dance
https://www.cyclingeu.com/285169/from-tour-de-france-to-ultra-running-with-christian-meier-just-ride-s2e9/ From Tour de France to Ultra Running with Christian Meier | Just Ride S2E9 #Bicycling #Bike #Biking #BikingFrance #bull #christian #ChristianMeier #Cycling #eliot #EliotJackson #France #Jackson #just #JustRide #meier #mountain #MountainBike #MTB #PodCast #Podcast #Red #RedBull #RedBullPodcast #ride #RoadBike #RobWarner #running #tdf #tour #TourDeFrance #trail #TrailRunning #ultra #UltraRunner #UltraRunning #ultrarunning
#just glad to be on the team coach
#Just #Waves and #Sand by Kaye Menner #Canvas #Print / Canvas #Art by Kaye Menner - Kaye Menner - Website
https://fineartamerica.com/featured/just-waves-and-sand-by-kaye-menner-kaye-menner.html?product=canvas-print
#Art #BuyIntoArt #AYearForArt #Artist #FineArtAmerica
Friday December 22 the Word is Zed
#Music #FridayMusic #GreatBands #GreatSongs
Jan 05 #Alone
Jan 19 #Born
Feb 02 #Care
Feb 16 #Dragon
Mar 01 #Exchange
Mar 15 #Four
Mar 29 #Gang
Apr 12 #High
Apr 26 #Idle
May 10 #Just
May 24 #Killer
Jun 07 #Lesson
Jun 21 #Message
Jul 05 #Night
Jul 19 #Open
Aug 02 #Play
Aug 16 #Question
Aug 30 #Radio
Sep 13 #Sin
Sep 27 #Taboo
Oct 11 #Up
Oct 25 #Veil
Nov 08 #Worry
Nov 22 #Xray
Dec 06 #Yen
Dec 20 #zen