Skip to content

Instantly share code, notes, and snippets.

@p1nox
Last active May 25, 2020 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p1nox/dcfe68f6dc03b691b9b17bc60a736f99 to your computer and use it in GitHub Desktop.
Save p1nox/dcfe68f6dc03b691b9b17bc60a736f99 to your computer and use it in GitHub Desktop.
dokku
###### local settings

git remote add dokku dokku@1.1.1.1:my_api

###### python django rest framework

# apps
dokku apps:create my_api
dokku apps:list

# env vars
dokku config my_api
dokku config:set my_api DISABLE_COLLECTSTATIC=0

# logs
dokku logs my_api -t

# ports
dokku proxy:ports my_api
dokku proxy:ports-add my_api http:80:5000
dokku proxy:ports-remove my_api http:37705:5000
dokku proxy:ports-set my_api http:80:5000

# postgres
dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create my_api
dokku postgres:link my_api_db my_api
dokku postgres:info my_api_db
dokku config my_api
# or remote db
dokku config:set my_api DATABASE_URL=postgres://postgres:xxx@dokku-postgres-my-api-db:5432/my_api_db

# init scripts
dokku run my_api python manage.py migrate
dokku run my_api python manage.py createsuperuser --email admin --username admin

###### create react app

# apps
dokku apps:create my_spa
dokku apps:list

# env vars
dokku config my_spa
dokku config:set fabtecuida_spa REACT_APP_API_HOST=http://1.1.1.1

# ports
dokku proxy:ports my_spa
dokku proxy:ports-add my_spa http:80:5000
dokku proxy:ports-remove my_spa http:24728:5000
dokku proxy:ports-set my_spa http:80:5000

###### edge cases

# not enough mem
dd if=/dev/zero of=/swapfile bs=1024 count=3000000  # 3Gb
mkswap /swapfile
swapon /swapfile

###### oldies

dokku plugin:install https://github.com/sehrope/dokku-logging-supervisord.git
tail -f /var/log/dokku/key-service/web.00.log

dokku config:set node-js-app NODE_ENV=production
dokku trace on

dokku plugin:install https://github.com/dokku/dokku-redis.git redis
dokku redis:create lolipop
dokku redis:link lolipop node-js-app
dokku redis:info lolipop

dokku plugin:install https://github.com/dokku/dokku-mongo.git mongo
dokku mongo:create lolipop
dokku mongo:link lolipop playground
dokku mongo:info lolipop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment