Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docksal CLI cron not running Drupal cron per-example in documentation #1401

Closed
lpeabody opened this issue Aug 12, 2020 · 3 comments
Closed

Comments

@lpeabody
Copy link
Contributor

lpeabody commented Aug 12, 2020

I have followed the documentation to a T and cannot get the cli service to successfully execute Drupal cron.

Contents of .docksal/services/cli/crontab:

* * * * * bash -l -c 'drush --root=/var/www/web core:cron'

The only deviation is I use web as my Drupal root as opposed to docroot.

Its frustrating to debug because there is no output generated at all. There are no logs if monitoring via fin logs cli.

To test whether or not the crontab was executing, I updated the crontab to:

* * * * * env > /tmp/env.output

And that in fact generated a file at /tmp/env.output containing a dump of environment variables.

Not sure how to proceed given the lack of log feedback.

Output of fin config:

fin config output
---------------------
COMPOSE_PROJECT_NAME_SAFE: lespeabodycom
COMPOSE_FILE:
/home/lpeabody/.docksal/stacks/volumes-bind.yml
/home/lpeabody/.docksal/stacks/stack-acquia.yml
/home/lpeabody/Projects/lespeabody.com/.docksal/docksal.yml
ENV_FILE:
/home/lpeabody/Projects/lespeabody.com/.docksal/docksal.env
/home/lpeabody/Projects/lespeabody.com/.docksal/docksal-local.env

PROJECT_ROOT: /home/lpeabody/Projects/lespeabody.com
DOCROOT: web
VIRTUAL_HOST: lespeabody.docksal.site
VIRTUAL_HOST_ALIASES: *.lespeabody.docksal.site
IP: 192.168.64.100
MYSQL: 192.168.64.100:32812

Docker Compose configuration
---------------------
services:
  browser:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    - 8.8.8.8
    - 9.9.9.9
    image: selenium/standalone-chrome
    ports:
    - 4444/tcp
  cli:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      BLACKFIRE_CLIENT_ID: null
      BLACKFIRE_CLIENT_TOKEN: null
      COMPOSER_ALLOW_XDEBUG: '0'
      COMPOSER_DISABLE_XDEBUG_WARN: '0'
      DEBUG: '1'
      DOCKSAL: '1'
      DOCROOT: web
      DRUSH_ALLOW_XDEBUG: '0'
      DRUSH_OPTIONS_URI: lespeabody.docksal.site
      GIT_USER_EMAIL: [email protected]
      GIT_USER_NAME: Les Peabody
      HOST_GID: '1000'
      HOST_UID: '1000'
      MYSQL_DATABASE: default
      MYSQL_HOST: db
      MYSQL_PASSWORD: user
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      PHP_IDE_CONFIG: null
      SECRET_ACAPI_EMAIL: null
      SECRET_ACAPI_KEY: null
      SECRET_ACQUIACLI_KEY: null
      SECRET_ACQUIACLI_SECRET: null
      SECRET_PLATFORMSH_CLI_TOKEN: null
      SECRET_SSH_PRIVATE_KEY: null
      SECRET_TERMINUS_TOKEN: null
      SSH_AUTH_SOCK: /.ssh-agent/proxy-socket
      VIRTUAL_HOST: lespeabody.docksal.site
      XDEBUG_CONFIG: remote_connect_back=0 remote_host=192.168.64.1
      XDEBUG_ENABLED: '0'
    hostname: cli
    image: docksal/cli:2.11-php7.3
    labels:
      io.docksal.shell: bash
      io.docksal.user: docker
    logging:
      options:
        max-file: '10'
        max-size: 1m
    ports:
    - 8080/tcp
    volumes:
    - docksal_ssh_agent:/.ssh-agent:ro
    - cli_home:/home/docker:rw
    - /home/lpeabody/.docksal/tmp/lespeabodycom:/home/lpeabody/.docksal/tmp/lespeabodycom:ro
    - project_root:/var/www:rw,nocopy,cached
  db:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: null
      MYSQL_DATABASE: default
      MYSQL_INITDB_SKIP_TZINFO: null
      MYSQL_ONETIME_PASSWORD: null
      MYSQL_PASSWORD: user
      MYSQL_RANDOM_ROOT_PASSWORD: null
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
    hostname: db
    image: docksal/mysql:5.7-1.5
    logging:
      options:
        max-file: '10'
        max-size: 1m
    ports:
    - 3306/tcp
    volumes:
    - db_data:/var/lib/mysql:rw
    - project_root:/var/www:ro,nocopy,cached
  memcached:
    command:
    - -m
    - '128'
    dns:
    - 8.8.8.8
    - 9.9.9.9
    hostname: memcached
    image: memcached:1.4-alpine
    logging:
      options:
        max-file: '10'
        max-size: 1m
  solr:
    dns:
    - 8.8.8.8
    - 9.9.9.9
    hostname: solr
    image: docksal/solr:8.1
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: solr.lespeabody.docksal.site,solr.lespeabody.docksal.site.*
      io.docksal.virtual-port: '8983'
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - project_root:/var/www:ro,nocopy,cached
  varnish:
    depends_on:
      web:
        condition: service_started
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      VARNISH_BACKEND_HOST: web
    hostname: varnish
    image: docksal/varnish:4.1-2.0
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: varnish.lespeabody.docksal.site,varnish.lespeabody.docksal.site.*
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - project_root:/var/www:ro,nocopy,cached
  web:
    depends_on:
      cli:
        condition: service_started
    dns:
    - 8.8.8.8
    - 9.9.9.9
    environment:
      APACHE_BASIC_AUTH_PASS: null
      APACHE_BASIC_AUTH_USER: null
      APACHE_DOCUMENTROOT: /var/www/web
      APACHE_FCGI_HOST_PORT: cli:9000
    hostname: web
    image: docksal/apache:2.4-2.3
    labels:
      io.docksal.cert-name: none
      io.docksal.permanent: "false"
      io.docksal.project-root: /home/lpeabody/Projects/lespeabody.com
      io.docksal.virtual-host: lespeabody.docksal.site,*.lespeabody.docksal.site,lespeabody.docksal.site.*
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - project_root:/var/www:ro,nocopy,cached
version: '2.1'
volumes:
  cli_home: {}
  db_data: {}
  docksal_ssh_agent:
    external: true
    name: docksal_ssh_agent
  project_root:
    driver: local
    driver_opts:
      device: /home/lpeabody/Projects/lespeabody.com
      o: bind
      type: none

---------------------


Output of fin sysinfo:

fin sysinfo output
███  OS
Linux Pop!_OS 20.04
Linux pop-os 5.4.0-7634-generic #38~1592497129~20.04~9a1ea2e-Ubuntu SMP Fri Jun 19 22:43:37 UTC  x86_64 x86_64 x86_64 GNU/Linux

███  ENVIRONMENT
MODE : Linux Kernel
DOCKER_HOST : 

███  FIN
fin version: 1.99.0

███  DOCKER COMPOSE
EXPECTED VERSION: 1.26.0
docker-compose version 1.26.0, build d4451659
docker-py version: 4.2.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

███  DOCKER
EXPECTED CLIENT VERSION: 19.03.9
EXPECTED SERVER VERSION: 19.03.9

Client: Docker Engine - Community
Version:           19.03.12
API version:       1.40
Go version:        go1.13.10
Git commit:        48a66213fe
Built:             Mon Jun 22 15:45:47 2020
OS/Arch:           linux/amd64
Experimental:      false

Server: Docker Engine - Community
Engine:
Version:          19.03.12
API version:      1.40 (minimum version 1.12)
Go version:       go1.13.10
Git commit:       48a66213fe
Built:            Mon Jun 22 15:44:17 2020
OS/Arch:          linux/amd64
Experimental:     false
containerd:
Version:          1.2.13
GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version:          1.0.0-rc10
GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version:          0.18.0
GitCommit:        fec3683

███  DOCKSAL: PROJECTS
project             STATUS                    virtual host                                                                  project root
lespeabodycom       Up 29 minutes (healthy)   lespeabody.docksal.site,*.lespeabody.docksal.site,lespeabody.docksal.site.*   /home/lpeabody/Projects/lespeabody.com

███  DOCKSAL: VIRTUAL HOSTS
�[0;32m*.lespeabody.docksal.site�[0m
�[0;32mlespeabody.docksal.site.*�[0m
�[0;32mlespeabody.docksal.site�[0m
�[0;32msolr.lespeabody.docksal.site.*�[0m
�[0;32msolr.lespeabody.docksal.site�[0m
�[0;32mvarnish.lespeabody.docksal.site.*�[0m
�[0;32mvarnish.lespeabody.docksal.site�[0m

███  DOCKSAL: NETWORKING

DOCKSAL_IP: 192.168.64.100
DOCKSAL_VHOST_PROXY_IP: 
DOCKSAL_DNS_IP: 
DOCKSAL_DNS_DISABLED: 1
DOCKSAL_NO_DNS_RESOLVER: 1
DOCKSAL_DNS_UPSTREAM: 
DOCKSAL_DNS_DOMAIN: docksal.site

Checking connectivity to http://dns-test.docksal.site...
Host: PASS
Containers: PASS

███  DOCKER: RUNNING CONTAINERS
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                    PORTS                                                    NAMES
b363ed8fbe12        selenium/standalone-chrome   "/opt/bin/entry_poin…"   44 minutes ago      Up 29 minutes             0.0.0.0:32813->4444/tcp                                  lespeabodycom_browser_1
0720dc7c0b49        docksal/cli:2.11-php7.3      "/opt/startup.sh sup…"   44 minutes ago      Up 13 minutes (healthy)   22/tcp, 3000/tcp, 9000/tcp, 0.0.0.0:32819->8080/tcp      lespeabodycom_cli_1
20f9a1924c03        docksal/varnish:4.1-2.0      "docker-entrypoint.s…"   41 hours ago        Up 29 minutes (healthy)   80/tcp, 6082/tcp                                         lespeabodycom_varnish_1
3d9ff395f70f        docksal/ssh-agent:1.3        "docker-entrypoint.s…"   4 days ago          Up 4 days (healthy)                                                                docksal-ssh-agent
f73c28495725        docksal/vhost-proxy:1.6      "docker-entrypoint.s…"   4 days ago          Up 4 days (healthy)       192.168.64.100:80->80/tcp, 192.168.64.100:443->443/tcp   docksal-vhost-proxy
0175496ab172        docksal/solr:8.1             "docker-entrypoint.s…"   7 days ago          Up 29 minutes (healthy)   8983/tcp                                                 lespeabodycom_solr_1
2943c0d9b361        memcached:1.4-alpine         "docker-entrypoint.s…"   7 days ago          Up 29 minutes             11211/tcp                                                lespeabodycom_memcached_1
357dd91b2c79        docksal/mysql:5.7-1.5        "docker-entrypoint.s…"   7 days ago          Up 29 minutes (healthy)   33060/tcp, 0.0.0.0:32812->3306/tcp                       lespeabodycom_db_1
4e7af82edcf1        docksal/apache:2.4-2.3       "httpd-foreground"       7 days ago          Up 29 minutes (healthy)   80/tcp, 443/tcp                                          lespeabodycom_web_1

███  DOCKER: NETWORKS
NETWORK ID          NAME                    DRIVER              SCOPE
e79a259c67f9        _default                bridge              local
17182bc97f9a        bridge                  bridge              local
9085aef1bc5a        host                    host                local
eaca95f242b4        lespeabodycom_default   bridge              local
1bc8789e9826        none                    null                local

███  HDD Usage
Filesystem      Size  Used Avail Use% Mounted on
udev            7.7G     0  7.7G   0% /dev
tmpfs           1.6G  2.7M  1.6G   1% /run
/dev/nvme0n1p3  450G   52G  375G  13% /
tmpfs           7.7G  293M  7.4G   4% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/nvme0n1p2  4.0G  2.1G  2.0G  52% /recovery
/dev/nvme0n1p1  498M  294M  204M  60% /boot/efi
tmpfs           1.6G   28K  1.6G   1% /run/user/120
tmpfs           1.6G  124K  1.6G   1% /run/user/1000
/dev/loop5       97M   97M     0 100% /snap/core/9665
/dev/loop6       55M   55M     0 100% /snap/core18/1880
/dev/loop1      145M  145M     0 100% /snap/code/38
/dev/loop0      142M  142M     0 100% /snap/code/39
/dev/loop2       56M   56M     0 100% /snap/core18/1885
/dev/loop3       97M   97M     0 100% /snap/core/9804

@lpeabody lpeabody changed the title Docksal CLI cron not running drush cron per example in documentation Docksal CLI cron not running drush cron per-example in documentation Aug 12, 2020
@lpeabody lpeabody changed the title Docksal CLI cron not running drush cron per-example in documentation Docksal CLI cron not running Drupal cron per-example in documentation Aug 12, 2020
@lpeabody
Copy link
Contributor Author

I updated my crontab with the following line:

* * * * * bash -l -c 'drush --root=/var/www/web status --uri=http://lespeabody.docksal.site > /tmp/site-status.output'

Which generates the following output:

 Drupal version : 9.0.2                                 
 Site URI       : http://default                        
 PHP binary     : /usr/local/bin/php                    
 PHP config     :                                       
 PHP OS         : Linux                                 
 Drush script   : /usr/local/bin/drush                  
 Drush version  : 10.3.1                                
 Drush temp     : /tmp                                  
 Drush configs  : /var/www/vendor/drush/drush/drush.yml 
                  /var/www/drush/drush.yml              
 Drupal root    : /var/www/web                          
 Site path      : sites/default

Running fin exec bash -l -c 'drush --root=/var/www/web status --uri=http://lespeabody.docksal.site' generates this:

 Drupal version   : 9.0.2                                 
 Site URI         : http://lespeabody.docksal.site        
 DB driver        : mysql                                 
 DB hostname      : db                                    
 DB port          : 3306                                  
 DB username      : user                                  
 DB name          : default                               
 Database         : Connected                             
 Drupal bootstrap : Successful                            
 Default theme    : lespeabody_theme                      
 Admin theme      : seven                                 
 PHP binary       : /usr/local/bin/php                    
 PHP config       :                                       
 PHP OS           : Linux                                 
 Drush script     : /usr/local/bin/drush                  
 Drush version    : 10.3.1                                
 Drush temp       : /tmp                                  
 Drush configs    : /var/www/vendor/drush/drush/drush.yml 
                    /var/www/drush/drush.yml              
 Install profile  : lespeabody_profile                    
 Drupal root      : /var/www/web                          
 Site path        : sites/default                         
 Files, Public    : sites/default/files                   
 Files, Temp      : /tmp

I don't know what would be different between the execution environments. Any insight?

@lmakarov
Copy link
Member

I think, you are running into the same issue as in docksal/service-cli#187 (comment).

@lpeabody
Copy link
Contributor Author

Yup, sure am. My database settings are hardcoded into the $databases array in settings.php, but it was stored in a separate file and included in settings.php via:

/**
 * Detect Docksal environment, load settings if it is.
 */
if (getenv('DOCKSAL') && file_exists($settings_dir . '/docksal.settings.php')) {
  include $settings_dir . '/docksal.settings.php';
}

So, getenv('DOCKSAL') would cause this file to not be loaded in a cron-context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants