pabloveintimilla / mautic-amazon-ses

Mautic 5 plugin, provides Amazon SES as an email transport and callback to process bounces
GNU General Public License v3.0
28 stars 5 forks source link

How do I install this if I didn't use composer to install Mautic? #3

Closed itnavigate closed 2 weeks ago

itnavigate commented 2 months ago

I downloaded 95_mautic-510.zip, and unzipped this into my web_root folder - /var/www/mautic (I'm using nginx - not that I expect that matters) From my web_root I run composer require pabloveintimilla/mautic-amazon-ses

this generates the following error:

./composer.json has been updated
Running composer update pabloveintimilla/mautic-amazon-ses
Loading composer repositories with package information
Updating dependencies
Lock file operations: 6 installs, 0 updates, 0 removals
  - Locking async-aws/core (1.22.0)
  - Locking async-aws/ses (1.8.1)
  - Locking aws/aws-php-sns-message-validator (1.9.0)
  - Locking pabloveintimilla/mautic-amazon-ses (v1.0.2)
  - Locking symfony/amazon-mailer (v6.0.19)
  - Locking teknasyon-teknoloji/aws-ses-notification (2.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
  - Downloading async-aws/core (1.22.0)
  - Downloading aws/aws-php-sns-message-validator (1.9.0)
  - Downloading teknasyon-teknoloji/aws-ses-notification (2.0.0)
  - Downloading async-aws/ses (1.8.1)
  - Downloading symfony/amazon-mailer (v6.0.19)
  - Downloading pabloveintimilla/mautic-amazon-ses (v1.0.2)
  - Installing async-aws/core (1.22.0): Extracting archive
  - Installing aws/aws-php-sns-message-validator (1.9.0): Extracting archive
  - Installing teknasyon-teknoloji/aws-ses-notification (2.0.0): Extracting archive
  - Installing async-aws/ses (1.8.1): Extracting archive
  - Installing symfony/amazon-mailer (v6.0.19): Extracting archive
  - Installing pabloveintimilla/mautic-amazon-ses (v1.0.2): Extracting archive
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package theofidry/psysh-bundle is abandoned, you should avoid using it. No replacement was suggested.
Package tightenco/collect is abandoned, you should avoid using it. Use illuminate/collections instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
160 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
> php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}"
> php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}"
> npm ci --prefer-offline --no-audit
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

> mautic@0.0.0 postinstall
> node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js & npm run build

> mautic@0.0.0 build
> webpack --mode production  --config webpack.config.js

Modernizr build saved to node_modules/modernizr/modernizr-mautic-dist.js
asset ckeditor.js 1.46 MiB [emitted] [minimized] [big] (name: main) 2 related assets
asset translations/bn.js 25 KiB [emitted] [minimized]
asset translations/th.js 23.9 KiB [emitted] [minimized]
asset translations/el.js 22.5 KiB [emitted] [minimized]
asset translations/ru.js 21.7 KiB [emitted] [minimized]
asset translations/bg.js 21.5 KiB [emitted] [minimized]
asset translations/uk.js 21 KiB [emitted] [minimized]
asset translations/hi.js 18.6 KiB [emitted] [minimized]
asset translations/ar.js 18.3 KiB [emitted] [minimized]
asset translations/sr.js 17.5 KiB [emitted] [minimized]
asset translations/he.js 16.8 KiB [emitted] [minimized]
asset translations/ja.js 16.7 KiB [emitted] [minimized]
asset translations/vi.js 16.2 KiB [emitted] [minimized]
asset translations/it.js 15.6 KiB [emitted] [minimized]
+ 57 assets
orphan modules 5.45 MiB [orphan] 1626 modules
runtime modules 2.06 KiB 6 modules
cacheable modules 5.48 MiB
  modules by path ./node_modules/@ckeditor/ 471 KiB 91 modules
  modules by path ./node_modules/color-convert/*.js 20.5 KiB
    ./node_modules/color-convert/index.js 1.67 KiB [built] [code generated]
    ./node_modules/color-convert/conversions.js 16.6 KiB [built] [code generated]
    ./node_modules/color-convert/route.js 2.2 KiB [built] [code generated]
  modules by path ./node_modules/css-loader/dist/runtime/*.js 3.84 KiB
    ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.27 KiB [built] [code generated]
    ./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
  ./app/assets/libraries/ckeditor/src/ckeditor.ts + 1135 modules 4.98 MiB [built] [code generated]
  ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js 6.67 KiB [built] [code generated]
  ./node_modules/color-name/index.js 4.51 KiB [built] [code generated]
webpack 5.88.2 compiled successfully in 40003 ms

added 601 packages in 54s

75 packages are looking for funding
  run `npm fund` for details
> npx patch-package
patch-package 7.0.2
Applying patches...
at.js@1.5.4 ✔
chosen-js@1.8.7 ✔
> bin/console mautic:assets:generate
sh: 1: bin/console: Permission denied
Script bin/console mautic:assets:generate handling the generate-assets event returned with error code 126
Script @generate-assets was called via post-update-cmd

modifying the line that calls bin/composer to be php bin/composer may be a solution

EDIT: Removed pre-coffee stupid words :-/ . I have included new command and error, along with a proposed solution. Obviously running a command that requires a home directory will fail to find the config file that resides in the home directory.

itnavigate commented 2 months ago

I have installed mautic using

cd ~
wget -q https://github.com/mautic/mautic/releases/download/5.1.0/5.1.0.zip
sudo unzip -qq ~/5.1.0.zip -d mautic
cd /var/www/mautic
composer update
composer install
sudo chown nginx:nginx /var/www/mautic
sudo chmod ug+x bin/console

then

composer require pabloveintimilla/mautic-amazon-ses

producing

./composer.json has been updated
Running composer update pabloveintimilla/mautic-amazon-ses
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package theofidry/psysh-bundle is abandoned, you should avoid using it. No replacement was suggested.
Package tightenco/collect is abandoned, you should avoid using it. Use illuminate/collections instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
160 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
> php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}"
> php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}"
> npm ci --prefer-offline --no-audit
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

> mautic@0.0.0 postinstall
> node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js & npm run build

> mautic@0.0.0 build
> webpack --mode production  --config webpack.config.js

Modernizr build saved to node_modules/modernizr/modernizr-mautic-dist.js
[CKEditorTranslationsPlugin] Error: No translation has been found for the en language.
asset ckeditor.js 1.45 MiB [compared for emit] [minimized] [big] (name: main) 2 related assets
cached modules 10.9 MiB (javascript) 2.06 KiB (runtime) [cached] 1731 modules
webpack 5.88.2 compiled successfully in 2731 ms

added 601 packages in 13s

75 packages are looking for funding
  run `npm fund` for details
> npx patch-package
patch-package 7.0.2
Applying patches...
at.js@1.5.4 ✔
chosen-js@1.8.7 ✔
> bin/console mautic:assets:generate
PHP Warning:  Undefined array key "host" in /var/www/mautic/app/bundles/CoreBundle/Loader/EnvVars/SAMLEnvVars.php on line 16
Production assets have been regenerated.
No security vulnerability advisories found.
Using version ^1.0 for pabloveintimilla/mautic-amazon-ses

I cannot see the plugin in the "Manage Plugins" screen. image

Any clues?

itnavigate commented 2 months ago

AhHem. Then I actually finished the install by running :

admin@ip-172-31-17-84:/var/www/mautic$ sudo -u nginx php bin/console cache:clear
PHP Warning:  Undefined array key "host" in /var/www/mautic/app/bundles/CoreBundle/Loader/EnvVars/SAMLEnvVars.php on line 16

 // Clearing the cache for the prod environment with debug false

 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.

admin@ip-172-31-17-84:/var/www/mautic$ sudo -u nginx php bin/console mautic:plugins:reload
PHP Warning:  Undefined array key "host" in /var/www/mautic/app/bundles/CoreBundle/Loader/EnvVars/SAMLEnvVars.php on line 16
1 new plugins were installed and 0 updated.

and the plugin is now installed.

Thanks @pabloveintimilla for this plugin. EDIT: Fix code-block format

itnavigate commented 2 months ago

Just to check your documentation: You have referred to ACCESS_KEY, aws-user and apiKey. Are these all what AWS refers to as Access key in their SMTP credentials?

When I use my values here, I get this error: image I not that your instructions don't mention the port number in your example URI:

ses+api://ACCESS_KEY:SECRET_KEY@default?region=REGION

, but removing the port number doesn't fix it.

leovieira commented 1 month ago

@itnavigate same issue here. Did you fix this?

itnavigate commented 1 month ago

@itnavigate same issue here. Did you fix this?

Working on it today. I have had it work occasionally, but I'm trying to get a reproducible solution that I can then document.

leovieira commented 1 month ago

I fix now. Just create a new user on IAM with SES and SNS permissions.