actionhero

Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks

APACHE-2.0 License

Downloads
14.5K
Stars
2.4K
Committers
127
actionhero -

Published by evantahler over 11 years ago

  • fix a bug with web socket sequencing for responses
actionhero -

Published by evantahler over 11 years ago

  • allow for api.configData.webSockets.options to contain a hash of settings to be bound to the websocket initializer (along with .settings which remains an array)
  • explicit call of node in package.json to enable project to run on windows
  • added a generator for initializers @ npm run-script actionHero generateInitializer
  • create a template readme file when generating a new project
  • enable you to add custom initializers in your project
actionhero -

Published by evantahler over 11 years ago

  • bug fixes and spelling mistakes corrected
actionhero -

Published by evantahler over 11 years ago

Boot

  • actionHero will now manage the starting/stopping of your applicaiton for you
  • this means that there is no more 'main' or 'app.js' file for your projects
  • you can still include and start an actionHero server programatically, and actionHero is now a prototypical object

actionHero Binary

  • refactor of scripts into a general actionHero executable which can be found in ./node_modules/actionHero/bin/actionHero and ./node_modules/.bin/actionHero after npm install actionHero
  • allows you to start your server with actionHero start and actionHero startCluster from your project's root
  • actionHero start can be passed many options, including --config=[file] which will allow you to specify other config.json(s) (IE: for development/staging envrionments)
  • you can learn more about the new CLI with actionHero help

core API

  • (breaking) actionHero itself is now a prototypical object to facilitate multiple servers in one app (testing)
  • if an external IP cannot be determined, 'actionHero' will be the api.id base name
  • actionHero will now set pidFiles for each server, and attempt to delete them on shutdown
  • (breaking) params.initFunction no longer exists. Please use a propper initializer instead
  • better creation of pid files for running servers

clients

  • a better client example for the browser (ajax/jsonp)
  • moved websocket client to it's own includable js file (for browsers). look for it in examples/clients/web/actionHeroWebSocket.js

Other

  • ensure that the file action / public path cannot be used to server files outsite of /public
  • dependency updates
actionhero -

Published by evantahler over 11 years ago

Binary

  • better support for running the actionHero binary globally
  • when generating a new project, the actionHero version will be locked
  • actionHero generate will create a _project.js initializer
  • you can now daemonize all of the actionHero commands (start, startCluster) with the --daemon. This will background the server or cluster
  • the actionHero server can now respond to basic unix signals (USR2 will restart, and KILL/INT will try a more graceful shutdown)
  • general cleanup for the binary commands

actions

  • you can now define more than one action or task in a file, like this:
  exports.userAdd = {
    name: 'userAdd',
    description: 'i add a user',
    inputs: {
      required: ['email', 'password'],
      optional: []
    },
    outputExample: {},
    run: function(api, connection, next){
      // your code here
      next(connection, true);
    }
  };

  exports.userDelete = {
    name: 'userDelete',
    description: 'i delete a user',
    inputs: {
      required: ['email', 'password'],
      optional: []
    },
    outputExample: {},
    run: function(api, connection, next){
      // your code here
      next(connection, true);
    }
  }

config

  • the name of the log file is now based on the process name, to match the pidFiles

general

  • uppon sever shutdown, all connected TCP clinents will recieve the message: {"status":"Bye!","context":"response","reason":"server shutdown"}
actionhero -

Published by evantahler over 11 years ago

Status Codes

  • For HTTP(S) clients, you can now toggle api.configData.commonWeb.returnErrorCodes, which when enabled will only return the http status code 200 for truly sucessful request (conneciton.error== null), and an error HTTP response header when there is an error.
  • You can now set connection.responseHttpCode in your actions to indicate a specific HTTP error code for each request if something goes wrong.
  • The default connection.responseHttpCode when api.configData.commonWeb.returnErrorCodes is enabled is 400 (bad request).
  • If you request an action that doesn't exist in the mode 404 (Bad Request).
  • If you request an action without all the required params 422 (Unprocessable Entity).
actionhero -

Published by evantahler over 11 years ago

initializers

  • you can now define api.{module}._teardown in any api module to be called at shutdown.
  • _teardown(api, next) will passed to this method
  • a _teardown method is not required

Bugs

  • fix duplicate headers sometimes returned to http(s) clients
  • fixed logging for actionCluster
  • fixed SIGWINCH so only daemonized clusters can use it
  • added in a sweeper for api.cache, so that expired values will be deleted eventually
  • better locking out of internal timers when the cluster is off
actionhero -

Published by evantahler over 11 years ago

Bugs

  • fix a sweeper bug introduced in the previous version
actionhero -

Published by evantahler over 11 years ago

socket server & web sockets

  • connections can regester to be notified about messages in chatRooms they are not currently in with listenToRoom and silenceRoom. You still need to be in a room to say and interact with the room, but this will allow clients to register for additional events.
  • various commands have had the room paramite added to thier responses to allow for clarity in the above situation.
  • the rooms that a connection is (optionally) additionally interseted in is saved at connection.additionalListiningRooms
  • you can limit the number of actions the server will process at a time for a connection with api.configData.general.simultaniousActions. Defaults to 5

bugs

  • when shutting down the socket-server, if a connection doesn't close withing 5 seconds (a pending action), the connection will be disconnected forcibly
  • fixed a bug where messageCount would be overwritten in proxy connections for long-lasting actions
  • file server now uses pipe as to not require loading all of the file's content into ram to serve the file
  • webserver no longer requires the 'file' action to exist
  • removed the 'file' action, as it was confusing, and duplicated core functionality of the web server
  • ctrl+c and ctrl+d will now properly exit a telnet (TCP) session to an actionHero server
actionhero -

Published by evantahler over 11 years ago

initializers can now have a _start(api, callback) method which will be invoked when the server boots.

Bugs

  • api.tasks.inspect has been renamed api.tasks.inspectTasks as to work with console.log and util.inspect
  • api.cache actions now force a domain binding when used within an action or task. This will help broken actions not to crash the server. This is needed until the redis package is updated to support domains (Thanks @othiym23)
  • Typo corrected in api.configData.general.pidFileDirectory
  • Other spelling fixes (Thanks @jacobbubu)!
actionhero -

Published by evantahler over 11 years ago

Bugs

  • Typo: additionalListiningRooms -> additionalListeningRooms
  • Convert all tabs to spaces, for those of us who are OCD (me)
  • updates to the actionHeroWebSocket
actionhero -

Published by evantahler over 11 years ago

Tasks

  • Tasks will no longer be 'popped' from a queue, but rather slid from queue to queue. This makes it much harder to loose a task

  • There is no longer a need for a periodc task reloader because of the above

  • Tasks can now be easily inspectd, and have been included in the status task

  • Please check the wiki for new task syntax:

    var task = new api.task({
      name: "myTaskName",
      runAt: new Date().getTime() + 30000, // run 30 seconds from now
      params: {email: '[email protected]'}, // any optional params to pass to the task
      toAnnounce: true // to log the run of this task or not
    });
    
    task.equeue(function(err){
      // enqueued!
    })
    

Stats

  • Stats system has been overhaled to have both local and global tasks kept for the cluster
  • the status action now reflects the global status and local status for the server queried
  • Please check the wiki for new syntax:

api.stats.increment(api, key, count, next)

  • next(err, wasSet)
  • key is a string
  • count is a signed integer
  • - this method will work on local and global stats

api.stats.set(api, key, count, next)

  • next(err, wasSet)
  • key is a string
  • count is a signed integer
  • this method will only work on local stats

api.stats.get(api, key, collection, next)

  • next(err, data)
  • key is a string
  • collection is either:
    • api.stats.collections.local
    • api.stats.collections.global

api.stats.getAll(api, next)

  • next(err, stats)
  • stats is a hash of {global: globalStats, local: localStats}
actionhero -

Published by evantahler over 11 years ago

General

This release changes (simplifies) a number of APIs, but it does introduce changes. Please read the wiki, specifically the API methods page, to learn the new syntax for various methods.

  • circular references are bad... remove all functions that require api to be passed in (mainly the API object)
  • change initializer names to remove (init)
  • object-ize connections, append connection-type prototypes in the server setups
  • remove connection classes from utils
  • remove global 'requires' from the API object, put them in the initializers that need them
  • remove the notion of 'public' from connection objects
  • server shutdown needs to clear its connections from the chatrooms
  • delayed tasks which are older than 1 min should be checked against the various queues to be sure exist
  • fix http message request so that all pending messages are returned
  • general project organization
actionhero -

Published by evantahler over 11 years ago

Allowing support to limit the connection.type for which an action if valid for. Define the array of action.blockedConnectionTypes = ['socket', 'webSocket'] for example to not allow access from TCP or webSocket clients. Not defining the array will allow all client types in.

actionhero -

Published by evantahler over 11 years ago

Bugs

  • fixes to boot order and booting withoug an IP address (external)
  • fix to booting actionCluster
  • use actionName from definition rather than file name (thanks @Macrauder)
  • logging fixes for tasks
  • boot order regarding logging
  • task load messaging
  • runAction task crashes
  • Fix a form parsing bug for web clients
actionhero -

Published by evantahler over 11 years ago

logger

  • actionHero is now using the winston logger: https://github.com/flatiron/winston. This will allow for better, more customizable logging.
  • The api.configData.log is replaced with api.configData.logger
  • You can now specifiy all the logging options and transports in api.configData.logger.transports
  • You will probably want to define your transports in functions(api) so that you can evaluate them later and get things like api.id to use in your file names
  • The notion of 'coloring' output has been removed, and replaced with more standard log-levels
  • actionHero's log levels: 0=debug, 1=info, 2=notice, 3=warning, 4=error, 5=crit, 6=alert, 7=emerg
  • api.log(message, severity, data) is the new syntax
  • you can access winston directly at api.logger

tasks
!!! It is likley you will loose access to previously enqueued tasks with this upgrade

  • fixes to the delayed task system
  • delayed tasks now occupy thier own timestamp'd queue
  • periodic tasks now have a specific hash to deonte if they have been enqueued already or not

webserver

  • Support for grouped action names added (thanks @Macrauder)

core

  • the actionHero server will not exit until any currently processing tasks are compelte
  • This may effect forever adversley

cluster

  • when running in a cluser, the child processes will ignore all signals passed in from the parent
  • the timeout for closing a worker has been increased to a minute to allow for tasks to complete
actionhero -

Published by evantahler over 11 years ago

bugs

  • callbacks from actions with toRender = false now are respected properly
  • api.actions is now a collection for all things action, and api.actions.actions contail the list of actions
  • seperating taskProcessor methods to prepare to work on memory leaks

cluster

  • fix logging of master when daemonized
  • fix daemon server from not being able to detach
  • disable renaming of the running process. This was not consistant across various operating systems and was confusing.
actionhero -

Published by evantahler over 11 years ago

Binary

  • the default action for the actionHero binary is now start rather than help

config

  • for compatibility, only the "http" server will be on at boot
  • directory creation is now part of the example file logger

Bugs

  • listenToRoom and silenceRoom for websocket clients will not properly modify the messageCount id in the response object
actionhero -

Published by evantahler over 11 years ago

webServer

General

  • normalized all connection times to have a connection.sendMessage(message,type) method which can be used globally. This will allow you to send a message to any connection directly without messing with chatrooms
  • there were too many commas (@mmadden)
  • api.webSockets renambed to api.webSocketServer to be consistant with other servers
  • reordered shutdown proess to help with stats (https://github.com/evantahler/actionHero/issues/109)
  • action and task generators now generate hash style files

Web Sockets

  • Will be sent a message on server shutdown

Tasks

  • if toAnnounce is false, we will no silence the act of enquing delayed versions of this task (@macrauder)
actionhero -

Published by evantahler over 11 years ago

General

  • removed support for node versions < v0.8.0. Time to modernize!
  • added support for node versions 0.9 and 0.10
  • actionHero now uses fakeredis rather than implementing certain operations locally (cache, tasks)
    • thanks to @hdachev for all his help!
    • this allows for a smaller, more unified codebase
    • redis is now always 'enabled', but fake can be toggled (boolean)
  • actionHero now uses the Faye messaging system
    • this replaces socket.io for websocket clients
    • this replaces actionHero's internal methods for redis pub/sub
    • please checkout the wiki for API changes

Note

  • At this time, we are using the master branch directly of faye-redis, and not the version of NPM. This is likely to be unstable. Use with caution!

Config

  • In addition to passing --config=/path/to/file to specifiy a config.js to actionHero, you can also set the ACTIONHERO_CONFIG envrionment variable.