4 posts about #devops

Handle environment variables on a heroku app from CLI

The heroku config commands of the Heroku CLI makes it easy to manage your app’s config vars.

cd myapp

# This will list all the env variables from your app
heroku config 

# Set env you want to add/update
heroku config:set S3_KEY=12345

# Get specific env
heroku config:get S3_KEY

# Removes specific env
heroku config:unset S3_KEY

Learned by aldo-marquez on Jan 5, 2023

Tell apt to keep the current version of a package

If you ever need apt to keep the current version of a package, use hold:

sudo apt-mark hold <package>

This will prevent apt from upgrading the package. You can always unhold it back when you want to upgrade it.

Learned by kevin-perez on Aug 22, 2022

Always check ACLs if something is fishy!

If you ever encounter a Linux dir in which you cannot write even when you're sure you have write permissions on it, check the ACLs. You may find someone doesn't particularly like you. 😞

-> getfacl /tmp 
# file: tmp
# owner: root
# group: root
# flags: --t
user:my_user:--- # this means "screw u and only u"

Learned by kevin-perez on Mar 11, 2022

Profiles in docker compose, specify default services

It is common to have multiple services listed in the docker-compose file, sometimes with dependencies, but also, a normal workflow sometimes is to just start everything, like:

docker-compose -f docker-compose.yml -d

And it will start all servies listed with their dependencies, but, what happens if you need to add another service and you do not need it to start along with the rest? The answer is: profiles:

    image: pg
    image: redis
      - db
      - cache
    command: puma
    profiles: [ 'jobs' ]
      - db
      - cache
    command: sidekiq

So, in this case, whenever you do docker-compose up -d it will start only rails with its dependencies: db and cache, it wont start sidekiq by default, but if you really want to start sidekiq, then you need to explicitly type it: docker-compose up sidekiq -d.

Learned by Edwin Cruz on Sep 15, 2021