paragonie / airship

Secure Content Management for the Modern Web - "The sky is only the beginning"
https://cspr.ng
Other
418 stars 41 forks source link

Default configuration fails on step 2 of Install #104

Closed co60ca closed 8 years ago

co60ca commented 8 years ago

This build was outdated: 2c9df9aa588fd335d0d5e621d8835710dc318c40

Steps:

  1. docker-compose up
  2. Set database to: host: database user: airship password: secret database: airship
  3. username: airship password: bAFYbkOE2oekD7TE

  4. Click use default configuration
  5. White screen

    Relevant Debug Information

[Thu Jul 07 20:17:28.063647 2016] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Thu Jul 07 20:17:54.935315 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Notice:  Undefined index: databases in /var/www/airship/src/Installer/Install.php on line 440, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.935360 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Notice:  Undefined index: twig-vars in /var/www/airship/src/Installer/Install.php on line 445, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.935368 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Notice:  Undefined index: cabin in /var/www/airship/src/Installer/Install.php on line 465, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.935374 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Notice:  Undefined index: database in /var/www/airship/src/Installer/Install.php on line 467, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.935432 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Warning:  Invalid argument supplied for foreach() in /var/www/airship/src/Installer/Install.php on line 546, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.944150 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Notice:  Undefined index: databases in /var/www/airship/src/Installer/Install.php on line 594, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:17:54.956515 2016] [:error] [pid 6] [client 192.168.2.101:40962] PHP Fatal error:  Uncaught TypeError: DSN must be string or array in /var/www/airship/src/Engine/Database.php:77\nStack trace:\n#0 /var/www/airship/src/Installer/Install.php(726): Airship\\Engine\\Database::factory(NULL)\n#1 /var/www/airship/src/Installer/Install.php(670): Airship\\Installer\\Install->finalDatabasePrimary()\n#2 /var/www/airship/src/Installer/Install.php(470): Airship\\Installer\\Install->finalDatabaseSetup()\n#3 /var/www/airship/src/Installer/Install.php(131): Airship\\Installer\\Install->finalize(Array)\n#4 /var/www/airship/src/Installer/launch.php(175): Airship\\Installer\\Install->currentStep()\n#5 /var/www/airship/src/public/index.php(26): include('/var/www/airshi...')\n#6 {main}\n  thrown in /var/www/airship/src/Engine/Database.php on line 77, referer: http://appserv-ub03:8080/
paragonie-scott commented 8 years ago

Can you try again with master?

co60ca commented 8 years ago

This occurs with: 43cf37ae57f8ca888642e229e8106fb4df44a7d1 Master sends you to this page screenshot_2016-07-07_16-45-30 if you select the default option, if you select the other option and leave defaults it works fine

Errors:

[Thu Jul 07 20:52:28.239920 2016] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Thu Jul 07 20:52:51.267189 2016] [:error] [pid 7] [client 192.168.2.101:41520] PHP Notice:  Undefined index: twig-vars in /var/www/airship/src/Installer/Install.php on line 445, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:52:51.267235 2016] [:error] [pid 7] [client 192.168.2.101:41520] PHP Notice:  Undefined index: cabin in /var/www/airship/src/Installer/Install.php on line 465, referer: http://appserv-ub03:8080/
[Thu Jul 07 20:52:51.267297 2016] [:error] [pid 7] [client 192.168.2.101:41520] PHP Warning:  Invalid argument supplied for foreach() in /var/www/airship/src/Installer/Install.php on line 546, referer: http://appserv-ub03:8080/
paragonie-scott commented 8 years ago

What does src/config/cabins.conf look like?

co60ca commented 8 years ago

Doesn't exist? We have

root@3f53d072684d:/var/www/airship# cat src/config/cabins.json
{
    /*         Placeholders allowed:
        // These match (but don't capture) an optional / prefix:
            '{_any}'
            '{_id}'
            '{_year}'
            '{_month}'
            '{_day}'
            '{_isodate}'
            '{_lower}'
            '{_upper}'
            '{_page}'
            '{_slug}'
            '{_uslug}'
            '{_lslug}'
            '{_string}'
            '{_hex}',
        // Without the / prefix:
            '{any}'
            '{id}'
            '{year}'
            '{month}'
            '{day}'
            '{isodate}'
            '{lower}'
            '{upper}'
            '{slug}'
            '{uslug}'
            '{lslug}'
            '{string}'
            '{hex}'
    */
paragonie-scott commented 8 years ago

There's a problem with the configuration not being written. How strange that it worked for me, but not in Docker...

co60ca commented 8 years ago

src/config files are 664, dir is 775 too

paragonie-scott commented 8 years ago

I can't reproduce this locally, but I'm not a Docker user, so that's probably not very helpful feedback.

co60ca commented 8 years ago

The errors in the prior comment mean anything? Unset variables

co60ca commented 8 years ago

You used a - vs _ in two places here https://github.com/paragonie/airship/blob/master/src/Installer/Install.php#L390 https://github.com/paragonie/airship/blob/master/src/Installer/Install.php#L445

paragonie-scott commented 8 years ago

https://github.com/paragonie/airship/commit/da8092ebf1ad0748a99baf186854332c78d86569

Maybe that fixes it.

co60ca commented 8 years ago

Different error on da8092ebf1ad0748a99baf186854332c78d86569:

string(187) "SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "ON" LINE 21: CREATE UNIQUE INDEX IF NOT EXISTS ON airship_users (username... ^" string(903) "CREATE TABLE IF NOT EXISTS airship_users ( userid BIGSERIAL PRIMARY KEY, username TEXT, password TEXT, totp_secret TEXT, enable_2factor BOOLEAN DEFAULT FALSE, session_canary TEXT, display_name TEXT, email TEXT, uniqueid TEXT, real_name TEXT DEFAULT NULL, birthdate TIMESTAMP NULL, allow_reset BOOLEAN DEFAULT FALSE, gpg_public_key TEXT, custom_fields JSONB NULL, publicprofile BOOLEAN DEFAULT FALSE, superuser BOOLEAN DEFAULT FALSE, created TIMESTAMP DEFAULT NOW(), modified TIMESTAMP DEFAULT NOW() ); CREATE UNIQUE INDEX IF NOT EXISTS ON airship_users (username); CREATE UNIQUE INDEX IF NOT EXISTS ON airship_users (uniqueid); DROP TRIGGER IF EXISTS update_airship_users_modtime ON airship_users; CREATE TRIGGER update_airship_users_modtime BEFORE UPDATE ON airship_users FOR EACH ROW EXECUTE PROCEDURE update_modtime(); "
paragonie-scott commented 8 years ago

I literally just added that. Are you using pgsql 9.5, as required?

co60ca commented 8 years ago
psql --version
psql (PostgreSQL) 9.5.3
paragonie-scott commented 8 years ago

What does the server run? (Also 9.5, I hope.)

co60ca commented 8 years ago

Yup, both the airship & database containers use 9.5.3

paragonie-scott commented 8 years ago

Okay, reverting. Apparently you need a name for IF NOT EXISTS and I use the default name.

co60ca commented 8 years ago
string(187) "SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "ON" LINE 10: CREATE UNIQUE INDEX IF NOT EXISTS ON airship_auth_tokens (se... ^" string(576) "CREATE TABLE IF NOT EXISTS airship_auth_tokens ( tokenid BIGSERIAL PRIMARY KEY, userid INTEGER, selector TEXT, validator TEXT, created TIMESTAMP DEFAULT NOW(), modified TIMESTAMP DEFAULT NOW(), FOREIGN KEY (userid) REFERENCES airship_users (userid) ); CREATE UNIQUE INDEX IF NOT EXISTS ON airship_auth_tokens (selector); DROP TRIGGER IF EXISTS update_airship_auth_tokens_modtime ON airship_auth_tokens; CREATE TRIGGER update_airship_auth_tokens_modtime BEFORE UPDATE ON airship_auth_tokens FOR EACH ROW EXECUTE PROCEDURE update_modtime(); "
paragonie-scott commented 8 years ago

See latest commit

co60ca commented 8 years ago

Ahaha, I see that now It's like the phantom pull request from this morning

paragonie-scott commented 8 years ago

No, I meant the commit message. :P

PHPStorm sometimes does that, and I usually notice.

co60ca commented 8 years ago

Yeah, saw that :P

co60ca commented 8 years ago
string(180) "SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "EXISTSON" LINE 10: CREATE INDEX IF NOT EXISTSON airship_tree_updates (channel)... ^" string(744) "CREATE TABLE IF NOT EXISTS airship_tree_updates ( treeupdateid BIGSERIAL PRIMARY KEY, channel TEXT, channelupdateid BIGINT, data TEXT, merkleroot TEXT, created TIMESTAMP DEFAULT NOW(), modified TIMESTAMP DEFAULT NOW() ); CREATE INDEX IF NOT EXISTSON airship_tree_updates (channel); CREATE INDEX IF NOT EXISTSON airship_tree_updates (channelupdateid); CREATE UNIQUE INDEX IF NOT EXISTSON airship_tree_updates (channel, channelupdateid); CREATE INDEX IF NOT EXISTSON airship_tree_updates (merkleroot); DROP TRIGGER IF EXISTS update_airship_tree_updates_modtime ON airship_tree_updates; CREATE TRIGGER update_airship_tree_updates_modtime BEFORE UPDATE ON airship_tree_updates FOR EACH ROW EXECUTE PROCEDURE update_modtime();"

;-;

paragonie-scott commented 8 years ago

So, it turns out, blindly searching an replacing strings isn't the most effective strategy for reverting a change.

co60ca commented 8 years ago

sudo bash -c "git pull origin master && echo "Y" | docker-composer rm && docker-compose build && docker-compose up --force-recreate"

string(181) "SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "ON" LINE 10: CREATE INDEX IF NOT EXISTS ON airship_tree_updates (channel... ^" string(748) "CREATE TABLE IF NOT EXISTS airship_tree_updates ( treeupdateid BIGSERIAL PRIMARY KEY, channel TEXT, channelupdateid BIGINT, data TEXT, merkleroot TEXT, created TIMESTAMP DEFAULT NOW(), modified TIMESTAMP DEFAULT NOW() ); CREATE INDEX IF NOT EXISTS ON airship_tree_updates (channel); CREATE INDEX IF NOT EXISTS ON airship_tree_updates (channelupdateid); CREATE UNIQUE INDEX IF NOT EXISTS ON airship_tree_updates (channel, channelupdateid); CREATE INDEX IF NOT EXISTS ON airship_tree_updates (merkleroot); DROP TRIGGER IF EXISTS update_airship_tree_updates_modtime ON airship_tree_updates; CREATE TRIGGER update_airship_tree_updates_modtime BEFORE UPDATE ON airship_tree_updates FOR EACH ROW EXECUTE PROCEDURE update_modtime();"
paragonie-scott commented 8 years ago

:[ I could've sworn I found them all. Sigh.

co60ca commented 8 years ago

The github search works pretty well

paragonie-scott commented 8 years ago

Yeah. Okay, try again please.

co60ca commented 8 years ago

Bingo!

paragonie-scott commented 8 years ago

Excellent. Whew.

I'll figure out "detect if already installed and skip" later.