From f5eb463f91836525239327537392fc4d65fcb542 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 23 Mar 2021 22:38:09 +0100 Subject: Cut down code quotes that were too long and disformed the blog template --- content/blog/cfengine/leveraging-yaml.md | 11 ++++++++--- content/blog/commands/qemu.md | 3 ++- content/blog/hugo/adding-custom-shortcode-age.md | 4 ++-- content/blog/kubernetes/pg_dump_restore.md | 7 +++++-- content/blog/miscellaneous/pleroma.md | 7 ++++--- content/blog/miscellaneous/postgresql-reassign.md | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) (limited to 'content/blog') diff --git a/content/blog/cfengine/leveraging-yaml.md b/content/blog/cfengine/leveraging-yaml.md index 62b3a2d..e773325 100644 --- a/content/blog/cfengine/leveraging-yaml.md +++ b/content/blog/cfengine/leveraging-yaml.md @@ -83,7 +83,9 @@ bundle agent openvpn classes => if_repaired("tunnel_$(tunnels)_service_repaired"); commands: any:: - "/usr/sbin/service openvpn@$(tunnels) restart" classes => if_repaired("tunnel_$(tunnels)_service_repaired"), ifvarclass => "openvpn_common_key_repaired"; + "/usr/sbin/service openvpn@$(tunnels) restart" + classes => if_repaired("tunnel_$(tunnels)_service_repaired"), + ifvarclass => "openvpn_common_key_repaired"; reports: any:: "$(this.bundle): common.key repaired" ifvarclass => "openvpn_common_key_repaired"; @@ -94,7 +96,8 @@ bundle agent openvpn_tunnel(tunnel) { classes: any:: - "has_remote" and => { isvariable("g.host_data[tunnels][$(tunnel)][remote_host]"), isvariable("g.host_data[tunnels][$(tunnel)][remote_port]") }; + "has_remote" and => { isvariable("g.host_data[tunnels][$(tunnel)][remote_host]"), + isvariable("g.host_data[tunnels][$(tunnel)][remote_port]") }; files: any:: "/etc/openvpn/$(tunnel).conf" @@ -106,7 +109,9 @@ bundle agent openvpn_tunnel(tunnel) classes => if_repaired("openvpn_$(tunnel)_conf_repaired"); commands: any:: - "/usr/sbin/service openvpn@$(tunnel) restart" classes => if_repaired("tunnel_$(tunnel)_service_repaired"), ifvarclass => "openvpn_$(tunnel)_conf_repaired"; + "/usr/sbin/service openvpn@$(tunnel) restart" + classes => if_repaired("tunnel_$(tunnel)_service_repaired"), + ifvarclass => "openvpn_$(tunnel)_conf_repaired"; reports: any:: "$(this.bundle): $(tunnel).conf repaired" ifvarclass => "openvpn_$(tunnel)_conf_repaired"; diff --git a/content/blog/commands/qemu.md b/content/blog/commands/qemu.md index 74afc5e..294c9a9 100644 --- a/content/blog/commands/qemu.md +++ b/content/blog/commands/qemu.md @@ -14,7 +14,8 @@ In this example I am using the docker0 bridge because I do not want to have to m ip tuntap add tap0 mode tap brctl addif docker0 tap0 qemu-img create -f qcow2 obsd.qcow2 10G -qemu-system-x86_64 -curses -drive file=install65.fs,format=raw -drive file=obsd.qcow2 -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0 +qemu-system-x86_64 -curses -drive file=install65.fs,format=raw -drive file=obsd.qcow2 \ + -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0 qemu-system-x86_64 -curses -drive file=obsd.qcow2 -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0 {{< /highlight >}} diff --git a/content/blog/hugo/adding-custom-shortcode-age.md b/content/blog/hugo/adding-custom-shortcode-age.md index 13cc4a5..afa96b4 100644 --- a/content/blog/hugo/adding-custom-shortcode-age.md +++ b/content/blog/hugo/adding-custom-shortcode-age.md @@ -1,7 +1,7 @@ --- -title: "Adding a custom hugo markdown shortcode to calculate an age" +title: Custom hugo markdown shortcode date: 2021-03-22 -description: An example of custom hugo shortcode +description: An example of custom hugo shortcode to calculate automatically something tags: - hugo --- diff --git a/content/blog/kubernetes/pg_dump_restore.md b/content/blog/kubernetes/pg_dump_restore.md index fe99d06..17641d2 100644 --- a/content/blog/kubernetes/pg_dump_restore.md +++ b/content/blog/kubernetes/pg_dump_restore.md @@ -10,8 +10,11 @@ tags: Assuming we are working with a postgresql statefulset, our namespace is named `miniflux` and our master pod is named `db-postgresql-0`, trying to dump a database named `miniflux`: {{< highlight sh >}} -export POSTGRES_PASSWORD=$(kubectl get secret --namespace miniflux db-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode) -kubectl run db-postgresql-client --rm --tty -i --restart='Never' --namespace miniflux --image docker.io/bitnami/postgresql:11.8.0-debian-10-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- pg_dump --host db-postgresql -U postgres -d miniflux > miniflux.sql-2020062501 +export POSTGRES_PASSWORD=$(kubectl get secret --namespace miniflux db-postgresql \ + -o jsonpath="{.data.postgresql-password}" | base64 --decode) +kubectl run db-postgresql-client --rm --tty -i --restart='Never' --namespace miniflux \ + --image docker.io/bitnami/postgresql:11.8.0-debian-10-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" \ + --command -- pg_dump --host db-postgresql -U postgres -d miniflux > miniflux.sql-2020062501 {{< /highlight >}} ## Restoring diff --git a/content/blog/miscellaneous/pleroma.md b/content/blog/miscellaneous/pleroma.md index 28ac365..725541a 100644 --- a/content/blog/miscellaneous/pleroma.md +++ b/content/blog/miscellaneous/pleroma.md @@ -13,7 +13,8 @@ This article is about my installation of pleroma in a standard alpine linux lxd ## Installation notes {{< highlight sh >}} -apk add elixir nginx postgresql postgresql-contrib git sudo erlang-ssl erlang-xmerl erlang-parsetools erlang-runtime-tools make gcc build-base vim vimdiff htop curl +apk add elixir nginx postgresql postgresql-contrib git sudo erlang-ssl erlang-xmerl erlang-parsetools \ + erlang-runtime-tools make gcc build-base vim vimdiff htop curl /etc/init.d/postgresql start rc-update add postgresql default cd /srv @@ -49,10 +50,10 @@ curl http://localhost:4000/api/v1/instance If this works, you can shut it down with two C-c and we can configure nginx. This article doesn't really cover my setup since my nginx doesn't run there, and I am using letsencrypt wildcard certificates fetched somewhere else unrelated, so to simplify I only paste the vhost part of the configuration : {{< highlight sh >}} - ### in nginx.conf inside the container ### # {{{ pleroma -proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=500m inactive=200m use_temp_path=off; +proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=500m + inactive=200m use_temp_path=off; ssl_session_cache shared:ssl_session_cache:10m; server { listen 80; diff --git a/content/blog/miscellaneous/postgresql-reassign.md b/content/blog/miscellaneous/postgresql-reassign.md index b794442..d7d28d9 100644 --- a/content/blog/miscellaneous/postgresql-reassign.md +++ b/content/blog/miscellaneous/postgresql-reassign.md @@ -11,7 +11,7 @@ tags: Here is the sequence of commande that will change the owner of all objects in a database from a user named "support" to another named "test-support": {{< highlight sh >}} ALTER DATABASE name OWNER TO new_owner -for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done +for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done for tbl in `psql -qAt -c "select table_name from information_schema.views where table_schema = 'public';" YOUR_DB` ; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done {{< /highlight >}} -- cgit v1.2.3