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

Can't set CRON Tasks #15

Open
StarWar opened this issue Sep 21, 2018 · 0 comments
Open

Can't set CRON Tasks #15

StarWar opened this issue Sep 21, 2018 · 0 comments

Comments

@StarWar
Copy link

StarWar commented Sep 21, 2018

I have following boxfile.yml, and I'm not able to set CRON tasks, what should I do to see cron tasks.
currently

[email protected]:~ $ sudo crontab -u gonano -l
no crontab for gonano
[email protected]:~ $ sudo crontab -l
no crontab for root

My boxfile.yaml

run.config:
  engine: ruby
  engine.config:
    runtime: ruby-2.4.2
    postgresql_client_version: "9.6"

  # add extra packages
  extra_packages:
    - nodejs
    - nginx
    - pkgconf
    - libxml2
    - libxslt
    - py36-awscli

  build_triggers:
    - Gemfile
    - Gemfile.lock

#
deploy.config:
  extra_steps:
    - rake assets:precompile RAILS_ENV=production

  before_live:
    web.main:
      - rake db:setup_or_migrate
      - bundle exec whenever --update-crontab

# add a database
data.db:
  image: nanobox/postgresql:9.6
  extra_packages:
    - py36-awscli
  config:
    extensions:
      - autoinc
      - postgis
      - hstore
      - fuzzystrmatch
      - plpgsql
      - pg_stat_statements
  cron:
    - id: backup-production-db
      schedule: '0 * * * *'
      command: |
        date=$(date -u +%Y-%m-%d.%H-%M-%S)
        (
          PGPASSWORD=${DATA_DB_PASS} pg_dump -w -Fc -O -U ${DATA_DB_USER} production |
          gzip |
          tee >(cat - >&4) |
          curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-${date}.sql.gz -X POST -T - >&2
        ) 4>&1 |
        aws s3 cp - s3://${AWS_S3_BACKUP_BUCKET}/${APP_NAME}-backup-${HOSTNAME}-${date}.sql.gz
        curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
        sed 's/,/\n/g' |
        grep ${HOSTNAME} |
        sort |
        head -n-${BACKUP_COUNT:-1} |
        sed 's/.*: \?"\(.*\)".*/\1/' |
        while read file
        do
          curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
          aws s3 rm s3://${AWS_S3_BACKUP_BUCKET}/${APP_NAME}-${file}
        done

# Elasticsearch
data.elasticsearch:
  image: nanobox/elasticsearch:5

# Memcached
data.memcached:
  image: nanobox/memcached:1.4
  config:
    return_error_on_memory_exhausted: false
    max_connections: 1024
    chunk_size_growth_factor: 1.25
    minimum_allocated_space: 48
    maximum_requests_per_event: 20
    disable_cas: false
    max_backlog: 1024
    binding_protocol: 'auto'

# add a web component and give it a "start" command
web.main:
  start:
    nginx: nginx -c /app/config/nginx.conf
    puma: bundle exec puma -C /app/config/puma.rb

  # add writable dirs to the web component
  writable_dirs:
    - tmp
    - log
    - db

  # the path to a logfile you want streamed to the nanobox dashboard
  log_watch:
    rails: 'log/production.log'
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

1 participant