How to script the setup wizard?

Assuming a multisite installation, creating an approved admin user and an admin API key can be done with:

  • docker exec app env RAILS_DB=secondsite rake 'api_key:create_master[MYKEY]'
  • ( echo user1@example.com ; echo $pass ; echo $pass ; echo ) | docker exec -i app env RAILS_DB=secondsite rake 'admin:create'

Note: if not on a multisite installation, just remove env RAILS_DB=secondsite

And then verify that it works with

curl -X GET https://forum2/admin/backups -H "Accept: application/json" -H "Api-Key: 886171a73dd12759b5d6c1915b0f0d4475e8b3fff3d97954b95171200b6" -H "Api-Username: user1"
[]

(special thanks to Jay Pfaffman for the inspiration)

After this is done, discourse no longer requires to run the wizard, although it shows that it should be run.