Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
document development environment and allow fig
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Cichra committed Nov 28, 2014
1 parent 1cf777e commit a7ed32b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
@@ -1,4 +1,4 @@
PROJECT := $(subst @,,$(notdir $(shell pwd)))
PROJECT := $(subst @,,$(notdir $(shell pwd)))_monitor
NAME = $(PROJECT)-build
RUN = docker run --rm --env CI=jenkins

Expand All @@ -11,8 +11,8 @@ pull :

test : clean
$(RUN) --name $(NAME) $(PROJECT)
bash :
$(RUN) -t -i -v $(shell pwd):/opt/slug $(PROJECT) bash
bash : build
$(RUN) -t -i -v $(shell pwd):/opt/slug $(PROJECT) script/docker.sh
build :
docker build -t $(PROJECT) .

Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -20,6 +20,12 @@ You will need running redis server.
# Tests
We have several test suites for differrent components. First are API tests that require `ruby` and you can run them by `rake test:api`. You need to have an instance running on ports 7071 and 10002. Then there is `rake test:integration` which runs cucumber tests with real browsers simulating user interactions. Next are `rake test:lua` which are lua tests. They require openresty version at least `1.7.4.1`. Last are Angular tests, that require `nodejs`. You can install all dependencies by `npm install` and then just `rake test:angular`.

## Docker

You can use [fig](http://www.fig.sh/index.html) to start the developer environment.
Or you can use our `make bash` to start similar environment without fig.


## Installing Openresty


Expand Down
2 changes: 2 additions & 0 deletions config/env.conf
Expand Up @@ -13,10 +13,12 @@ env SLUG_CSRF_PROTECTION;

env SLUG_BRAIN_HOST;

env REDIS_PORT_6379_TCP_ADDR;
env SLUG_REDIS_DUMP_FOLDER_PATH;
env SLUG_REDIS_HOST;
env SLUG_REDIS_PORT;

env STATSD_PORT_8125_TCP_ADDR;
env SLUG_STATSD_SERVER;
env SLUG_STATSD_PORT;

Expand Down
15 changes: 15 additions & 0 deletions fig.yml
@@ -0,0 +1,15 @@
redis:
image: redis:latest
monitor:
build: .
command: bash -c 'bundle config without "" && bundle install && bundle exec foreman start'
volumes:
- .:/opt/slug
environment:
RELEASE: development
SLUG_ENV: development
ports:
- 7071
- 10002
links:
- redis
2 changes: 1 addition & 1 deletion lua/concurredis.lua
Expand Up @@ -31,7 +31,7 @@ local expand_gmatch = function(text, match)
return result
end

concurredis.host = os.getenv("SLUG_REDIS_HOST")
concurredis.host = os.getenv('REDIS_PORT_6379_TCP_ADDR') or os.getenv("SLUG_REDIS_HOST")
concurredis.port = os.getenv("SLUG_REDIS_PORT")
concurredis.port = concurredis.port or 6379

Expand Down
4 changes: 2 additions & 2 deletions lua/statsd_wrapper.lua
Expand Up @@ -12,9 +12,9 @@ local statsd_null = {
local function get_instance()
if not ngx.ctx.statsd_instance then
local instance
local statsd_server = os.getenv('SLUG_STATSD_SERVER')
local statsd_server = os.getenv('STATSD_PORT_8125_TCP_ADDR') or os.getenv('SLUG_STATSD_SERVER')
if statsd_server then
local statsd_port = os.getenv('SLUG_STATSD_PORT')
local statsd_port = os.getenv('SLUG_STATSD_PORT') or 8125
local Config = require 'models.config'
local instance_id = Config and Config.get_slug_name(true) or 'no_host'
local env = os.getenv('SLUG_ENV') or 'dev'
Expand Down
2 changes: 1 addition & 1 deletion script/docker.sh
Expand Up @@ -4,4 +4,4 @@ set -e
redis-server > /dev/null &
dotenv openresty -p release -c config/nginx.conf &

exec script/jenkins.sh
exec script/jenkins.sh bash
2 changes: 1 addition & 1 deletion script/jenkins.sh
Expand Up @@ -7,4 +7,4 @@ export SLUG_REDIS_HOST=127.0.0.1

eval $(luarocks path) # include luarocks load paths

exec bundle exec rake integrate
exec bundle exec ${1-"rake integrate"}

0 comments on commit a7ed32b

Please sign in to comment.