How Sam's Windows development environment is configured

The first error in the log (/var/lib/dockers/containers/idhere/idhere.json) is:

{"log":"2017-06-18 02:16:36.036 UTC [2492] discourse@discourse ERROR:  relation \"api_keys\" already exists\r\n","stream":"stdout","time":"2017-06-18T02:16:37.497495095Z"}
{"log":"2017-06-18 02:16:36.036 UTC [2492] discourse@discourse STATEMENT:  CREATE TABLE api_keys (\r\n","stream":"stdout","time":"2017-06-18T02:16:37.510775323Z"}

In the restore progress window in the browser everything leading up to that looks like:

[2017-06-18 02:16:33] 'eli' has started the restore!
[2017-06-18 02:16:33] Marking restore as running...
[2017-06-18 02:16:33] Making sure /var/www/discourse/tmp/restores/default/2017-06-18-021633 exists...
[2017-06-18 02:16:33] Copying archive to tmp directory...
[2017-06-18 02:16:33] Unzipping archive, this may take a while...
[2017-06-18 02:16:35] Extracting metadata file...
[2017-06-18 02:16:35] Validating metadata...
[2017-06-18 02:16:35]   Current version: 20170605014820
[2017-06-18 02:16:35]   Restored version: 20170307181800
[2017-06-18 02:16:35] Extracting dump file...
[2017-06-18 02:16:35] Restoring dump file... (can be quite long)
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] SET
[2017-06-18 02:16:36] ERROR:  relation "api_keys" already exists

Which is making me think, not a syntax error. That’s the first CREATE TABLE statement in the file. I understand that during restores there’s supposed to be some CREATE SCHEMA / RENAME SCHEMA magic that goes on (eg Manually restoring a Discourse backup for development ), but I don’t see that in the Docker log, the less verbose on screen restore log, or inside the dump.sql file.

I thought that might be the problem, so I manually put in

DROP SCHEMA IF EXISTS restore CASCADE;
CREATE SCHEMA restore;

Without luck.

Is this process sound? It’s how I set things up:

mkdir /var/discourse /var/hold
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
./discourse-setup
# errored out because of mail config,
vi container/app.yml

tar cf - . | gzip > /var/hold/fresh-install.tgz

And then restore them between runs:

cd /var/discourse
./launcher stop app
rm -rf ./* /var/lib/dockers/containers/*
tar xzf /var/hold/fresh-install.tgz
./launcher rebuild app
mkdir -p  /var/discourse/shared/standalone/backups/default
cp /var/hold/backup.tgz /var/discourse/shared/standalone/backups/default/try-begriffin-2017-03-09-145156-v20170307181800.tar.gz

Then I have to go into the web browser and create my admin account, enable restores, and try to restore the backup.

But that should reset everything past initial docker install, right?