Giter Club home page Giter Club logo

alphagov.notifications-paas-autoscaler's Introduction

Notify PaaS Autoscaler

Autoscaling agent for the Notify PaaS applications.

Runs every SCHEDULE_INTERVAL_SECONDS (currently 5 seconds) interval, checks some metrics and sets the desired instance count accordingly.

Installation

mkvirtualenv -p /usr/local/bin/python3 notifications-paas-autoscaler
pip install -r requirements.txt

Running tests

make test

Scheduled scaling

The Autoscaler can scale the worker applications based on a schedule defined in the schedule.yml file.

The format of the file is:

name-of-the-app:
  <workdays|weekends>:
      - HH:MM-HH:MM
      - HH:MM-HH:MM
      - ...
name-of-another-app:
  <workdays|weekends>:
      - HH:MM-HH:MM
      - ...

For example, if you need to schedule the research worker to scale on weekends between 9 in the morning and 2 in the afternoon you would add this to the schedule.yml:

notify-delivery-worker-research:
  weekends:
    - 09:00-14:00

The Autoscaler will scale the specified apps to the number of instances equal to SCHEDULED_SCALE_FACTOR * max_instance_count unless some other metric requires the instance to scale to a higher number (e.g. a large scheduled job)

Debugging

Depending on the problem you're facing you can use different approaches to get more information about it:

  1. You can see any events related to the Autoscaler app using cf events notify-paas-autoscaler. This will show you deployments or restarts
  2. You can tail the logs with cf logs notify-paas-autoscaler or, if Autoscaler has crashed, look into the latest logs with cf logs notify-paas-autoscaler --latest
  3. You can also log onto the box with cf ssh notify-paas-autoscaler and see if there are any exceptions logged in /home/vcap/logs/app.log

Authentication credentials

The application uses a user provided service to read the secret credentials it needs.

Edit the credentials/<env>/paas/service/paas-auto-scaler file in the notify-credentials repository, which has the following format:

{
  "aws_access_key_id": "...",
  "aws_secret_access_key": "...",
  "cf_username": "...",
  "cf_password": "..."
}

Update the PaaS user provided services:

cd .../notifications-aws/paas
make <env> update-services

When you change the service data you have to restage the application (or push it again):

cf restage notify-paas-autoscaler

alphagov.notifications-paas-autoscaler's People

Contributors

sakisv avatar idavidmcdonald avatar leohemsted avatar richardc0 avatar bandesz avatar klssmith avatar allait avatar minglis avatar rjw1 avatar crystalpea avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.