Articles

Affichage des articles du avril, 2022

Git and Linux commands

Linux  Remove recursively: rm -rf .git  read text file  cat filename.txt  sudo docker image prune --all Images that are not associated with containers docker image prune -a docker image prune -a --filter "until=12h" Shell into a docker container  docker exec container_name sh -c "" Remove a docker image docker rmi imageid Docker run image inside a container with env file docker run --env-file ./backend/.envs/.production/.postgres --name heroku -e "PORT=8765" -e "DEBUG=1" -p 8007:8765 heroku-app:latest

Heroku commands CLI

Heroku Principle: Build Dockerfile.build locally, test then deploy Dockerfile.prod ## Install the CLI ```bash sudo snap install --classic heroku ``` ```bash export PATH=$PATH:/snap/bin ``` ## Login ```bash heroku login ``` Generate Auth Token for Gitlab CI/CD heroku auth:token ## Create App if it doesn't exist ```bash heroku create <app_name> ``` ## Set envionment variables On Heroku ## Set project as containerized ```bash heroku stack:set container ``` ## Postgresql add-on (if not installed) ```bash heroku addons:create heroku-postgresql:hobby-dev ``` heroku addons:create heroku-postgresql:hobby-dev -a <app_name> Connect to Postgres   heroku pg:psql -a <app_name> \dt And run other postgres commands ## Heroku Builds ```bash heroku plugins:install heroku-builds # usage heroku builds:cancel -a django-react-boiler-v1 ``` ## Remote App ```bash heroku git:remote -a <app_name> ``` ## Rename staging remotes if necessary ```bash git remote rename heroku heroku-...