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 - v6.3.0: Cluster Fixes and More

Published by evantahler about 11 years ago

  • Updates to the actionHero start and actionHero startCluster
    • simplified and homogenized actionHero start
    • fixed an issues where actionHero startCluster's workers would become unresponsive, especially when running in daemon mode
    • defaulted config.js to not have slaves log when running in cluster (this was a contribution to the unresponsive problem above)
  • Remove setIp and setPort as verbs
    • it is the server's responsibility to determine these (if required)
    • the websocket server has been updated to get these from faye's internals
    • the actionHeroWebsocket.js client-side js has been updated to not need to use these verbs
  • provide a minimized actionHeroWebsocket.js
  • fix api.utils.hashmerge to not mangle buffers
    • this fixes an issue where certificates were passed as streams to https and tls options in config.js
  • fix an issues with file loggers
    • upgrade version of winston
    • requires custom log level definitions to remain consistant
  • task workers will not start a new job if sever is mid-shutdown
  • fix the issue when the parts of the url are lower parts of the routes (@norman784)
  • allow server to boot if there no active servers
  • documentation and project mapping updates
  • and other bugfixes
actionhero -

Published by evantahler about 11 years ago

  • change the way that secure server's options are defined.
    • in config.js, you can now define serverOptions for web and socket servers. This hash will be passed directly to https.createServer and tls.createServer
    • be sure to define your certificate options within serverOptions
    • removed the previous way of defining SSL certificate information=
  • when generating a new actionHero project, configData.general.apiVersion will start at 0.0.1 rather than match actionHero's release version as it has done previously.
actionhero - asset path depth

Published by evantahler about 11 years ago

  • bug fixes
  • allow for the public path to accessed at depth. For example, you can now set configData.servers.web.urlPathForFiles = "/myProject/assets" rather than just "assets".
actionhero - v6.2.5: Squashing bugs

Published by evantahler about 11 years ago

  • Typos
  • Allow for relative or local path when describing which config.js to use at boot (--config=/path/to/file)
  • static example site enhancements
actionhero - v6.2.4

Published by evantahler about 11 years ago

postProcessAction

Change the middleware postProcessAction so that we can modify toRender. This changes the syntax of a postProcesser to be:

api.actions.postProcessors.push(function(connection, actionTemplate, toRender, next){
  next(connection, toRender);
});

if you set toRender = false; your client will get no response unless you define a new response.

Misc & Bugs

  • compartmentalize web sever response logic so that it can more easily be overwritten.
  • remove unneded nextTick's from the web and file server. This will help with file server issues in node < 0.10.x
actionhero - v6.2.3: Implicit API Documentation

Published by evantahler over 11 years ago

API Documentation

actionHero will now provide API documentation to all web clients who visit the /api route with no parameters (GET only). Other clients can request this information with the documentation verb.

All actions and their metadata will be returned by this response. To hide an action, set action.toDocument = false.

This deprecates the actionsView action.

other

  • removed actionsView from project & generator
  • removed 'chat' action from project & generator
  • actionHeroWebSocketClient has been updated to provide support for the new documentation verb
  • fixed bugs in action & task validator
  • public index.html page updated to use new documentation and support Action versions
actionhero - v6.2.2: Chunked Trasnfer Encoding and Pretty-Printing for web server

Published by evantahler over 11 years ago

The title says it all!
This is a minor bug-fix release

actionhero - v6.2.1: Jake tasks

Published by evantahler over 11 years ago

actionHero now integrates with jake (javascript make) to allow you to run manual jake tasks within actionHero's environment. Those of you coming from Ruby, jake is very similar to rake.

This release replaces the short-lived actionHero run binary.

To use jake, you should install jake globally npm install -g jake or you can use it locally by adding it to you package.json

actionHero will generate a few example jake tasks in ./jakelib/actionHero.jake to help you save and restore the cache. Most importantly, the actionHero:envrionment task is defined for you. Require this in all of you tasks so you can have access to the api object within your tasks. You will have access to all of your initialized, actions, and tasks within the api object. api will represent an initialized sever, but not a started one. Your initializer's "_start" methods will not be run, not will the servers be started. For example:

desc("my actionHero jake task");
task("myTask", {async: true}, function(){
  var api = jake.Task["actionHero:envrionment"].value;
  // your logic here
  complete(process.exit());
});

As always, you can list your project's jake tasks with jake -T

> jake -T

jake actionHero:environment    # I will load and init an actionHero environment
jake actionHero:actions:list   # List your actions and metadata
jake actionHero:redis:flush    # This will clear the entire actionHero redis database
jake actionHero:cache:clear    # This will clear actionHero's cache
jake actionHero:cache:dump     # This will save the current cache as a JSON object
jake actionHero:cache:load     # This will load (and overwrite) the cache from a file

You can learn more about jake here.
You can view actionHero's default jake tasks here

actionhero -

Published by evantahler over 11 years ago

Version 0.1.7

Summary: This release prepares for multiple DB types and changes the cache to be in-memory

Details:

  • Be careful not to waste all your ram with the in-memory cache!
  • All DB connection options must define: api.rateLimitCheck = function(api, connection, next) which will be used in all web connections. It should return requestThisHourSoFar (int)
  • Reminder: You can add DB specific by adding your task to the api.taks object
  • Your DB init function should be called init and be exported. init = function(api, next)
  • Name your DB init file the same thing you want folks to use in api.configData.database.type
  • It is now easier to use actionHero without any database as well.

Version 0.1.6

Summary: This release changes the way that actions and files are routed

Details:

  • Mode Routing
    • /file and /api are now routes which expose the 'directories' of those types. These top level paths can be configured in config.json with api.configData.urlPathForActions and api.configData.urlPathForFiles.
    • the root of the web server "/" can be toggled to serve the content between /file or /api actions per your needs api.configData.rootEndpointType. Versions prior to this can be thought of as always choosing /api as the default. The default is api.
    • /file now works for socket connections. The raw contents of the file will be streamed back to the client upon success. Rather than sending HTTP headers on errors, a string messages in the normal way will be sent upon error.
    • file is still an action, but its logic is moved into the code API. Socket connections will only be using /api/ as their endpoint.

Version 0.1.5

Summary: This release contains a number of fixes for socket clients and some minor task updates.

Details:

  • Contexts
    • When connected via Socket, knowing the context of a message you receive is important. All messages sent back to the client should include context in the JSON block returned.
    • For example, by default all actions set a context of "response" indicating that the message being sent to the client is response to a request they sent. Messages sent by a user via the 'say' command have the context of user indicating they came form a user. Every minute a ping is sent from the server to keep the TCP connection alive and send the current time. This message has the context of api. Messages resulting from data sent to the api (like an action) will have the response context.
    • Be sure to set the context of anything you send! Actions will always have the response context set to them by default.
  • Keep Alive
    • A new default task now will send a 'keep alive' message to each connected socket connection. This will help with TCP timeouts and will broadcast the server time each task cycle( default 1 min ).
    • Per the above, the message has the api context.
  • paramsView and paramView
    • params are now passed back wrapped in a params object.
  • Response Counts
    • Socket connections will have every message sent to them counted, and every message sent will have the messageCount value set. This will help clients keep messages in order.
  • Better client id hashes
    • Every socket client has an connection.id set for them. This is used by the say command and should be used by any other method which needs to identify one user to another. This way, the user's IP and port can be kept secret, but you can have a unique id for each user. Updates to how this hash is generated (now via MD5).
  • Minor refactoring to the task framework to add task.log() as a method to help with formatted output.
  • The task to clean the log file will now inspect every file in ./logs/ to check if the files have gotten too large.
  • Documentation Updates
    Every
    • This file!
    • readme.markdown
    • project website (branch gh-pages)

Versions <= 0.1.4

Sorry, I wasn't keeping good notes :(

actionhero -

Published by evantahler over 11 years ago

Summary: This release introduces the actionCluster!

Details:

actionHero can be run either as a stand-alone server or as part of a cluster. When running in cluster mode, the api will make use of the actionCluster methods. Features of an actionCluster:

  • ring-based communication. Lists of peers are shared among all members of the actionCluster, and each member communicates directly with all other members. This allows any member of the cluster to fail and the cluster to continue.
  • reconnection. Peers will always attempt to reconnect to disconnected peers
  • cluster security. Each actionCluster has a unique membership phrase api.configData.actionCluster.Key defined by you
  • shared messaging: the say socket command will message all clients in the same room in all peers. roomView will aggregate information for all peer's connections
  • shared or individual configuration for each peer.
  • Shared memory objects!
    • actionHero's single-node cache, api.cache is extended when operating in an actionCluster to allow for you to simply create redundant in-memory objects which can be accessed by any member of the cluster, even a peer which doesn't hold any of the data being accessed.
    • Object duplication. Using api.configData.actionCluster.nodeDuplication, you can ensure that your cached objects will be present on n peers to survive the crash of a peer. In the event a peer goes down, the remaining peers will reduplicate the object in question
actionhero -

Published by evantahler over 11 years ago

Summary: This is a general cleanup release

Details:

  • Removed the notion of (http) sessions from the project, as they are not core to this api. Simpler code!
  • better test page (public/index.html) which shows a simple example of how to parse output from the API.
  • Stats calculation now works across the actionCluster and is moved to an initializer
  • cleanup to lots of methods for better encapsulation
  • all files in the initialization directory will now be loaded automatically, however their execution will still remain manual (to enforce load order)
  • note: with api.cache, the _stats and _roomStatus keys are reserved for the system
actionhero -

Published by evantahler over 11 years ago

Summary: This release adds additional functionality to the actionCluster and Cache

Details:

  • Both api.actionCluster.cache.load and api.cache.load now both return 4 values, (value, expireTimestamp, createdAt, readAt). This new information can be used to avoid race conditions if another peer has recently accessed a saved object.
  • Reading a object with the corresponding load command will update the readAt value.
  • A pretty new example html in /public/ which will demonstrate the showActions method
  • npm tests for the cluster
  • actionHero.stop(next) and actionHero.restart(next) added to api
actionhero -

Published by evantahler over 11 years ago

Summary: This is a general cleanup release

Details:

  • The cache will now write its contents to disc periodically, as defined by the tasks.saveCacheToDisk task. The api will also attempt to load in a cache file on boot.
  • If you application needs to manage more than one instance of an actionHero test, you can call require('actionHero').createActionHero() rather than require('actionHero').actionHero. createActionHero() will return a new instance of a server each time rather than a shared object.
actionhero -

Published by evantahler over 11 years ago

Summary: Goodbye Rate Limiting; Hello validators, and XML

Details:

  • You can now request XML output rather than json. Pass outputType=XML to the api
  • Actions will be checked for the proper variables and methods.
  • Actions' required params will be automatically checked for existence.
  • Removed anything to do with rate-limiting. I don't think that anyone was using it anyway. This really isn't a core feature and was causing trouble at the DB layer.
    • api will no longer return details of requests remaining
    • DBs no longer need to build the api.rateLimitCheck method
  • npm start can not be used to stat an example actionHero server
actionhero -

Published by evantahler over 11 years ago

Summary: Goodbye Databases & Models, hello other versions of Node!

Details:

  • You can now use actionHero on node.js version 5 upwards (including the new v0.7)
  • In order to keep actionHero as compartmentalized as possible, we have removed databases and models.
    • There are tons of great ORMs and drivers for node. When deploying actionHero in production, I expect that you will make use of them. However, requiring database integration with actionHero is no longer a core part of the framework. The previous DB connection support was too specific to my test implementations to be useful for everyone.
    • This makes previous implementations of actionHero incompatible with versions > 0.2.4.
      • I'm sorry, but that's the price of progress!
  • The location where the cache is saved and loaded from is configurable in config.json via api.configData.cache.cacheFolder and api.configData.cache.cacheFile
actionhero -

Published by evantahler over 11 years ago

Summary: Cluster Task Managment

Details:

  • rewrite of the task system to be more like actions
  • tasks now live in ./tasks/ in your application root
  • tasks can now have their own specific timers
  • tasks are now scoped to be "any" or "all", to run once per actionCluster (any) or on all nodes (all)
  • Default tasks within the api are now better explained:
    • calculateStats
      • Polls all other members in the actionCluster to build up statistics
      • Runs every 10 seconds
    • cleanLogFiles
      • removes all files in ./log/ if they are larger than api.configData.maxLogFileSize
      • runs every 60 seconds
    • cleanOldCacheObjects
      • removes expired objects in api.cache.data
      • runs every 10 seconds
    • pingSocketClients
      • sends a keep-alive message to all TCP socket clients
      • runs every 60 seconds
    • runAction
      • a wrapper to run an action as a task
      • will not run automatically
    • saveCacheToDisk
      • will save the contents of api.cache.data to disc
      • runs every 60 seconds
actionhero -

Published by evantahler over 11 years ago

Summary: OMG 1.0!

Details:

  • initializers
    • you can add your own initializers to a folder called initializers in your project's root. They will be loaded at boot and accessible like this:
      • actionHero.myNewInitFunction(api, function(){ next(); });
  • This is a cleanup and bug-fix release
  • After some refactoring, actionHero is now at v 1.0
  • The last message sent by a socket client can now be read by inspecting connection.lastLine
  • Better error handling if the socket / web port are in use
  • Cleanup of the example HTML pages
  • HTTP requests will now return serverInformation.currentTime
  • The original server (the one with no configData.actionCluster.startingPeer will be the only server to run 'any' tasks)
    • Other servers will NOT assume the role of running "any" tasks, but they will keep them in memory until the master server comes back upon a crash.
  • Using the node-mime module
  • Adding 10 min cache-control to flat files
actionhero -

Published by evantahler over 11 years ago

** SSL / HTTPS web server **

Details

  • You can now spin up a secure https server along with you http server in action hero. It will work exactly the same as the http server, and you can have both on at the same time with no overhead.
    • There are new configuration settings in config.json for this below

Settings for https server:

"secureWebServer" : {
"port": 4443,
"enable": true,
"keyFile": "./certs/server-key.pem",
"certFile": "./certs/server-cert.pem"
},

actionhero -

Published by evantahler over 11 years ago

** Task Sharing **

Details

  • The master process will now delegate tasks in his queue to other peers in the cluster.
  • Minor bug fixes
actionhero -

Published by evantahler over 11 years ago

** Optional Headers **

Details

  • You can now define custom host-headers in config.json which will be sent with every http/https response
  • bug fixes introduced with task sharing (v 1.0.1)