Skip to content

Service - Runs tasks at a schedule.

License

Notifications You must be signed in to change notification settings

starpep-web/cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cron (Service)

This repository contains the code for a service meant to run at a schedule. It contains tasks/jobs that will be run every now and then at specific intervals or dates.

Currently you'll find tasks for:

  • Cleaning up the export archives created by the api-bio service.
    • This task will run every hour and reads the exports in Redis and compares it to the ones in the exports directory, deleting those in the filesystem that do not exist in Redis anymore.

Requirements

In order to develop for this repository you need:

Development

First, clone this repository:

git clone https://github.com/starpep-web/cron

Install the dependencies:

bundle install

Create an .env file with the following contents:

REDIS_URI=redis://localhost:6379
TEMP_ARTIFACTS_LOCATION=/path/to/artifacts

Run the src/main.rb script:

ruby ./src/main.rb

If you prefer to run the task directly, feel free to edit src/test.rb file and run that one instead.

Building

If you're developing this on your local machine, consider building the Docker image with the following command:

docker build -t local-starpep/cron:latest .

You can create a new container to try it out with the following command:

docker run -it --rm -e REDIS_URI=redis://localhost:6379 -e TEMP_ARTIFACTS_LOCATION=/path/to/artifacts local-starpep/cron:latest

Production

Consider checking this docker-compose.yml for an example on how to run this image in production.

About

Service - Runs tasks at a schedule.

Resources

License

Stars

Watchers

Forks

Packages