From 347f50d6f319d0feddef421a04d0d83403715980 Mon Sep 17 00:00:00 2001 From: iturgeon Date: Wed, 24 Feb 2021 16:15:09 -0500 Subject: [PATCH 1/5] update heroku build process for new config options --- app.json | 28 +++++++++++++++++++--------- composer.json | 3 +-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app.json b/app.json index f8b407c03..a27c2dde8 100644 --- a/app.json +++ b/app.json @@ -18,28 +18,38 @@ "postdeploy": "composer run oil-install-quiet && php oil r widget:install_from_config" }, "env": { - "FUEL_ENV": { - "description": "FUELPHP Environment to load", + "SYSTEM_EMAIL":{ + "description": "From email address for this server", "required": true, - "value": "production" + "value": "invalid-email@invalid-host.com" }, - "LTI_USERNAME_PARAM":{ - "description": "Which LTI post param to use as a username", + "FUEL_LOG_THRESHOLD":{ + "description": "Threshold for for which types of logs get written. See Readme", + "required": true, + "value": "300" + }, + "LTI_REMOTE_IDENTIFIER":{ + "description": "Which LTI post param to use as a username. See Readme", + "required": true, + "value": "lis_person_sourcedid" + }, + "LTI_REMOTE_USERNAME":{ + "description": "Which LTI post param to use as a username, duplicate of LTI_REMOTE_IDENTIFIER", "required": true, "value": "lis_person_sourcedid" }, "LTI_KEY":{ - "description": "LTI Key for configuring your LMS", + "description": "LTI Key for configuring your LMS. See Readme", "required": true, "value": "my-demo-materia-heroku-key" }, "LTI_SECRET":{ - "description": "LTI secret for configuring your LMS", + "description": "LTI secret for configuring your LMS. See Readme", "required": true, "generator": "secret" }, - "MATERIA_AUTH_SALT":{ - "description": "Secret salt for hashing authentication variables", + "AUTH_SIMPLEAUTH_SALT":{ + "description": "Secret salt for hashing authentication variables. See Readme", "required": true, "generator": "secret" }, diff --git a/composer.json b/composer.json index dbb6358bb..cb55c6a8f 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,8 @@ "test": "php fuel/vendor/bin/phpunit -c fuel/app/phpunit.xml", "test-with-xdebug": "php -dzend_extension=xdebug.so fuel/vendor/bin/phpunit -c fuel/app/phpunit.xml", "coverage": "php oil test --coverage-html=coverage --coverage-clover=coverage.xml --coverage-text=coverage.txt", - "heroku-place-configs": "cp -R fuel/app/config/heroku fuel/app/config/production && cp -R fuel/app/modules/lti/config/heroku fuel/app/modules/lti/config/production", "heroku-extract-widgets": "php oil r widget:extract_from_config", - "compile": ["@heroku-place-configs", "@heroku-extract-widgets"], + "compile": ["@heroku-extract-widgets"], "devserver": "php oil server", "testci":[ "@destroy-everything", From a89cd1869270a209a1f17d83f7b44b85ecd57b77 Mon Sep 17 00:00:00 2001 From: iturgeon Date: Wed, 24 Feb 2021 17:00:24 -0500 Subject: [PATCH 2/5] added missing AUTH_SALT to heroku app.json --- app.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.json b/app.json index a27c2dde8..23b935997 100644 --- a/app.json +++ b/app.json @@ -48,6 +48,11 @@ "required": true, "generator": "secret" }, + "AUTH_SALT":{ + "description": "Secret salt for hashing authentication variables. See Readme", + "required": true, + "generator": "secret" + }, "AUTH_SIMPLEAUTH_SALT":{ "description": "Secret salt for hashing authentication variables. See Readme", "required": true, From 6bc004f50594de9156852901823187a22152b43d Mon Sep 17 00:00:00 2001 From: iturgeon Date: Wed, 24 Feb 2021 17:18:09 -0500 Subject: [PATCH 3/5] remove requirement to have THEME_PACKAGE set --- fuel/app/config/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/app/config/theme.php b/fuel/app/config/theme.php index fa1203af7..9c1bd88a3 100644 --- a/fuel/app/config/theme.php +++ b/fuel/app/config/theme.php @@ -35,7 +35,7 @@ * The theme search paths. They are searched in the order given. You can add paths * on the fly via Theme::add_path($path) or Theme::add_paths(array($path1, $path2)); */ - 'paths' => explode(',', APPPATH.'themes'.','.($_ENV['THEME_PACKAGE'] ? PKGPATH.$_ENV['THEME_PACKAGE'] : '')), + 'paths' => explode(',', APPPATH.'themes'.','.(isset($_ENV['THEME_PACKAGE']) ? PKGPATH.$_ENV['THEME_PACKAGE'] : '')), /** * The folder inside the theme to be used to store assets. This is relative to the From 83ea95be93fb871805f2073a09eec791e670173b Mon Sep 17 00:00:00 2001 From: iturgeon Date: Wed, 24 Feb 2021 17:40:54 -0500 Subject: [PATCH 4/5] sets session and asset storage drivers for heroku --- README.md | 6 +++--- app.json | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 64686a9df..10fbb0619 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ BOOL_SEND_EMAILS=false #BOOL_ADMIN_UPLOADER_ENABLE=true #materia.asset_storage_driver -# Where to store author uploaded media? file is easy. db is easy & works when running multiple Materia servers. s3 is harder to set up, but efficient and multi-server friendly. +# Where to store author uploaded media? file is easy. db is easy & works when running multiple Materia servers. s3 is harder to set up, but efficient and multi-server friendly. Do not use file on Heroku. # [file|db|s3] # (default: file) #ASSET_STORAGE_DRIVER=file @@ -206,7 +206,7 @@ BOOL_SEND_EMAILS=false #ASSET_STORAGE_S3_SECRET= # SESSION & CACHE =================== - +# Where to store app cache. file is an easy default if you don't have a memcached server. file is OK on Heroku. #cache.driver: [memcached|file] (default: file) #CACHE_DRIVER=file @@ -221,7 +221,7 @@ BOOL_SEND_EMAILS=false #MEMCACHED_PORT=11211 #session.driver -# Where to keep user sessions? file = easy, db = multi-server support, memcached = fast! & multiserver! +# Where to keep user sessions? file = easy, db = multi-server support, memcached = fast! & multiserver! Do not use file on Heroku. # [db|file|memcached] # (default: file) #SESSION_DRIVER=file diff --git a/app.json b/app.json index 23b935997..d8b5f4c55 100644 --- a/app.json +++ b/app.json @@ -28,6 +28,16 @@ "required": true, "value": "300" }, + "SESSION_DRIVER":{ + "description": "Where to keep user sessions? See Readme", + "required": true, + "value": "db" + }, + "ASSET_STORAGE_DRIVER":{ + "description": "Where to store author uploaded media? See Readme", + "required": true, + "value": "db" + }, "LTI_REMOTE_IDENTIFIER":{ "description": "Which LTI post param to use as a username. See Readme", "required": true, From 69b34d6964eeec36c4a3b00d55f6db0121b80995 Mon Sep 17 00:00:00 2001 From: iturgeon Date: Wed, 24 Feb 2021 17:53:41 -0500 Subject: [PATCH 5/5] attempt to fix storage driver config bug for heroku --- fuel/app/config/materia.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fuel/app/config/materia.php b/fuel/app/config/materia.php index 9ce2c5c75..ed7fd531c 100644 --- a/fuel/app/config/materia.php +++ b/fuel/app/config/materia.php @@ -96,7 +96,8 @@ 'db' => [ 'driver_class' => '\Materia\Widget_Asset_Storage_Db' ], - 's3' => $_ENV['ASSET_STORAGE_DRIVER'] ?? false == 's3' + 's3' => ( + (($_ENV['ASSET_STORAGE_DRIVER'] ?? 'file') == 's3') ? [ 'driver_class' => '\Materia\Widget_Asset_Storage_S3', 'endpoint' =>$_ENV['ASSET_STORAGE_S3_ENDPOINT'] ?? false, // set to url for testing endpoint @@ -107,7 +108,7 @@ 'key' => $_ENV['ASSET_STORAGE_S3_KEY'] ?? 'KEY' // aws api key ] : null - , + ), ] ];