Skip to content

Commit

Permalink
Merge pull request #22 from KillrVideo/dse_env_var
Browse files Browse the repository at this point in the history
Support for DSE Contact Points Env Variable
  • Loading branch information
SonicDMG authored Aug 13, 2019
2 parents 0b30311 + 3953ec1 commit 3b50296
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ babel. After cloning the repo, you'll need to pull images, install all dependenc
>
> # Install dependencies & build code for the server & client parts
> docker-compose run --no-deps -e NODE_ENV=development web npm install
> docker-compose run --no-deps -e NODE_ENV=development web npm run install:client'
> docker-compose run --no-deps -e NODE_ENV=development web npm run install:client
> docker-compose run --no-deps web npm run build
>
> # Run the project
Expand All @@ -44,6 +44,29 @@ This will clean, do a build with webpack and babel, and watch the files for chan
VS Code for development, the tasks checked into the repo should allow you to start the server
with debugging using `F5`.

## Environment Variables

To change behaviour of the application you can configure environment variables in docker-compose file. For example, you can configure the application to work with your own cassandra cluster instead of the 'built-in' dockerized one. Add the variable to a docker-compose file like here:
```
version: '3'
services:
web:
...
environment:
KILLRVIDEO_DSE_CONTACT_POINTS: 192.168.15.17
```

### Available Environment Variables
```
Logging Level KILLRVIDEO_LOGGING_LEVEL verbose
YouTube API Key KILLRVIDEO_YOUTUBE_API_KEY REPLACE_WITH_YOUR_KEY
Session Secret KILLRVIDEO_SESSION_SECRET THE_INTERNET_IS_FULL_OF_CAT_VIDEOS
Cassandra Host KILLRVIDEO_DSE_CONTACT_POINTS dse
Replication Factor KILLRVIDEO_CASSANDRA_REPLICATION "{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 }"
Username KILLRVIDEO_DSE_USERNAME Null
Password KILLRVIDEO_DSE_PASSWORD Null
```

## Releasing

The app is released as a docker image for consumption by service project implementations. We
Expand Down
5 changes: 4 additions & 1 deletion config/custom-environment-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ web:
cassandra:
replication: KILLRVIDEO_CASSANDRA_REPLICATION
dseUsername: KILLRVIDEO_DSE_USERNAME
dsePassword: KILLRVIDEO_DSE_PASSWORD
dsePassword: KILLRVIDEO_DSE_PASSWORD

services:
cassandra: KILLRVIDEO_DSE_CONTACT_POINTS
22 changes: 11 additions & 11 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ cassandra:
dsePassword: null

services:
web: ['web:3000']
cassandra: ['dse']
dse-search: ['dse:8983']
UploadsService: ['backend:50101']
RatingsService: ['backend:50101']
CommentsService: ['backend:50101']
SearchService: ['backend:50101']
StatisticsService: ['backend:50101']
VideoCatalogService: ['backend:50101']
UserManagementService: ['backend:50101']
SuggestedVideoService: ['backend:50101']
web: 'web:3000'
cassandra: 'dse'
dse-search: 'dse:8983'
UploadsService: 'backend:50101'
RatingsService: 'backend:50101'
CommentsService: 'backend:50101'
SearchService: 'backend:50101'
StatisticsService: 'backend:50101'
VideoCatalogService: 'backend:50101'
UserManagementService: 'backend:50101'
SuggestedVideoService: 'backend:50101'
18 changes: 4 additions & 14 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3'
services:
web:
#image: hadesarchitect/killrvideo-web:no-etcd
build: .
volumes:
- .:/opt/killrvideo-web
Expand All @@ -14,14 +13,14 @@ services:
KILLRVIDEO_LOGGING_LEVEL: debug

backend:
image: hadesarchitect/killrvideo-nodejs:no-etcd
image: killrvideo/killrvideo-nodejs:3.0.0
depends_on:
- dse
environment:
KILLRVIDEO_LOGGING_LEVEL: debug

dse:
image: datastax/dse-server:6.0.0
image: datastax/dse-server:6.7.0
command: [ -s -g ]
ports:
- "9042:9042"
Expand All @@ -36,25 +35,16 @@ services:
memlock: -1

dse-config:
image: killrvideo/killrvideo-dse-config:2.2.1
image: killrvideo/killrvideo-dse-config:3.0.0
environment:
KILLRVIDEO_SERVICE_DISCOVERY_DISABLED: 'true'
depends_on:
- dse

generator:
image: killrvideo/killrvideo-generator:3.0.0-rc4
image: killrvideo/killrvideo-generator:3.0.0
depends_on:
- dse
- backend
environment:
KILLRVIDEO_LOGGING_LEVEL: debug

# studio:
# image: killrvideo/killrvideo-studio:2.0.0
# ports:
# - "9091:9091"
# depends_on:
# - dse
# environment:
# DS_LICENSE: accept
2 changes: 1 addition & 1 deletion src/server/utils/lookup-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export function lookupServiceAsync(serviceName) {

logger.log('verbose', `Found service ${serviceName} at ${registry[serviceName]}`);

return new Promise (function(resolve, reject){resolve(registry[serviceName])});
return new Promise (function(resolve, reject){resolve([registry[serviceName]])});
};

0 comments on commit 3b50296

Please sign in to comment.