Skip to content

Commit

Permalink
Updated readme and committed redis configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharvold committed Dec 27, 2015
1 parent 9415c72 commit b88f8ac
Show file tree
Hide file tree
Showing 4 changed files with 922 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ crashlytics.properties
crashlytics-build.properties

# bearchoke customs
database/
database/mongodb
database/redis/var/db/redis/dump.rdb
bearchoke-backend/bearchoke-integration-tests/data
bearchoke-spa/bearchoke-spa-frontend/dist/
bearchoke-spa/bearchoke-spa-frontend/generated/
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ Install [Brew](http://brew.sh/) before you do anything else.
Install Redis using Brew:

$ brew install redis
$ redis-server /usr/local/etc/redis.conf
$ redis-server database/redis/redis.conf

You can start it later as well by using the start script located in the root of bearchoke-tempest called: startService.sh.
You can start it later as well by using the start script located in the root of bearchoke-tempest called: startServices.sh.

## RabbitMQ (required for every type of spring profile)
[RabbitMQ](http://www.rabbitmq.com) is the AMQP implementation used by Spring Integration to broker messages. RabbitMQ is a message broker. The principal idea is pretty simple: it accepts and forwards messages. You can think about it as a post office: when you send mail to the post box you're pretty sure that Mr. Postman will eventually deliver the mail to your recipient. Using this metaphor RabbitMQ is a post box, a post office and a postman. The major difference between RabbitMQ and the post office is the fact that it doesn't deal with paper, instead it accepts, stores and forwards binary blobs of data ‒ messages. RabbitMQ helps in making the architecture event driven.
Expand All @@ -126,7 +126,7 @@ Then you can start RabbitMQ by typing:

$ rabbitmq-server start

You can start it later as well by using the start script located in the root of bearchoke-tempest called: startService.sh.
You can start it later as well by using the start script located in the root of bearchoke-tempest called: startServices.sh.

## MongoDb (required for every type of spring profile)
[MongoDb](http://www.mongodb.org) is a NoSQL database, more specifically known as a "document store".
Expand All @@ -135,11 +135,11 @@ Install MongoDb using Brew:

$ brew install mongodb

I suggest creating a 'database' directory in the root directory of bearchoke-tempest and then starting MongoDb by typing:
Create a 'database/mongodb' directory in the root directory of bearchoke-tempest and then starting MongoDb by typing:

$ mongod --dbpath data/ &
$ mongod --dbpath database/mongodb &

You can start it later as well by using the start script located in the root of bearchoke-tempest called: startService.sh.
You can start it later as well by using the start script located in the root of bearchoke-tempest called: startServices.sh.

## Jpa (required for 'jpa' spring profile)
Jpa is the standard Java Persistence API. To showcase the framework's Jpa support, we're using an in-memory version of [DerbyDb](http://db.apache.org/derby/). There is no installation necessary. Jpa is currently not leveraged in the showcase but the configuration to connect to a local or cloud based db is available to you.
Expand All @@ -158,7 +158,7 @@ Once Node.JS is installed, you can install Lineman by typing this in your Termin
The last requirement for Lineman is that you have [PhantomJS](http://phantomjs.org/download.html) installed and on your PATH.

## Grunt
Once you have installed Lineman, Grunt is next. This one is simple. Just type this in your Terminal / Command Prompt:
Once you have installed Lineman, Grunt is next. Type this in your Terminal / Command Prompt:

$ npm install -g grunt-cli

Expand All @@ -179,7 +179,7 @@ Cloud Foundry:

Finally, the app has been configured to use a custom domain. Please edit your /etc/hosts file and add dev.bearchoke.com. You can verify that the bearchoke-web-frontend web application is running by going to http://dev.bearchoke.com:8080 in your browser.

Next, you have to start the bearchoke-frontend application. Type the following in a new Terminal / Command Prompt window:
Next, you have to start the bearchoke-spa-frontend application. Type the following in a new Terminal / Command Prompt window:

$ cd bearchoke-spa/bearchoke-spa-frontend
$ npm install (will install all dependencies located in package.json)
Expand Down Expand Up @@ -248,7 +248,7 @@ This was a major version bump! A lot of updated code and better way of organizin

## Limitations

* Cloud Foundry does not yet support HTML5 push. You cannot go straight to a url unless it's the root url. E.g. https://www.bearchoke.com is ok. https://www.bearchoke.com/ui/chat is not ok. We developed a custom buildpack for this reason which you can find here: [cloudgate313](https://github.com/cloudgate313/staticfile-buildpack)
* Cloud Foundry does not yet support HTML5 push. You cannot go straight to a url unless it's the root url. E.g. https://www.bearchoke.com is ok. https://www.bearchoke.com/ui/chat is not ok. We developed a custom buildpack for this reason which you can find here: [Custom Static buildpack to support SPAs](https://github.com/bjornharvold/staticfile-buildpack.git)
* Cloud Foundry has a limitation when using your custom domain while using SSL over Cloudflare. If you enable CSRF, it will fail because you will have to use the cfapps.io domain name to reach your web socket services.
* If you're working on a Mac, you might run into an EMFILE warning when running LinemanJS. You need to increase the ulimit size. Please see the FAQ here for more information: [grunt-contrib-watch](http://cnpmjs.org/package/grunt-contrib-watch)

Expand Down
159 changes: 159 additions & 0 deletions database/redis/redis-sentinel.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Example sentinel.conf

# port <sentinel-port>
# The port that this sentinel instance will run on
port 26379

# dir <working-directory>
# Every long running process should have a well-defined working directory.
# For Redis Sentinel to chdir to /tmp at startup is the simplest thing
# for the process to don't interferer with administrative tasks such as
# unmounting filesystems.
dir /tmp

# sentinel monitor <master-name> <ip> <redis-port> <quorum>
#
# Tells Sentinel to monitor this master, and to consider it in O_DOWN
# (Objectively Down) state only if at least <quorum> sentinels agree.
#
# Note that whatever is the ODOWN quorum, a Sentinel will require to
# be elected by the majority of the known Sentinels in order to
# start a failover, so no failover can be performed in minority.
#
# Slaves are auto-discovered, so you don't need to specify slaves in
# any way. Sentinel itself will rewrite this configuration file adding
# the slaves using additional configuration options.
# Also note that the configuration file is rewritten when a
# slave is promoted to master.
#
# Note: master name should not include special characters or spaces.
# The valid charset is A-z 0-9 and the three characters ".-_".
sentinel monitor mymaster 127.0.0.1 6379 2

# sentinel auth-pass <master-name> <password>
#
# Set the password to use to authenticate with the master and slaves.
# Useful if there is a password set in the Redis instances to monitor.
#
# Note that the master password is also used for slaves, so it is not
# possible to set a different password in masters and slaves instances
# if you want to be able to monitor these instances with Sentinel.
#
# However you can have Redis instances without the authentication enabled
# mixed with Redis instances requiring the authentication (as long as the
# password set is the same for all the instances requiring the password) as
# the AUTH command will have no effect in Redis instances with authentication
# switched off.
#
# Example:
#
# sentinel auth-pass mymaster MySUPER--secret-0123passw0rd

# sentinel down-after-milliseconds <master-name> <milliseconds>
#
# Number of milliseconds the master (or any attached slave or sentinel) should
# be unreachable (as in, not acceptable reply to PING, continuously, for the
# specified period) in order to consider it in S_DOWN state (Subjectively
# Down).
#
# Default is 30 seconds.
sentinel down-after-milliseconds mymaster 30000

# sentinel parallel-syncs <master-name> <numslaves>
#
# How many slaves we can reconfigure to point to the new slave simultaneously
# during the failover. Use a low number if you use the slaves to serve query
# to avoid that all the slaves will be unreachable at about the same
# time while performing the synchronization with the master.
sentinel parallel-syncs mymaster 1

# sentinel failover-timeout <master-name> <milliseconds>
#
# Specifies the failover timeout in milliseconds. It is used in many ways:
#
# - The time needed to re-start a failover after a previous failover was
# already tried against the same master by a given Sentinel, is two
# times the failover timeout.
#
# - The time needed for a slave replicating to a wrong master according
# to a Sentinel current configuration, to be forced to replicate
# with the right master, is exactly the failover timeout (counting since
# the moment a Sentinel detected the misconfiguration).
#
# - The time needed to cancel a failover that is already in progress but
# did not produced any configuration change (SLAVEOF NO ONE yet not
# acknowledged by the promoted slave).
#
# - The maximum time a failover in progress waits for all the slaves to be
# reconfigured as slaves of the new master. However even after this time
# the slaves will be reconfigured by the Sentinels anyway, but not with
# the exact parallel-syncs progression as specified.
#
# Default is 3 minutes.
sentinel failover-timeout mymaster 180000

# SCRIPTS EXECUTION
#
# sentinel notification-script and sentinel reconfig-script are used in order
# to configure scripts that are called to notify the system administrator
# or to reconfigure clients after a failover. The scripts are executed
# with the following rules for error handling:
#
# If script exits with "1" the execution is retried later (up to a maximum
# number of times currently set to 10).
#
# If script exits with "2" (or an higher value) the script execution is
# not retried.
#
# If script terminates because it receives a signal the behavior is the same
# as exit code 1.
#
# A script has a maximum running time of 60 seconds. After this limit is
# reached the script is terminated with a SIGKILL and the execution retried.

# NOTIFICATION SCRIPT
#
# sentinel notification-script <master-name> <script-path>
#
# Call the specified notification script for any sentinel event that is
# generated in the WARNING level (for instance -sdown, -odown, and so forth).
# This script should notify the system administrator via email, SMS, or any
# other messaging system, that there is something wrong with the monitored
# Redis systems.
#
# The script is called with just two arguments: the first is the event type
# and the second the event description.
#
# The script must exist and be executable in order for sentinel to start if
# this option is provided.
#
# Example:
#
# sentinel notification-script mymaster /var/redis/notify.sh

# CLIENTS RECONFIGURATION SCRIPT
#
# sentinel client-reconfig-script <master-name> <script-path>
#
# When the master changed because of a failover a script can be called in
# order to perform application-specific tasks to notify the clients that the
# configuration has changed and the master is at a different address.
#
# The following arguments are passed to the script:
#
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
#
# <state> is currently always "failover"
# <role> is either "leader" or "observer"
#
# The arguments from-ip, from-port, to-ip, to-port are used to communicate
# the old address of the master and the new address of the elected slave
# (now a master).
#
# This script should be resistant to multiple invocations.
#
# Example:
#
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh


Loading

0 comments on commit b88f8ac

Please sign in to comment.