Skip to content

dan-barbulescu/redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redirect

A simple redirect service

Requires

Node.js, MongoDB

Getting started

  1. Get dependencies

    In ./node:

    npm install

  2. Make a copy of ./node/server.config and edit it

    port = port on which the server will be listening

    name = hostname; localhost will NOT work

    db = MongoDB connection string

  3. Add a set of login credentials

    In ./node:

    nodejs -e "require('mongoose').connect('database'); require('./auth.js').create('username', 'password');"

  4. Run the server

    nodejs server.js <your.config>

    You may require root priviledges if you're listening on a port < 1024 (e.g. 80)

  5. Log on

    http://admin\.\<name.of.server>[:<port>]/

  6. Create/edit/delete redirects

    Each redirect has a hex code

  7. Try them out

    http://<name.of.server>[:<port>]/<code>

    If no code is specified, a random one will be used

  8. Have fun!

wabbit

A lightweight daemon that forwards data from MongoDB to RabbitMQ

Requires

boost, MongoDB C++ Driver (26compat), RabbitMQ C AMQP client library

Getting started

  1. Get dependencies, compile dependencies

  2. Compile main.cpp

    Remember to set the lib and include paths to include the dependencies if you haven't installed them for system-wide availability

  3. Make a copy of ./wabbit/wabbit.config and edit it

    seconds = how often to check and forward data, if any

    database = MongoDB host

    query = MongoDB collection (e.g. <database>.<collection>)

    hostname, port = RabbitMQ server

    vhost = RabbitMQ vhost name

    username, password = optional, RabbitMQ login credentials

    queue = RabbitMQ queue name

    skip = optional, fields to skip when forwading data, whitespace-separated

  4. Start wabbit

    ./wabbit <your.config>

    You can run as many instances as you want; it would be a good idea to have different config files for them

    You can check for errors in the system log:

    grep wabbit /var/log/syslog

    Configuration errors are non-recoverable; other errors will NOT prevent it from running and attempting to forward data with the set frequency

  5. Control wabbit

    killall -SIGHUP wabbit

    HUP will cause wabbit to reload the configuration file; same as above, a config error will cause it to stop

    killall -SIGTERM wabbit

    TERM will cause wabbit to stop gracefully as soon as possible

About

A simple redirect service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published