-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[7.0-beta] How to set default stage / host #2676
Comments
For the stage, read the upgrade documentation (use |
I'd love to do the opposite — assign the value of the host alias based on the current git branch. If on branch This lets me keep the logic in dep in the repo, rather that putting the logic in a GitHub actions skip. |
Yeah I'm struggling with this too, I loved the feature to have it deploy a "feature" branch by default to Also now instead of Here's our 7.x recipe WIP https://github.com/ubc-cpsc/deployer-recipes/tree/feature/7.x-compatibility |
I also tried this, but am not convinced is working: host('staging')
->setHostname('test.co.uk')
->setRemoteUser('admin')
->setIdentityFile('~/.ssh/id_rsa')
->set('stage', function () {
return (input()->hasOption('stage')) ? input()->getOption('stage') : 'staging';
})
->set('branch', function () {
return (input()->hasOption('branch')) ? input()->getOption('branch') : 'develop';
})
->setDeployPath('{{root_dir}}/{{application}}/{{stage}}')
->set('cachetool', function() {
$stage = get('stage');
$php_ver = get('php_ver');
$hostname = get('hostname');
if($stage == 'production') {
$stage = '';
}
return "/var/run/php/php{$php_ver}-fpm-{$hostname}.sock --tmp-dir=/home/admin/tmp";
})
->set('cachetool_args', '--web=FileGetContents --web-path=./public --web-url=https://{{hostname}}')
->set('labels', [
'stage' => '{{stage}}',
])
; |
and i also tried adding this to near the top of deploy.php. but still doesnt work :-(
|
If you can explain what you are trying to achieve, I’ll be able to help. Clearly I don’t understand the struggle. |
Hi @antonmedv , Sorry if i was not clear in my first post. We have 2 deployment environments, 'production' and 'staging' and use gitflow as our VCS workflow meaning we have 'master' and 'develop' branches that equate to the environments. On (rocketeer originally and then...) the old 6.8 release we used to run Staging release from develop: Production release from master which was nice and simple. with the new 7 release (RC4) this no longer works. i have configure two hosts one called staging, one called production detailed below, but if i run
it deploys the HEAD branch to the staging environment not the desired develop. current host configuration:
in addition we also occasionally want to test a feature branch in staging ( or production) in which case this command does work as expected:
if the above is still not clear please let me know. |
@antonmedv what was behind the decision to remove the 'stage' argument? |
@antonmedv Not sure if this would work but around here in the deployer/src/Command/SelectCommand.php Line 56 in 42734c5
Could we have a hook to provide a default selector? I'd sure enough set it to stage=staging
|
Related: #3197 |
Why still no "default_stage" replacement as of 7.x? By default deployer connects to all defined hosts and attempts to begin deployment to all of them. In certain situations this can lead to dangerous mistakes and default_stage was the security switch, where you could define dev environment as default one. This is very basic functionality and honestly i cannot understand why it's not implemented yet and why it was removed without implementing any replacement. Is there any workaround to avoid deploying to all hosts by mistake when no selector is provided via cli? |
Not anymore. In Deployer v7 in selector not specified, Deployer will ask which hosts to deploy. |
Thanks for info |
This issue has been automatically closed. Please, open a discussion for bug reports and feature requests. Read more: [https://github.com//discussions/3888] |
(using laravel recipe) with ver 6.8 to deploy to either production or staging in our setup we ran:
for staging
for production
Question 1: where can we set the default stage? (in your terminology i think this a host 'alias' )
Question 2: How can we pass the git branch to deploy?
snippet from our deploy.php
NOTE: I did try adding this to the top of our deploy.php file but it didnt work...
Upvote & Fund
The text was updated successfully, but these errors were encountered: