Tony Scida
Archive About Also on Micro.blog
  • Automatic Database Backups to S3 from Dokku Postgres

    For a Django web app I run, I wanted to set up more-frequent backups of the database to S3 storage. It turned out to be simpler than I thought, because the site runs on Dokku and the database plugin supports encrypted backups to S3. Initially, I looked at the write-up in this post, but quickly found a few mistakes in the example code and instead looked at the examples in the database plugin’s excellent documentation. Thanks Thom as well for the advice on configuring the S3 bucket.

    The short version of the steps to set it up is:

    # Authenticate with AWS
    # <service> is the name of the database service you created
    # and linked to your app
    dokku postgres:backup-auth <service> AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
    
    # Encrypt backups
    # I used 1Password to create and store the passphrase
    dokku postgres:backup-set-encryption <service> <passphrase>
    
    # Create a backup to make sure it works
    # <bucket-name> is the bucket you created in the AWS dashboard
    dokku postgres:backup <service> <bucket-name>
    
    # Schedule reguluar backups
    # The <schedule> is a crontab expression wrapped in quotation marks, 
    # like "0 0 * * *" for every day at midnight
    dokku postgres:backup-schedule <service> <schedule> <bucket-name>
    
    → 10:48 AM, Dec 22
  • Putting Email on Blast

    One of the things I need to find a better way to communicate to clients is that, every time they send an email to their list, they are going to get some unsubscribes. It’s not necessarily a bad thing and doesn’t mean your list can’t be growing overall. A person may no longer be interested. Or they’ve left that job (and therefore email address) and it gets removed for a hard bounce. But, it’s always a balance between getting your message out to people and not wearing out your welcome. The lens I like to look at a potential email “blast” (as clients like to call them) is: is this important enough to lose subscribers over? But I struggle sometimes to help clients understand that sending the same email out three or four times is counterproductive.

    → 2:07 PM, Dec 21
  • Delete and Move in Logic Pro

    One of the things that was frustrating to me working in Logic Pro, having more familiarity with other DAWs and with Premiere Pro for video editing was having to move track segments around when I wanted to remove a portion of a track. Recently I came across a tip to assign a shortcut to Delete and Move. Because for some reason most Logic Pro tips are burried in long YouTube videos, I figured I’d pull this one out and save it, in case I need it again in the future. This still isn’t as easy simply hitting the apostrophe key to delete a selection from a timeline in Premiere Pro, but it at least helps keep the track you’re working on more manageable. 

    Logic Pro Delete and MoveLogic Delete and Move

    → 11:23 PM, Dec 14
  • Year Based Filtering of a Django Model

    I’m working on a Django app for a client so their staff can more easily submit vacation requests and track their amount used/remaining. Because their time off resets at the end of the calendar year, I needed a good way to filter requests by year. I ended up creating a custom Model manager (with some tips from my friend Ben) that would automatically filter to the current year, yet allow filtering by a given year.

    class YearManager(models.Manager):
        def year(self, year=None):
            year = year or timezone.now().year
            return super(YearManager, self).get_queryset().filter(start_date__year=year)
    

    This lets me get the current year’s items with MyModel.objects.year() or a given year with MyModel.objects.year(year=2021).

    → 2:34 PM, Dec 14
  • Trying Something New

    In the spirit of David Smith’s Design Notes Diary series, I thought I would start posting about some of the things I’m working on day-to-day, including design or coding challenges I’ve solved or questions I have. Because it didn’t really seem to fit into anything else I had going, I decided to set up a new micro.blog.

    → 2:13 PM, Dec 14
  • RSS
  • JSON Feed
  • Surprise me!