Blog / Devops

How to delete files older than x hours in Ubuntu

November 5, 2016

The command is a pretty simple one-liner, though I probably won't remember it so I'm making a note of it here for future reference:

find /webapps/myproject/media -type f -cmin +120 -delete

This command basically just deletes all the files in my media folder where the last changed time is older than 120 minutes.

Automatically generating and renewing Let's Encrypt SSL certificates with the certbot client and Ansible

August 11, 2016

I just finished updating my ansible-django-stack project and added tasks to automatically issue a Let's Encrypt SSL certificate and set up a cron job to auto-renew the certificate.

We're now using it for all our Shopify apps which are built in Django. Let's Encrypt certificates are only valid for 90 days, so if you have a bunch of web apps like we do and have more planned in the future, automating this process now could …

Ansible playbook for provisioning a Jenkins CI server

May 27, 2016

I've finally decided to set up a Jenkins CI server for my Django projects earlier this week. For a long time, I've been deploying code via command line with Ansible. It worked very well but occasionally I find myself deploying from a coffee shop with unreliable connection, causing the deployment to get interrupted. Deploying instead from a virtual private server in the cloud would solve this and using Jenkins to do it was the first …

Using Amazon SQS with Django and Celery

August 31, 2015

I'm currently working on a new Django project which relies heavily on Celery. I normally use RabbitMQ for these kinds of projects but I decided to give Amazon SQS a try this time as it's very cheap and will simplify my setup.

While the Celery docs does a pretty good job explaining how to set it up, there were a few things that it didn't cover that I'm sure other devs will run into. …

Using ipdb with Docker Compose for interactive debugging

May 30, 2015

Back in the early days of Docker Compose, when it was still called Fig, you couldn't use ipdb with it to do interactive debugging because the container's service ports weren't exposed when using the run command. This has been fixed by including a ---service-ports option to the docker-compose run command.

Below is a sample usage for one of my Django projects, EZ Price Alerts.

In my detail view, I added import ipdb; ipdb.set_trace() …