Skip to content

Deploying Dokku and on Dokku

Areeb Jamal edited this page Jan 16, 2021 · 2 revisions
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.6/bootstrap.sh
sudo DOKKU_TAG=v0.22.6 bash bootstrap.sh

Complete dokku admin setup and point dokku.fossasia.org to the IP of the server

Install Plugins:

sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
sudo dokku plugin:install https://github.com/dokku/dokku-redis.git
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku config:set --global --no-restart DOKKU_LETSENCRYPT_EMAIL=<your_email>

Create app and link resources:

dokku apps:create open-event
dokku postgres:create opev-db
dokku postgres:link opev-db open-event
dokku redis:create opev-cache
dokku redis:link opev-cache open-event

Add buildpacks:

dokku buildpacks:add open-event https://github.com/moneymeets/python-poetry-buildpack.git
dokku buildpacks:add open-event heroku/python

Add config:

dokku git:set open-event deploy-branch development

dokku config:set open-event --no-restart SECRET_KEY=<SECRET_KEY>
dokku config:set --no-restart open-event SUPER_ADMIN_EMAIL=<your_email>
dokku config:set --no-restart open-event SUPER_ADMIN_PASSWORD=<password>

dokku config:set --no-restart open-event POETRY_NO_INTERACTION=1
dokku config:set --no-restart open-event DISABLE_POETRY_CREATE_RUNTIME_FILE=1

Now, on local machine:

git remote add dokku dokku@dokku.fossasia.org:open-event
git push dokku development

Enable HTTPS:

dokku letsencrypt open-event

Result:

remote: -----> Cleaning up...        
remote: -----> Building open-event from herokuish...        
remote: -----> Adding BUILD_ENV to build environment...        
remote:        -----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.        
remote:               Detected buildpacks: multi nodejs        
remote:        -----> Multipack app detected        
remote: =====> Downloading Buildpack: moneymeets/python-poetry-buildpack.git        
remote: =====> Detected Framework: Python Poetry        
remote: -----> No Poetry version specified in POETRY_VERSION config var. Defaulting to 1.1.4.        
remote: -----> Generate requirements.txt with Poetry        
remote: -----> Install Poetry        
remote:        Retrieving Poetry metadata        
remote:                
remote:        # Welcome to Poetry!
remote: -----> Export requirements.txt from Poetry        
remote: -----> Export Python version from Poetry to Heroku runtime.txt file        
remote: -----> Skip generation of runtime.txt file from poetry.lock        
remote: =====> Downloading Buildpack: heroku/heroku-buildpack-python.git        
remote: =====> Detected Framework: Python        
remote: -----> No change in requirements detected, installing from cache        
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2        
remote: -----> Installing SQLite3        
remote: -----> Installing requirements with pip        
remote:        Ignoring cffi: markers 'platform_python_implementation == "CPython" and sys_platform == "win32" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0") and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")' don't match your environment        
remote:        Ignoring colorama: markers 'python_version >= "2.7" and python_full_version < "3.0.0" and platform_system == "Windows" or python_full_version >= "3.5.0" and platform_system == "Windows"' don't match your environment        
remote:        Using release configuration from last framework (Python).        
remote:        -----> Discovering process types        
remote:        Procfile declares types -> release, web        
remote: -----> Releasing open-event...        
remote: -----> Deploying open-event...        
remote: -----> Checking for predeploy task        
remote:        No predeploy task found, skipping        
remote: -----> Checking for release task        
remote: -----> Executing release task from Procfile: python manage.py prepare_db && python manage.py db upgrade        
remote: =====> Start of open-event release task (b0dd6d04b) output        
remote:        [LOG] Existing tables:        
remote:        [LOG] pages,sessions_speakers_links,roles_panels,panel_permissions,user_system_role,permissions,notifications,events_version,users_events_roles,video_channels,speaker,roles,custom_sys_roles,users,user_permissions,services,events,settings,ticket_fees,event_topics,image_sizes,activities,mails,message_settings,event_types,event_locations,discount_codes,email_notifications,orders,tickets,ticket_tag,event_invoices,stripe_authorizations,custom_forms,event_sub_topics,event_copyrights,sponsors,social_links,faq_types,speakers_calls,tracks,session_types,export_jobs,role_invites,tax,user_favourite_events,video_streams,import_jobs,user_emails,user_token_blacklist_time,transaction,notification_actions,orders_tickets,discount_codes_tickets,ticket_tagging,access_codes,custom_form_options,custom_placeholders,microlocations,faq,sessions,access_codes_tickets,feedback,speakers_sessions,alembic_version,user_favourite_sessions,groups,ticket_holders        
remote:        [LOG] Tables already exist. Skipping data population & creation.        
remote:        INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.        
remote:        INFO  [alembic.runtime.migration] Will assume transactional DDL.        
remote: =====> End of open-event release task (b0dd6d04b) output        
remote: -----> App Procfile file found        
remote: -----> DOKKU_SCALE file exists        
remote: =====> Processing deployment checks        
remote:        No CHECKS file found. Simple container checks will be performed.        
remote:        For more efficient zero downtime deployments, create a CHECKS file. See http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys for examples        
remote: -----> Attempting pre-flight checks (web.1)        
remote:        Waiting for 10 seconds ...        
remote:        Default container check successful!        
remote: -----> Running post-deploy        
remote: -----> Configuring open-event.dokku.fossasia.org...(using built-in template)        
remote: -----> Creating https nginx.conf        
remote:        Enabling HSTS        
remote:        Reloading nginx        
remote: -----> Renaming containers        
remote:        Found previous container(s) (19bee2535ff2) named open-event.web.1        
remote:        Renaming container (19bee2535ff2) open-event.web.1 to open-event.web.1.1610762036        
remote:        Renaming container (d906442bf554) boring_herschel to open-event.web.1        
remote: -----> Checking for postdeploy task        
remote:        No postdeploy task found, skipping        
remote: -----> Shutting down old containers in 60 seconds        
remote:        19bee2535ff25f358a15fc2ad06e242ee91bcb4eb4535beddd2a81578c9cf034        
remote: =====> Application deployed:        
remote:        http://open-event.dokku.fossasia.org        
remote:        open-event.dokku.fossasia.org        
remote:         
To ssh://dokku.fossasia.org/open-event
 + 4e4570093...0adc3643b 0adc3643b0cda2e58c93b1bff9eb08ab8ef472b8 -> development