docker-freescout icon indicating copy to clipboard operation
docker-freescout copied to clipboard

Genereal suggestion | Best practice

Open aj-saini opened this issue 1 year ago • 20 comments

I would like to know where/how are everyone else using free scout,

we tried using it in production but too many fetch email errors happening all time randomly

can someone please share their best configuration/setup for example we tried AWS lightsnails, in house proxmox servers hypervisor and also docker containers - they are have fetching errors delay or just very slow,
our email provider is msft office 365,

can someone please share production level setup which is reliable and best practices so that we can that shot overall i really like the freescout interface and powerful modules

But i just need help someone point me in the right direction

Thank you

aj-saini avatar Feb 22 '23 07:02 aj-saini

I run a couple large installations (largest 70 mailboxes + 130 concurrent users) off of this Docker image for a few years now and not seeing any delays. My MySQL/MariaDB is tuned and consumes about 6gb of memory (MariaDB 10.8) and the Freescout approx 512MB on an average day.

I use IMAP to connect to my own imap servers and fetch emails every 5 minutes.

Could this be a network or limitation imposed by O365?

tiredofit avatar Feb 22 '23 16:02 tiredofit

That is what I am assuming, pulling request even every 1 minute with Msft is not possible,

Freeacout-helpdesk suggest some other email provider i will try gsuitr as they still support simple auth,

Helpscout uses forward email and then SMTP only as a workaround, I have noticed

Thank you

aj-saini avatar Feb 22 '23 16:02 aj-saini

What is the "best method" if i want to fetch new email every one minute

With no/least amount of errors

aj-saini avatar Feb 22 '23 16:02 aj-saini

I think what the real issue here is that Freescout creates a new connection every minute per mailbox and then closes the connection, where as email clients like Thunderbird use the IDLE IMAP command maintaining a connection thus avoiding authentication and all the heavy lifting.

You could theoretically build a mirror of a mailbox and host an imap server locally which sounds like a huge hassle, but then you could have ultimate flexibility and control the access limitations.

I have a client who has ~45 mailboxes and polls every 2 minutes, so perhaps as well this could be a network issue?

tiredofit avatar Feb 22 '23 16:02 tiredofit

Is that something you provide support or docker image etc, to host your own IMAP server which compliance with Msft and gsuite

I don't mind being a lifetime patron if that resolve the issue

aj-saini avatar Feb 22 '23 16:02 aj-saini

Mail is a finnicky beast - I run many mail servers but it is getting much more of a pain to send to the big providers. Microsoft (@live,@hotmail,@outlook and all associated domains) just randomly stop accepting messages from IPs and then there is noone on the other side to assist. It's a constant game of cat and mouse. I would say if that would be something you are interested in is to use the services of a large mail provider like SendGrid and see if they offer pop3/IMAP access.

Gmail has been pretty good for me to send and receive out of from Freescout to other domains for what its worth.

tiredofit avatar Feb 22 '23 16:02 tiredofit

Hi @tiredofit

          • php /var/www/html/artisan schedule:run >> /dev/null 2>&1 the above cmd runs/update the whole application once every minute, browser notifications fetch emails and blah blah

what if i run only this cmd php artisan freescout:fetch-emails every 5 seconds for example > put it under a script and execute every 5 seconds,

one of the reason i believe freescout is "slow" it makes a new connection every minute authenticates then fetch emails and then close connection ?

Please feel free to comment if above is a bad idea

aj-saini avatar Feb 23 '23 05:02 aj-saini

if you can help me put the above cmd and someone how run it from a docker container would be life saver

aj-saini avatar Feb 23 '23 05:02 aj-saini

or to test how do i even run the above cmd inside one of your docker container manually Thank you

aj-saini avatar Feb 23 '23 05:02 aj-saini

`root@Smarttrucking:~/cron# ls freescout-schedule logrotate root@Smarttrucking:~/cron# cat freescout-schedule

Hardcoded in image in /etc/cont-init.d/30-freescout

Generated on 2023-02-22 01:49:38 EST

          • sudo -u nginx TZ=America/Toronto LD_PRELOAD=/usr/lib/preloadable_libiconv.so php /www/html/artisan schedule:run >> /dev/null 2>&1 root@Smarttrucking:~/cron#`

- ./cron:/install/assets/cron/ - inside docker-compose.yml file

if i add anything to the above file it just disappear

aj-saini avatar Feb 23 '23 05:02 aj-saini

So lets take a step back here

  • What are you trying to do?
  • If fetching - Fetch how many mailboxes?
  • How many times do you want to fetch per hour? I believe the fetching settings are in the application itself. The cron command simply allows for other commands (like mail out/workflows)

tiredofit avatar Feb 23 '23 07:02 tiredofit

So lets take a step back here

* What are you trying to do?

* If fetching - Fetch how many mailboxes?

* How many times do you want to fetch per hour? I believe the fetching settings are in the application itself. The cron command simply allows for other commands (like mail out/workflows)

We are using freescout as more of a shared mailbox VS traditional tickets It's trucking company we get paperwork which needs to be approved or disapproved asap. So fetching as soon as possible would be ideal,

At the moment we have about 6 mailboxes configured, I don't think fetching is inbuild, it is perhaps the crontab itself executing every minute,

I can make script which exceute every 10 seconds and runs a for a minute max which gets called by crontab

aj-saini avatar Feb 23 '23 14:02 aj-saini

OK I have clients that use it as a general shared inbox similar as well.

I think you may want to raise this up to the freescout developers in the freescout repository to see about different ways of fetching specifically for this reason - Again I believe the fetch part is configurable (by minute) in the UI, but the actual triggers for it get called every minute. It's probably putting too much load to do everything, so perhaps there is a way to break out the fetching and sending component.

tiredofit avatar Feb 23 '23 15:02 tiredofit

So in a non docker editing i ran this cmd every 15 seconds, php /var/www/html/artisan schedule:run >> /dev/null 2>&1 and everything worked,

Can you please tell me how to edit crontab in docker edition maybe step by step guide

aj-saini avatar Feb 23 '23 15:02 aj-saini

[tiredofit/freescout 07:56:13 /] $ crontab -l
* * * * * sudo -u nginx TZ=America/Vancouver LD_PRELOAD=/usr/lib/preloadable_libiconv.so php /www/html/artisan schedule:run >> /dev/null 2>&1
59 23 * * * logrotate -f /etc/logrotate.conf >/dev/null 2>&1
[tiredofit/freescout 07:56:18 /] $ cd /assets/cron
[tiredofit/freescout 07:57:14 /assets/cron] $ ls -l
total 8
-rw-r--r--    1 root     root           236 Dec 26 07:26 freescout-schedule
-rw-r--r--    1 root     root           153 Dec 26 07:25 logrotate
[tiredofit/freescout 07:57:17 /assets/cron] $ cat freescout-schedule 
# Hardcoded in image in /etc/cont-init.d/30-freescout
# Generated on 2022-12-26 07:26:04 PST

* * * * * sudo -u nginx TZ=America/Vancouver LD_PRELOAD=/usr/lib/preloadable_libiconv.so php /www/html/artisan schedule:run >> /dev/null 2>&1
[tiredofit/freescout 07:57:33 /assets/cron] $

As per here you can map that folder and drop more files in a volume mapping and they will be read. Alternatively create a new environment variable eg

CRON_HELLO="* * * * * echo 'hello' > /tmp/hello.log Which will automatically create a crontab entry.

08:01:36 tiredofit:~]└3 111 $ docker run -e CRON_HELLO="* * * * * echo 'hello' > /tmp/hello.log" -it tiredofit/alpine:latest bash

[tiredofit/alpine 16:01:51 /] $ crontab -l
* * * * * echo '\''hello'\'' > /tmp/hello.log
59 23 * * * logrotate -f /etc/logrotate.conf >/dev/null 2>&1

[tiredofit/alpine 16:01:53 /] $ cat /assets/cron/hello
# Scheduled execution of command created automatically generated by Environment Variable defined in Image build, or Runtime argument
# Entered Value: 
# Generated on 2023-02-23 16:01:49 GMT

* * * * * echo '\''hello'\'' > /tmp/hello.log
[tiredofit/alpine 16:02:12 /] $ 

I don't think cron however is capable of firing less than a minute. You'd probably want to build a script to do that..

tiredofit avatar Feb 23 '23 16:02 tiredofit

I have few questions, I am trying to update the freescout docker crontab with below cmds

          • php /var/www/html/artisan schedule:run >> /dev/null 2>&1
          • ( sleep 10 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )
          • ( sleep 20 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )
          • ( sleep 30 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )
          • ( sleep 40 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )
          • ( sleep 50 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )

A) why am i running another docker container - docker run -e CRON_HELLO="* * * * * echo 'hello' > /tmp/hello.log" -it tiredofit/alpine:latest bash

aj-saini avatar Feb 23 '23 21:02 aj-saini

docker run -e CRON_ONE="* * * * * echo '( sleep 10 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )' > /tmp/one.log" -it tiredofit/alpine:latest bash

docker run -e CRON_TWO="* * * * * echo '( sleep 20 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )' > /tmp/two.log" -it tiredofit/alpine:latest bash

docker run -e CRON_THREE="* * * * * echo '( sleep 30 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )' > /tmp/three.log" -it tiredofit/alpine:latest bash

docker run -e CRON_FOUR="* * * * * echo '( sleep 40 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )' > /tmp/four.log" -it tiredofit/alpine:latest bash

docker run -e CRON_FIVE="* * * * * echo '( sleep 50 ; php /var/www/html/artisan freescout:fetch-emails >> /dev/null 2>&1 )' > /tmp/five.log" -it tiredofit/alpine:latest bash

This does not seem right ?

aj-saini avatar Feb 23 '23 21:02 aj-saini

You can just replace the tiredofit/alpine:latest with the tiredofit/freescout image you are using. This was an example as that feature exists all the way up to the top of my build chain.

You could add your CRON_ commands to your docker-compose.yml file

tiredofit avatar Feb 23 '23 21:02 tiredofit

You could add your CRON_ commands to your docker-compose.yml file

can you please provide an example how i can add he above cmds to the docker-compose.yml file,

That would be the most ideal way

Thank you

aj-saini avatar Feb 23 '23 22:02 aj-saini

my current docker-compose.yml file version: '2'

services: freescout-app: image: tiredofit/freescout container_name: freescout-app ports: - 80:80 links: - freescout-db volumes: ### If you want to perform customizations to the source and have access to it, then uncomment this line - This includes modules - ./data:/www/html ### Or, if you just want to use Stock Freescout and hold onto persistent files like cache and session use this, one or the other. #- ./data:/data ### If you want to just keep the original source and add additional modules uncomment this line #- ./modules:/www/html/Modules - ./assets/cron:/assets/cron/ - ./logs/:/www/logs environment: - CONTAINER_NAME=freescout-app - DB_HOST=freescout-db - DB_NAME=XXXXX - DB_USER=XXXXX - DB_PASS=XXXXX - SITE_URL=https://XXXXX.com - [email protected] - ADMIN_PASS=XXXXX - ENABLE_SSL_PROXY=TRUE - DISPLAY_ERRORS=FALSE - TIMEZONE=America/Toronto restart: always

freescout-db: image: tiredofit/mariadb container_name: freescout-db volumes: - ./db:/var/lib/mysql environment: - ROOT_PASS=XXXXX - DB_NAME=XXXXX - DB_USER=XXXXX - DB_PASS=XXXXX - CONTAINER_NAME=freescout-db restart: always

freescout-db-backup: container_name: freescout-db-backup image: tiredofit/db-backup links: - freescout-db volumes: - ./dbbackup:/backup environment: - CONTAINER_NAME=freescout-db-backup - DB_HOST=freescout-db - DB_TYPE=mariadb - DB_NAME=smartinboxdb - DB_USER=shinycrown77 - DB_PASS=t@llMemory20 - DB_DUMP_FREQ=1440 - DB_DUMP_BEGIN=0000 - DB_CLEANUP_TIME=8640 - COMPRESSION=BZ - MD5=TRUE restart: always

aj-saini avatar Feb 23 '23 22:02 aj-saini