Wednesday, 13 October 2021

Tuesday, 12 October 2021

Kutt : Free Modern URL Shortener

cd /opt/webapps/kutt

sudo -u www-data pm2 startup

sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u wildanm --hp /var/www

sudo -u www-data pm2 save

Referensi

  1. Kutt, a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics, https://github.com/openthinklabs/kutt
  2. pm2 startup script, https://pm2.keymetrics.io/docs/usage/startup/

Saturday, 9 October 2021

UVDesk : Open Source Helpdesk System

install extention imap 

install mailparse : pecl install mailparse


Setelah composer install, jika ada error : 

Executing script cache:clear [KO]

 [KO]

Script cache:clear returned with error code 1

!!

!!  In ArrayNode.php line 220:

!!

!!    The child node "key" at path "cspoo_swiftmailer_mailgun" must be configured

!!    .

!!

!!

!!

Script @auto-scripts was called via post-update-cmd


Ikuti langkah disini : https://github.com/tehplague/swiftmailer-mailgun-bundle/issues/74#issuecomment-428552701

 

Untuk proses update jangan menuliskan perintah composer update, tapi lakukan hal berikut : 

composer update uvdesk/core-framework
composer update uvdesk/support-center-bundle
composer update uvdesk/mailbox-component
composer update uvdesk/automation-bundle
composer update uvdesk/extension-framework

 php bin/console swiftmailer:email:send --to=to@gmail.com --from='from@gmail.com'' --subject="test from cli" --body=test --mailer=smtp.mail.com

smtp

Mailgun


composer require cspoo/swiftmailer-mailgun-bundle php-http/guzzle5-adapter
composer require guzzlehttp/psr7

Error : 

doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php:90)"} []
[2021-10-13 08:15:51] php.CRITICAL: Call to undefined method cspoo\Swiftmailer\MailgunBundle\Service\MailgunTransport::setPassword() {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined method cspoo\\Swiftmailer\\MailgunBundle\\Service\\MailgunTransport::setPassword() at /opt/webapps/uvdesk/vendor/uvdesk/core-framework/Services/EmailService.php:500)"} []

Solusi : 

Pada file vendor/cspoo/swiftmailer-mailgun-bundle/Service/MailgunTransport.php

tambahkan properties dan methods berikut : 

        /**
     * The password for authentication.
     *
     * @var string
     */
    private $password;

    /**
     * Set the password to authenticate with.
     *
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->password = $password;
    }
    
    
    /**
     * Get the password to authenticate with.
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }    

Perubahan ini sudah diterapkan pada openthinklabs/swiftmailer-mailgun-bundle

Konfigurasi .env : 
MAILER_URL=smtp://smtp.mailgun.org:587?encryption=tls&username=ausername&password=apassword
###< symfony/swiftmailer-bundle ###
MAILGUN_DOMAIN="domain.com"
MAILGUN_API_KEY="domain_key"
MAILGUN_SENDER="info@domain.com"


Untuk mengetes mengirim email, gunakan perintah : 

php bin/console swiftmailer:email:send --from=<from email> --to=<to email> --subject="Foo" --body="Bar" 

MailBox


Contoh konfigurasi yang dapat digunakan adalah seperti ini: 

config/packages/uvdesk_mailbox.yaml


Untuk menarik data dari mailbox, dapat menggunakan perintah : 

php bin/console uvdesk:refresh-mailbox email-address@example.com

Buat cron job untuk mengeksekusi perintah ini secara rutin, misal setiap 15 menit sekali. 

Mac


Jika perintah ini dijalankan di Mac, maka kita akan mendapatkan error : 

....
 Mailbox refreshed successfully !!!
PHP Fatal error:  Uncaught ErrorException: Notice: Unknown: [ALERT] Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library) in Unknown:0
Stack trace:
#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(8, 'Unknown: [ALERT...', 'Unknown', 0, NULL)
#1 {main}
  thrown in Unknown on line 0

Fatal error: Uncaught ErrorException: Notice: Unknown: [ALERT] Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library) in Unknown:0
Stack trace:
#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(8, 'Unknown: [ALERT...', 'Unknown', 0, NULL)
#1 {main}
  thrown in Unknown on line 0

Referensi 

  1. composer update caused uvdesk broken, https://github.com/uvdesk/community-skeleton/issues/263
  2. SSL3_GET_SERVER_CERTIFICATE:certificate verify failed #544, https://github.com/swiftmailer/swiftmailer/issues/544
  3. How to Setup Mailbox : UVdesk Open Source Helpdesk, https://www.uvdesk.com/en/blog/setup-mailbox-uvdesk-open-source-helpdesk/
  4. UVdesk- Custom Field, https://webkul.com/blog/uvdesk-custom-fields/