Skip to content

Commit

Permalink
Merge pull request #21 from KillrVideo/kubernetisation
Browse files Browse the repository at this point in the history
Kubernetisation
  • Loading branch information
HadesArchitect authored Aug 8, 2019
2 parents ec8225d + 9975075 commit 0b30311
Show file tree
Hide file tree
Showing 28 changed files with 100 additions and 2,177 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ install:
# Build the app and a docker image
script:
- npm run release
- ./scripts/docker-build.sh
- docker build -t ${TRAVIS_COMMIT} --build-arg KILLRVIDEO_YOUTUBE_API_KEY=$KILLRVIDEO_YOUTUBE_API_KEY .

# If successful, see if we need to publish also
after_success:
- ./scripts/travis-publish.sh
- test -z $TRAVIS_TAG && travis_terminate 0
- docker tag ${TRAVIS_COMMIT} killrvideo/killrvideo-web:${TRAVIS_TAG}
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push killrvideo/killrvideo-web:${TRAVIS_TAG}

# Sudo required for doing docker build
sudo: required
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:6.11-slim

# Add killrvideo group and user
RUN groupadd -r killrvideo --gid=999 \
&& useradd -r -g killrvideo --uid=999 killrvideo
&& useradd -m -r -g killrvideo --uid=999 killrvideo

# Default to production environment
ENV NODE_ENV production
Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,21 @@ repos, for example the [C# implementation][6], [Java implementation][7] or [node
## Setting up a Development Environment

All assets for the front-end are built using webpack and the backend is all transpiled with
babel. After cloning the repo, you'll need to install all dependencies first:
```
> npm install
> cd src/client
> npm install
```
All environment dependencies can be spun up using `docker-compose` (this includes Etcd and
DataStax Enterprise). First, you need to generate a `.env` file that contains the information
about your Docker environment needed by KillrVideo.

In Windows, from a Powershell command prompt run:
```
PS> .\lib\killrvideo-docker-common\create-environment.ps1
```
Or on Mac/Linux, run:
```
> lib/killrvideo-docker-common/create-environment.sh
```
You'll then want to edit that `.env` file and add an environment variable that points at the
default `docker-compose.yaml` file:
```bash
# ... other variables generated by script ...
COMPOSE_FILE=./lib/killrvideo-docker-common/docker-compose.yaml
```
You can then start those dependencies with:
babel. After cloning the repo, you'll need to pull images, install all dependencies and build code:
```
> # Prepare images
> docker-compose pull
> docker-compose build
>
> # 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 web npm run build
>
> # Run the project
> docker-compose up -d
```

Finally, you'll also need to download one of the service implementations listed above and
run it according to the provided instructions. (You won't need to use the docker-compose in
the service implementation, the required elements are covered already.)

## Developing

There is a developer task included in the `package.json` scripts. You can run this task with:
Expand Down
15 changes: 14 additions & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,17 @@ cassandra:
# The username and password needed to authenticate to the cluster.
# Either set these values here directly or use the KILLRVIDEO_DSE_USERNAME and KILLRVIDEO_DSE_PASSWORD environment variables.
dseUsername: null
dsePassword: null
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']
66 changes: 53 additions & 13 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,60 @@
version: '3'

# Other services are specified in .\lib\killrvideo-docker-common\docker-compose.yaml
services:
# Start the service implementation of your choice (Java, C#, node.js) separately
web:
#image: hadesarchitect/killrvideo-web:no-etcd
build: .
volumes:
- .:/opt/killrvideo-web
ports:
- "3000:3000"
depends_on:
- dse
- backend
environment:
KILLRVIDEO_LOGGING_LEVEL: debug

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

dse:
image: datastax/dse-server:6.0.0
command: [ -s -g ]
ports:
- "9042:9042"
- "8983:8983"
- "8182:8182"
environment:
DS_LICENSE: accept
# Allow DSE to lock memory with mlock
cap_add:
- IPC_LOCK
ulimits:
memlock: -1

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

# The sample data generator
generator:
image: killrvideo/killrvideo-generator:1.2.3
image: killrvideo/killrvideo-generator:3.0.0-rc4
depends_on:
- dse
- etcd
- dse
- backend
environment:
KILLRVIDEO_ETCD: "etcd:2379"
KILLRVIDEO_DSE_USERNAME: $KILLRVIDEO_DSE_USERNAME
KILLRVIDEO_DSE_PASSWORD: $KILLRVIDEO_DSE_PASSWORD
NODE_ENV: $NODE_ENV
KILLRVIDEO_CASSANDRA_REPLICATION: $KILLRVIDEO_CASSANDRA_REPLICATION
KILLRVIDEO_LOGGING_LEVEL: $KILLRVIDEO_LOGGING_LEVEL
KILLRVIDEO_LOGGING_LEVEL: debug

# studio:
# image: killrvideo/killrvideo-studio:2.0.0
# ports:
# - "9091:9091"
# depends_on:
# - dse
# environment:
# DS_LICENSE: accept
4 changes: 0 additions & 4 deletions lib/killrvideo-docker-common/.gitignore

This file was deleted.

202 changes: 0 additions & 202 deletions lib/killrvideo-docker-common/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion lib/killrvideo-docker-common/README.md

This file was deleted.

Loading

0 comments on commit 0b30311

Please sign in to comment.