2026-04-01

This commit is contained in:
gcch 2026-04-01 17:07:06 +02:00
commit 5f332f4068
34 changed files with 9392 additions and 391 deletions

View file

@ -1,7 +0,0 @@
#!/usr/bin/fish
for image in *.png
gm convert -resize 1000 $image ok-$image.png
end
flaca -p *

View file

@ -1,2 +1,4 @@
#!/usr/bin/fish
ssh ade -- fish /srv/haikuatelier.com/scripts/sauvegarde-bdd-production.fish
rclone copy --check-first --progress --multi-thread-streams 8 ade:/srv/haikuatelier.com/db /home/gcch/Répertoires/git.gcch.fr/gcch/haiku-atelier-2024/db

View file

@ -1,3 +1,5 @@
#!/usr/bin/fish
set -f fichiers_toml (fd --glob "*.toml")
set -f fichiers_angie (fd --glob "*.conf" containers/conf/angie)

View file

@ -0,0 +1,40 @@
import { $ } from "bun";
import { Array, Option, Order, pipe } from "effect";
import { readdir } from "node:fs/promises";
const launchContainers = async (): Promise<string> => {
return await $`podman compose up -d`.text();
};
const getLatestDbExport = async (): Promise<string> => {
return pipe(
await readdir(`../db`),
(paths: ReadonlyArray<string>) => Array.sort(paths, Order.string),
(sortedPaths: ReadonlyArray<string>) => Array.last(sortedPaths),
(last: Option.Option<string>) =>
Option.getOrThrowWith(last, () => new Error("Aucun export de BDD n'est disponible.")),
);
};
const importLatestDbInWordpressContainer = async (exportPath: string) => {
await $`podman exec -it haikuatelier.fr-wordpress fish -c "cd web && wp --allow-root db import ${exportPath}"`;
};
try {
// S'assure que les conteneurs soient lancées.
await launchContainers();
const latestExportPath: string = `../db/${await getLatestDbExport()}`;
console.log(`Dernier export : ${latestExportPath}`);
// Exécute l'opération d'import dans le conteneur WordPress via wp-cli.
await importLatestDbInWordpressContainer(latestExportPath);
} catch (error: unknown) {
if (error instanceof $.ShellError) {
console.error(`Commande échouée avec code d'erreur: ${error.exitCode}`);
console.log(error.stdout.toString());
console.log(error.stderr.toString());
} else {
console.error(error);
}
}

View file

@ -1,3 +1,5 @@
#!/usr/bin/fish
cd /srv/haikuatelier.com/web
sudo -S wp-cli --allow-root db export
sudo -S mv -v /srv/haikuatelier.com/web/*.sql ../db

View file

@ -1,3 +1,5 @@
#!/usr/bin/fish
pyftsubset \
lato-variable-italic.ttf \
--desubroutinize \