Skip to content

Commit cf4e2d6

Browse files
authored
Merge pull request #3 from CottaCush/fixes/deployer-update
Deployer updates, added yii2-utils and other bug fixes
2 parents de1abf0 + 82efc73 commit cf4e2d6

File tree

6 files changed

+57
-15
lines changed

6 files changed

+57
-15
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
#### 1.3.0
4+
5+
* Fix issues with deployer script *2016-09-16*
6+
* Add yii2 composer config task *2016-09-16*
7+
* Create sample server.yml for deployer *2016-09-16*
8+
* Remove deploy settings from env file *2016-09-16*
9+
* Add yii2-utils as composer dependency *2016-09-16*
10+
11+
312
#### 1.2.1
413

514
* Fix issue with postCreateProject directories in composer.json *2016-07-23*

app/env/.env.sample

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,4 @@ SMTP_PASSWORD=""
1111
DB_HOST=""
1212
DB_USERNAME=""
1313
DB_PASSWORD=""
14-
DB_NAME=""
15-
16-
# Deploy Settings
17-
REPO_URL=""
18-
SLACK_HOOK_URL=""
19-
SLACK_CHANNEL_NAME=""
14+
DB_NAME=""

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cottacush/yii2-base-project",
33
"description": "A Yii 2 Base Project Template",
44
"keywords": ["yii2", "framework", "basic", "project template", "improved"],
5-
"version": "1.2.1",
5+
"version": "1.3.0",
66
"type": "project",
77
"license": "MIT",
88
"minimum-stability": "stable",
@@ -26,10 +26,12 @@
2626
"phpmd/phpmd" : "@stable",
2727
"sebastian/phpcpd": "*",
2828
"theseer/phpdox": "*",
29-
"phpunit/phpunit": "4.8"
29+
"phpunit/phpunit": "4.8",
30+
"cottacush/yii2-utils": "~1.0.0"
3031
},
3132
"config": {
32-
"process-timeout": 1800
33+
"process-timeout": 1800,
34+
"discard-changes" : true
3335
},
3436
"scripts": {
3537
"post-create-project-cmd": [

deploy.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88

99
serverList('deploy/servers.yml');
1010

11-
set('writable_dirs', ['runtime', 'web/assets']);
11+
set('writable_dirs', ['app/runtime', 'app/web/assets']);
12+
set('shared', ['app/runtime']);
1213

13-
env('composer_options', 'install --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction');
14+
// TODO Add repository url for project
15+
set('repository', env('REPO_URL'));
16+
17+
env('composer_options', 'install --prefer-dist --optimize-autoloader --no-progress --no-interaction');
18+
19+
$slackHookUrl = env('SLACK_HOOK_URL');
1420

1521
/**
1622
* Run migrations
@@ -45,7 +51,14 @@
4551
* Upload env file
4652
*/
4753
task('deploy:upload_environments_file', function () {
48-
upload(env('local_path') . '/env/.env.{{APPLICATION_ENV}}', '{{release_path}}/env/.env');
54+
upload(__DIR__ . '/app/env/.env.{{APPLICATION_ENV}}', '{{release_path}}/app/env/.env');
55+
});
56+
57+
/** Yii2 composer setup */
58+
task('deploy:yii2_composer_config', function () {
59+
// TODO Replace <GITHUB_TOKEN> with valid github token
60+
run('composer config -g github-oauth.github.com <GITHUB_TOKEN>');
61+
run('composer global require "fxp/composer-asset-plugin:~1.1.1"');
4962
});
5063

5164
/** Slack Tasks Begin */
@@ -74,6 +87,7 @@
7487
'deploy:release',
7588
'deploy:update_code',
7689
'deploy:shared',
90+
'deploy:yii2_composer_config',
7791
'deploy:vendors',
7892
'deploy:upload_environments_file',
7993
'deploy:run_migrations',
@@ -82,9 +96,6 @@
8296
'deploy:cleanup',
8397
])->desc('Deploy Project');
8498

85-
$repositoryUrl = env('REPO_URL');
86-
set('repository', $repositoryUrl);
87-
8899
function postToSlack($message)
89100
{
90101
runLocally('curl -s -S -X POST --data-urlencode payload="{\"channel\": \"#' . env('SLACK_CHANNEL_NAME') . '\", \"username\": \"Release Bot\", \"text\": \"' . $message . '\"}"' . env('SLACK_HOOK_URL'));

deploy/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!.gitignore
3+
!.env.sample

deploy/servers.sample.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# deploy/servers.yml
2+
# Create a copy of this file as servers.yml and replace the values appropriately
3+
4+
# This is the staging stage, you can add more stages
5+
staging:
6+
host: <server_host>
7+
user: demo_user
8+
stage: development
9+
identity_file:
10+
public_key: "~/.ssh/id_rsa.pub"
11+
private_key: "~/.ssh/id_rsa.pem"
12+
password: "key-password"
13+
deploy_path: "/var/www/html/yii2-base-project"
14+
branch: develop
15+
DB_HOST: "localhost"
16+
DB_NAME: "yii2_base"
17+
DB_USERNAME: "root"
18+
DB_PASSWORD: ""
19+
APPLICATION_ENV: "staging"
20+
REPO_URL: ""
21+
SLACK_HOOK_URL: ""
22+
SLACK_CHANNEL_NAME: ""

0 commit comments

Comments
 (0)