Skip to content
This repository was archived by the owner on Oct 10, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,18 @@ language: node_js
node_js:
- '0.10'

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- 'npm install'
- 'npm install -g bower'
- 'npm install -g grunt-cli'
- 'bower install --config.interactive=false'
- cp app/scripts/config.js.dist app/scripts/config.js
- "sudo apt-get remove chromium-browser"
- "echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections"
- "sudo apt-get install ttf-mscorefonts-installer"
- "sudo apt-get install x-ttcidfont-conf"
- "sudo mkfontdir"
- "sudo apt-get install defoma libgl1-mesa-dri xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic"
- "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
- "sudo mkdir -p /usr/share/desktop-directories"
- "sudo dpkg -i google-chrome-stable_current_amd64.deb"
- "sudo apt-get install -f"
- "sudo dpkg -i google-chrome-stable_current_amd64.deb"
- "export CHROME_SANDBOX=/opt/google/chrome/chrome-sandbox"
- "sudo rm -f $CHROME_SANDBOX"
- "sudo wget https://googledrive.com/host/0B5VlNZ_Rvdw6NTJoZDBSVy1ZdkE -O $CHROME_SANDBOX"
- "sudo chown root:root $CHROME_SANDBOX; sudo chmod 4755 $CHROME_SANDBOX"
- "sudo md5sum $CHROME_SANDBOX"
- "export DISPLAY=:99.0"
- "Xvfb :99.0 -extension RANDR > /dev/null &"
- "sudo chmod 1777 /dev/shm"
before_install:
- sudo apt-get autoclean -y
- sudo apt-get autoremove -y

install:
- sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
- sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
- sudo apt-get update
- echo exit 101 | sudo tee /usr/sbin/policy-rc.d
- sudo chmod +x /usr/sbin/policy-rc.d
- sudo apt-get install -qy slirp lxc lxc-docker
- git clone git://github.com/jpetazzo/sekexe

script:
- grunt test-travis
- sekexe/run "`pwd`/docker/scripts/travis.sh `pwd`"
51 changes: 40 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,54 @@ FROM stackbrew/ubuntu:saucy

ENV DEBIAN_FRONTEND noninteractive

MAINTAINER Kenny DITS "kenny.dits@m6.fr"
MAINTAINER Jérémy JOURDIN "jjourdin.externe@m6.fr"

RUN apt-get update -y
RUN apt-get install -y git nginx software-properties-common python-software-properties python g++ make bzip2
RUN apt-get upgrade -y
RUN apt-get install -y wget git nginx software-properties-common python-software-properties python g++ make bzip2
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-add-repository ppa:chris-lea/node.js
RUN apt-get update -y
RUN apt-get install -y nodejs
RUN apt-get install -y --force-yes x11vnc openjdk-7-jre-headless google-chrome-stable xvfb nodejs xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

ADD . /var/www
ADD . /var/www/tmp
ADD ./docker/scripts /var/www/scripts

WORKDIR /var/www
WORKDIR /var/www/tmp

RUN cp docker/config.js.dist app/scripts/config.js

RUN npm install
RUN npm install grunt
RUN npm install -g bower grunt-cli
RUN bower install --allow-root
RUN ./node_modules/.bin/bower install --allow-root

RUN cp app/scripts/config.js.dist app/scripts/config.js
RUN grunt build
# RUN ./node_modules/.bin/webdriver-manager update
RUN ./node_modules/.bin/grunt build

ADD docker/nginx-vhost.conf /etc/nginx/sites-available/default

CMD ["-g", "daemon off;"]
ENTRYPOINT ["/usr/sbin/nginx"]
RUN mv dist ../prod

WORKDIR /var/www

RUN rm -rf tmp

RUN echo "daemon off;" >> /etc/nginx/nginx.conf

RUN mkdir ~/.vnc

VOLUME ['/var/www/dev']

EXPOSE 21 80

ENV DISPLAY :99

ENV BABITCH_WS_URL http://127.0.0.1:8081/app_dev.php/v1
ENV BABITCH_LIVE_FAYE_URL http://faye-babitch.herokuapp.com/faye
ENV BABITCH_LIVE_FAYE_CHANNEL /test-channel-to-replace
ENV BABITCH_STATS_MIN_GAME_PLAYED 2

CMD ["prod"]

ENTRYPOINT ["/var/www/scripts/starter.sh"]
70 changes: 4 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ BabitchClient provides a simple responsive user interface.

![Babitch Screenshot](screenshot.png)

## Documentation

Learn how to get your own private BabitchClient by reading our [documentation](./doc/).

## Features

* 2VS2
Expand All @@ -16,60 +20,6 @@ BabitchClient provides a simple responsive user interface.
* Gravatar support
* Lot of Stats by players and team

## Installation

### Clone the project

```
$ git clone https://github.com/M6Web/BabitchClient.git
$ cd BabitchClient
$ cp app/scripts/config.js.dist app/scripts/config.js
```

### For production purposes
* Install the Babitch Server API => [M6Web/Babitch](https://github.com/M6Web/Babitch)
* Go to app/scripts/config.js and change server config

```
$ bower install
$ grunt build
```

Then,

* Configure a Web Server (Apache/Nginx/...) with the `dist` folder as the doc root
* Launch `<yourwebserver.com>/` in a browser

### For dev purposes
```
$ npm install
$ bower install
$ grunt serve
```
Then go to `http://127.0.0.1:8080/`,

You have two options for the server side :

* Install the Babitch Server API => [M6Web/Babitch](https://github.com/M6Web/Babitch) and change `app/scripts/config.js`
* Use the faked backend by adding `?nobackend` to the BabitchClient url

#### Test (Unit & E2E)

Only unit test :
* `grunt test-unit`

Only E2E test :
* `grunt test-e2e`

All test :
* `grunt test`

## Live

You need to configure `BABITCH_LIVE_FAYE_URL` and `BABITCH_LIVE_FAYE_CHANNEL` in `app/scripts/config.js`

* User interface : `http://127.0.0.1:8080/#live`

## Technical Stack

* Yeoman, to boostrap the application
Expand All @@ -79,18 +29,6 @@ You need to configure `BABITCH_LIVE_FAYE_URL` and `BABITCH_LIVE_FAYE_CHANNEL` in
* Faye for realtime messaging
* D3.js for data visualization

## Docker

To use the `Dockerfile` in this repository, just clone and run (at the root):

docker build -t m6web/babitch-client .

Then run the container:

docker run -p 8000:80 m6web/babitch-client

You now have a BabitchClient listening on port `8000`!

## Credits

Developped by [M6 Web](http://tech.m6web.fr/).
Expand Down
17 changes: 17 additions & 0 deletions doc/contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contribute to BabitchClient

Help us to improve the application by:

* Giving us a feedback using Github Issues
* Sending us pull requests (with related tests)

## Launch Tests (Unit & E2E)

Only unit test :
* `./node_modules/.bin/grunt test-unit`

Only E2E test :
* `./node_modules/.bin/grunt test-e2e`

All test :
* `./node_modules/.bin/grunt test`
9 changes: 9 additions & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BabitchClient Documentation

* Install
..* [With GIT](./install/git.md)
..* [With Docker](./install/docker.md)
* Use
..* [With GIT](./use/git.md)
..* [With Docker](./use/docker.md)
* [Contribute](./contribute.md)
13 changes: 13 additions & 0 deletions doc/install/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Install with Docker

You have to do this step only if you wan't to build your own custom image, otherwise go to [the next step](../usage/docker.md).

## Prepare image

Follow the [GIT Installation process](./git.md).

## Build image

```shell
$ docker build -t m6web/babitch-client .
```
33 changes: 33 additions & 0 deletions doc/install/git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Install with GIT

## Clone the project

```shell
$ git clone https://github.com/M6Web/BabitchClient.git
```

## Configure

```shell
$ cd BabitchClient
$ cp app/scripts/config.js.dist app/scripts/config.js
```

Then edit app/scripts/config.js to match your requirements

## For production purposes

* Install the Babitch Server API => [M6Web/Babitch](https://github.com/M6Web/Babitch)
* Go to app/scripts/config.js and change server config

```
$ ./node_modules/.bin/bower install
$ ./node_modules/.bin/grunt build
```

## For dev purposes

```
$ npm install
$ ./node_modules/.bin/bower install
```
38 changes: 38 additions & 0 deletions doc/use/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Usage of Docker version

## Development mode

This mode make contribution easier, it run the container with the following component:

- X11VNC: VNC Server used to render browser while protractor is running (port binding: `-p <your_port>:5999`)
- XVFB: Virtual frame buffer used to simulate a display for protractor purposes
- ProFTPd: FTP server used to edit files in container from your favorite editor (port binding: `-p <your_port>:21`)

There is no Nginx running on dev mode as your will prefer to use `grunt serve` for development purpose.

```shell
$ sudo docker run --privileged -t -i -p 8000:80 -p 5999:5999 -p 2121:21 m6web/babitch-client dev
```

## Production mode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all "production mode" had to be much more visible than dev or test mode :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right 😄


This mode provide a lightweight server, it run the container with the following component:

- Nginx: Web server (port binding: `-p <your_port>:80`)

```shell
$ sudo docker run --privileged -t -i -p 8000:80 m6web/babitch-client prod
```

You now have a BabitchClient listening on port `8000`!

## Test mode

This mode simply launch test suites, it run the container with the following component:

- X11VNC: VNC Server used to render browser while protractor is running (port binding: `-p <your_port>:5999`)
- XVFB: Virtual frame buffer used to simulate a display for protractor purposes

```shell
$ sudo docker run --privileged -t -i -p 5999:5999 m6web/babitch-client test
```
21 changes: 21 additions & 0 deletions doc/use/git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Usage of GIT version

## For production purposes

* Configure a Web Server (Apache/Nginx/...) with the `dist` folder as the doc root
* Launch `<yourwebserver.com>/` in a browser

### For dev purposes

Launch:

```
$ grunt serve
```

Then go to `http://127.0.0.1:8080/`,

You have two options for the server side :

* Install the Babitch Server API => [M6Web/Babitch](https://github.com/M6Web/Babitch) and change `app/scripts/config.js`
* Use the faked backend by adding `?nobackend` to the BabitchClient url
9 changes: 9 additions & 0 deletions docker/config.js.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

angular.module('babitchServer', [])
.constant('CONFIG', {
'BABITCH_WS_URL': '%BABITCH_WS_URL%',
'BABITCH_LIVE_FAYE_URL' :'%BABITCH_LIVE_FAYE_URL%',
'BABITCH_LIVE_FAYE_CHANNEL' :'%BABITCH_LIVE_FAYE_CHANNEL%',
'BABITCH_STATS_MIN_GAME_PLAYED' : '%BABITCH_STATS_MIN_GAME_PLAYED%'
});
2 changes: 1 addition & 1 deletion docker/nginx-vhost.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
server {
listen 80;
root /var/www/dist/;
root /var/www/prod/;
}
Loading