Sometimes things break

If you randomly start to see 500+ errors on your sites, changes are there’s a bug you didn’t know about. Today I discovered one. One of my projects was returning a 502 error, I reviewed the logs. The logs basically told me that my database find was using too much ram. After some googling I determined I had to use an index on one of the models inside of my project. Very simple fix and works correctly now.

Make sure you check the basic functionality of your projects every so often. You will find sometimes it will alert you to problems you didn’t know about.

Sometimes you’ll have to change your application due to how people use it.

Initial brainstorm phase can only get you so far, the real test of your project is letting general people access it without you looking over their shoulder. Sometimes you will find that your assumptions are wrong, or that you need to add extra fields to the form. Say for when people decide to apply to use an TestFlight build, and they don’t have an iPhone. Don’t get mad at your users when you have to change your project to handle how they are actually going to use it. Don’t forget to test your projects with real people.

The importance health habits.

Building and maintaining good and health habits as a developer. The more good habits you have less likely you will become burnt out. If you become burnt out it’s extremely difficult and almost impossible to recover from.

Some tips of health habits to adopt for yourself:

  • Take a walk outside daily.
  • Eat breakfast
  • Eat fresh fruit and vegetables.
  • Get enough sleep.
    • Try to get 7-8 hours a night.
    • You can try doing this in two phases if needed instead, some research shows this is more natural for humans anyways.
  • Don’t take on projects that you can’t handle.
  • Try meditation.
  • Reduce your sugar intake
  • Drink only black coffee.
  • Reduce your commute to less than 30 mins each direction.
  • Keep your working environment organized in such a way that you can find what you need when you need it. No you don’t have to clean your desk, just make sure you can find what you need.
  • Make sure you have hobbies that aren’t sitting down at a computer.
  • Do yourself a favor and get an ergonomic setup.

How I Built and Host This Blog

Yes, this blog is in WordPress, however it’s not on a simple shared host. I’m hosting this on Digital Ocean, in a Droplet. This droplet is a linux using an open source toolset known as Dokku, an open source alternative to Heroku. I can host all my websites inside of one Digital Ocean Droplet.

I ended up having to build this to use Digital Oceans Volume Storage so I could have better control of the file system and could make sure things remained intact.

Below is some of the commands that I had to use on the Dokku machine to make the site work.

dokku apps:create $APP_NAME
mkdir -p /mnt/volume_db_storage/$APP_NAME
ln -s /mnt/volume_db_storage/$APP_NAME /var/lib/dokku/data/storage/$APP_NAME
chown 32767:32767 /mnt/volume_db_storage/$APP_NAME
chown 32767:32767 /var/lib/dokku/data/storage/$APP_NAME
dokku storage:mount $APP_NAME /var/lib/dokku/data/storage/$APP_NAME:/app/wordpress
dokku mysql:create $APP_NAME-database
dokku mysql:link $APP_NAME-database $APP_NAME
dokku letsencrypt $APP_NAME
dokku domains:add $APP_NAME $DOMAIN_NAME

I also had to customize the wp-config.php file, in order for it to connect to the database and have the proper keys/salts.