Skip to content

Commit

Permalink
Merge branch 'release/v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieuy committed Aug 10, 2017
2 parents a387d55 + f4f844b commit 894588d
Show file tree
Hide file tree
Showing 162 changed files with 5,646 additions and 657 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/app/config/parameters.yml
/app/docker/.env
/build/
/Envoy.config.php
/node_modules/
/old/
/phpunit.xml
Expand Down
16 changes: 16 additions & 0 deletions .phpstorm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file is only for configure the IDE PHPStorm
*/
System.config({
// Resolve webpack alias
'paths': {
'@app/*': './app/Resources/assets/*',
'@bonus/*': './src/BonusBundle/Resources/assets/*',
'@chat/*': './src/ChatBundle/Resources/assets/*',
'@match/*': './src/MatchBundle/Resources/assets/*',
'@npm/*': './node_modules/*',
'@user/*': './src/UserBundle/Resources/assets/*',
'@vendor/*': './vendor/*',
'@web/*': './web/*',
},
})
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# CHANGELOG

### v0.4.0 (2017-08-10)

* Fix some bugs
* Sessions with redis
* Who is online ? (for administrator)
* Update SF v3.3.6
* Rewrite BonusManager
* Add bonus :
* Bomber
* Booster
* Double damage
* Reset
* Robber
* Skip player
* Spy
* Commands :
* List bonus
* Who is online
* Deploy script
* Mobile :
* Shoot with long press
* Fix responsive design

### v0.3.0 (2017-07-31)

* Penalty
Expand Down
188 changes: 188 additions & 0 deletions Envoy.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#################################
# Don't edit this file ! #
# Use Envoy.config.php instead #
#################################

@include('./Envoy.config.php')
@servers(['web' => [$sshHost]])

@setup
$current = $workdir . '/current';
$dirRepo = $workdir . '/git';
$dirShared = $workdir . '/shared';
$dirReleases = $workdir . '/releases';
$dirRelease = $dirReleases .'/'. date('YmdHis');
$dirLastRelease = $dirReleases . '/last';
@endsetup

@macro('deploy')
new_release
composer
npm
cache
assets
database
stop
link_current
start
clear
@endmacro

#######################
# Prepare the workdir #
#######################
@task('prepare')
echo "Task : Prepare {{ $workdir }}";
mkdir -p {{ $dirShared }}/logs;
mkdir -p {{ $dirShared }}/img/avatars;
mkdir -p {{ $dirShared }}/img/boats;

echo "Prepare git repository";
[ -d {{ $dirRepo }} ] && rm -rf {{ $dirRepo }};
mkdir -p {{ $dirRepo }};
cd {{ $dirRepo }};

echo "Clone {{ $repository }} into {{ $dirRepo }}";
git clone -q {{ $repository }} .
@endtask


########################
# Create a new release #
########################
@task('new_release')
echo "Task : Create new release";
mkdir -p {{ $dirRelease }};

echo "Update git (branch: {{ $branch }})";
cd {{ $dirRepo }};
git checkout -q {{ $branch }};
git reset -q --hard;
git pull;
echo "Last commit : $(git log --oneline -n1)";

echo "Copy files to new release";
git archive {{$branch}}|tar -x -C {{ $dirRelease }};

echo "Create links :";
[ -e {{ $dirShared }}/parameters.yml ] || cp {{ $dirRelease }}/app/config/parameters.yml.dist {{ $dirShared }}/parameters.yml;
ln -vs {{ $dirShared }}/parameters.yml {{ $dirRelease }}/app/config/parameters.yml;
rm -rf {{ $dirRelease }}/var/logs;
ln -vs {{ $dirShared }}/logs {{ $dirRelease }}/var/logs;
rm -rf {{ $dirRelease }}/var/avatars {{ $dirRelease }}/var/boats;
ln -vs {{ $dirShared }}/img/avatars {{ $dirRelease }}/var/avatars;
ln -vs {{ $dirShared }}/img/boats {{ $dirRelease }}/var/boats;
rm -f {{ $dirReleases }}/last;
ln -vs {{ $dirRelease }} {{ $dirReleases }}/last;

echo "Fix right";
chmod -Rf 777 {{ $dirReleases }}/last/var;
chgrp -Rf www-data {{ $dirReleases }}/last/;
@endtask


###################
# Libs and assets #
###################
@task('composer')
echo "Task : Composer";
cd {{ $dirLastRelease }};
composer install --no-progress --ansi --no-suggest --no-interaction;
@endtask

@task('assets')
echo "Task : Assets";
cd {{ $dirLastRelease }};
./bin/console assets:install --env={{ $env }};
./bin/console maba:webpack:compile --env={{ $env }};
@endtask

@task('npm')
echo "Task : NPM";
cd {{ $dirLastRelease }};
yarn install --no-progress;
@endtask


############
# Database #
############
@task('database')
echo "Task : Update database";
cd {{ $dirLastRelease }};
./bin/console doctrine:migrations:migrate --env={{ $env }};
chmod -Rf 777 {{ $dirLastRelease }}/var;
@endtask

@task('fixtures')
echo "Task : import fixtures";
cd {{ $dirLastRelease }};
./bin/console doctrine:fixtures:load --append --no-interaction --env={{ $env }};
@endtask


############
# Releases #
############
@task('link_current')
echo "Create link to the current release";
rm -f {{ $current }};
ln -sv {{ $dirReleases }}/$(ls {{ $dirReleases }}|grep -e '^[0-9]'|tail -n 1) {{ $current }};
@endtask

@task('rollback')
rm -f {{ $current }};
ln -sv {{ $dirReleases }}/$(ls {{ $dirReleases }}|grep -e '^[0-9]'|tail -n 2|head -n 1) {{ $current }};
@endtask

@task('clear')
echo "Remove old releases";
cd {{ $dirReleases }}
ls -r|grep -e '^[0-9]'|tail -n +{{ $nbRelease + 1 }}|xargs rm -rf;
@endtask

#########
# Cache #
#########
@task('cache')
echo "Clear cache";
cd {{ $dirLastRelease }};
./bin/console cache:clear --env={{ $env }};
chmod -Rf 777 {{ $dirLastRelease }}/var;
@endtask

@task('warmup')
echo "Warmup cache";
cd {{ $dirLastRelease }};
./bin/console cache:warmup --env={{ $env }};
chmod -Rf 777 {{ $dirLastRelease }}/var;
@endtask


##########
# Server #
##########
@task('restart')
echo "Restart the Websocket server";
cd {{ $dirLastRelease }};
./bin/console redis:flushdb --client=ws_client --env=prod;
sudo supervisorctl restart battleship;
@endtask

@task('start')
echo "Start the Websocket server";
sudo supervisorctl start battleship;
@endtask

@task('stop')
echo "Stop the Websocket server";
sudo supervisorctl stop battleship;

echo "Clear Redis";
cd {{ $dirLastRelease }};
./bin/console redis:flushdb --client=ws_client --env=prod;
@endtask

@task('ping')
echo "pong (work in {{ $workdir }} on $(hostname))";
@endtask
36 changes: 36 additions & 0 deletions Envoy.config.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* This file contain variable for deploy the app
* Read the doc in app/Resources/doc/envoy.md
*/
global $sshHost;

/**
* SSH host (define in your ~/.ssh/config file)
*/
$sshHost = 'battleship.domain.org';

/**
* Workdir on the server
*/
$workdir = '/home/battleship';

/**
* Environment
*/
$env = 'prod';

/**
* Repository
*/
$repository = 'https://github.com/matthieuy/battleship.git';

/**
* Branch
*/
$branch = 'develop';

/**
* Number of release
*/
$nbRelease = 5;
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Features
- Bonus and inventory
- Animate shot
- Translations
- Chat
- Notifications :
- Mail
- SMS
- Discord :
- Webhook
- Bot


Installation
Expand All @@ -49,12 +56,11 @@ Tests
```


TODO
TODO / CHANGELOG
====

See the complete [TODO](TODO.md)

See the [CHANGELOG](CHANGELOG.md)
* See the complete [TODO](TODO.md)
* See the [CHANGELOG](CHANGELOG.md)

Credits
=======
Expand Down
43 changes: 9 additions & 34 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
TODO
====

- [ ] Bugfix :
- [ ] FlashError : scrollTop
- [ ] Animation with scroll != 0
- [ ] Documentations :
- [ ] Howto add a bonus
- [ ] Add screenshot or gif
- [ ] Add screenshot or gif
- [ ] Game :
- [ ] ISO view
- [ ] Shortcuts
- [ ] Bonus :
- [ ] Make more bonus
- [ ] Add some trigger for bonus
- [ ] ISO view
- [ ] Mobile :
- [ ] Helper for weapon
- [ ] Helper for weapon
- [ ] Stats :
- [ ] Register stats on event
- [ ] Display user stats on profil
- [ ] Display stats on game
- [ ] Notifications :
- [ ] Config per type on profil page
- [ ] Notifications registry
- [ ] Notifications manager
- [ ] Transporter :
- [ ] Hook
- [ ] SMS (via hooks)
- [ ] IonicPush
- [ ] Discord
- [ ] Email
- [ ] Push Navigator
- [ ] Type :
- [ ] User connect
- [ ] Tour
- [ ] Messages
- [ ] Register stats on event
- [ ] Display user stats on profil
- [ ] Display stats on game
- [ ] Translate :
- [ ] Translate in French
- [ ] Translate in French
- [ ] Tests/Dev :
- [ ] Unit tests
- [ ] Script for deploy on git hook (personal TODO)
- [ ] Page with websocket client
- [ ] ESLint and others checks tools
- [ ] Unit tests
- [ ] ESLint and others checks tools
2 changes: 2 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ public function registerBundles()
new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(),
new Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle(),
new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(),
new Snc\RedisBundle\SncRedisBundle(),

// Bundle
new AppBundle\AppBundle(),
new UserBundle\UserBundle(),
new MatchBundle\MatchBundle(),
new BonusBundle\BonusBundle(),
new ChatBundle\ChatBundle(),
new NotificationBundle\NotificationBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
Expand Down

0 comments on commit 894588d

Please sign in to comment.