ssh-copy-id -i my.key.pub <hostname probably from tailscale>
this makes sure I can run ansible from my desktop against VMs on my server
easily if they have tailscale for the hostname - otherwise use the IP
Thoughts on tech
Nextcloud Docker Upgrade Error
Systemd timer for syncoid
in /lib/systemd/system/docker.service there is an ExecStart command that got placed there when I setup Docker with Ansible - it threw the -H flag which told the daemon what hosts to setup. But I added the “hosts” key in my daemon.json and it broke - so removing the -H flag from the systemd unit fixed it
I regularly need to edit system config files - take /etc/sanoid/sanoid.conf as
an example… I’ll want to play with something but if I don’t start Neovim as
root then I get in trouble making edits I can’t save! So
suda.vim gives me
:SudaWrite which let’s me write that buffer with sudo privileges even though
I’m Neovim is running with my login user!
AJAX wasn’t cutting it, traditional crontab in containers doesn’t make much sense to me, webcron is recommended but I don’t want to register with anything outside my LAN… Turns out you can just spin up an identical container with a different entrypoint to /cron.sh that does what you need!
Note that this is a task in an Ansible playbook - but the docker-compose is straight forward
So the only thing you need to make sure of is that all the configuration options - data volumes, user permissions, etc. are identical between the containers running the cron job and the one actually hosting NextCloud. This ensures that the container running cron has proper access to the database and filesystem - or at least the same access as NextCloud proper.
- name: Nextcloud Cron Docker Container
docker_container:
name: nextcloud-cron
image: "{{ nextcloud_image }}"
pull: true
links:
- nextcloud-mysql:mysql
entrypoint: /cron.sh
volumes:
- "{{ nextcloud_data_directory }}/nextcloud:/var/www/html:rw"
env:
MYSQL_HOST: "mysql"
MYSQL_DATABASE: "nextcloud"
MYSQL_USER: "{{ nextcloud_sql_user }}"
MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_hostname }}.{{ ansible_nas_domain }}"
PUID: "{{ nextcloud_user_id }}"
PGID: "{{ nextcloud_group_id }}"
TZ: "{{ ansible_nas_timezone }}"
restart_policy: unless-stopped
memory: "{{ nextcloud_memory }}"
Logging instead of printing
I am trying to adopt logger.debug instead of print but ran into a confusing
thing in ipython during Advent of Code… I riddled by script with
logger.debug (yes after setting logging.setLevel('DEBUG')) but in ipython
none of my log messages showed up!
import logging
logger = logging.getLogger(__name__)
logger.setLevel("DEBUG")
Turns out what I was missing was a call to basicConfig
import logging
# forget this and your messages are in the ether! or at least not seen in ipython...
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel("DEBUG")
Bonus
Want your new messages to show up while iterating on something without killing the ipython kernel?
from importlib import reload
reload(logging) # to make sure you get new log messages you add while developing!
I wanted to break down some long lines in a Markdown table cell to make it look
nicer on my blog but \n didn’t do anything for me… turns out
is the
magic sauce
| Column 1 | Column 2 |
|---|---|
| Key | Doggo ipsum many pats. Borkdrive borking doggo doing me a frighten doggorino, noodle horse heckin. what a nice floof. Pupper borking doggo you are doing me a frighten, much ruin diet. |
| — | — |
| Column 1 | Column 2 |
|---|---|
| Key | Doggo ipsum many pats. Borkdrive borking doggo doing me a frighten doggorino, noodle horse heckin. what a nice floof. Pupper borking doggo you are doing me a frighten, much ruin diet. |
| — | — |
Description of my proposed vimconf 2022 talk
mkdir s{1..10} will make directories s1, s2, … s10 in one command!