servergrove / ansible-symfony2 Goto Github PK
View Code? Open in Web Editor NEWAnsible role to deploy Symfony2 applications
License: MIT License
Ansible role to deploy Symfony2 applications
License: MIT License
I always have this error cloning from my git repo.
I do not have much experience with ansible, so it may be a stupid question. I didn't found any help.
msg: github.com has an unknown hostkey. Set accept_hostkey to True or manually add the hostkey prior to running the git module
FATAL: all hosts have already failed -- aborting
How do you folks usually deal with permissions around the cache folder? I created my own "hook" file currently to do the chmod.
following instruction here: http://blog.servergrove.com/2014/04/01/deployment-symfony2-applications-ansible/
i got this error:
failed: [localhost] => {"failed": true, "item": "", "path": "/home/myproject/master/releases/1/app/logs", "src": "/home/myproject/master/shared/app/logs", "state": "absent"}
msg: src file does not exist, use "force=yes" if you really want to create the link: /home/myproject/master/shared/app/logs
when executing: ansible-playbook -l prod -i app/config/hosts.ini -e "symfony2_project_release=1" app/config/deploy.yml -vvv --check
thx in advance
For each symfony2 deployment you need to flush the opcode and userland caches. That's normally either done by script or via webserver/php-fpm restart.
I'd like to introduce an optional task (when: symfony2_project_restart_webserver) where you can add a configurable commandline-option (e.g. shell: sudo service nginx restart; sudo service php5-fpm restart) where you can configure the actual command through an additional variable.
The default value for symfony2_project_composer_opts
is
'--no-dev --optimize-autoloader --no-interaction'
but this value produces an error if symfony2_project_env
is set to dev.
Of course I can force the value in my deploy.yml, but I was wondering if it's possible to programmatically change the default value for symfony2_project_composer_opts
according to the set value of symfony2_project_env
.
I am a beginner with Ansible so I can't suggest a solution.
From the last master version.
When it runs ansible-symfony2 | Run composer install.
, it never ends.
I think (but I might be wrong?) it's because of the prompt asking for params (or use default ones).
Here is the -vvv
debug :
REMOTE_MODULE command cd /home/www/git/proj/releases/20150610111810 && export SYMFONY_ENV=prod && php /home/www/git/proj/composer.phar install --no-dev --optimize-autoloader #USE_SHELL
And when I run it outside of Ansible I get the prompt asking for :
Some parameters are missing. Please provide them.
secret (ThisTokenIsNotSoSecretChangeIt):
don't understand whats happening. i think it is not related with ansible.symfony2 but please advise.....
i have left to test only this task:
- name: Pull sources from the repository.
git: repo={{symfony2_project_repo}} dest={{symfony2_project_root}} version={{symfony2_project_branch}}
if i execute it i got correct result:
changed: [localhost] => {"after": "bda8a73a1d08494488c21ca8f3baa0e10ba69bc2", "before": null, "changed": true}
TASK: [shell echo 'Deployment complete.'] *************************************
skipping: [localhost]
PLAY RECAP ********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
but dest directory is always empty not having my sources!!!!!!!!! P.D: please note that "after": "bda8a73a1d08494488c21ca8f3baa0e10ba69bc2" is showing correct hash of repo commit!
thx
Hi,
while migrating from 1.0 version to new version I've encountered the following issue:
TASK: [servergrove.symfony2 | Check if config dir exists.] ********************
ok: [xxx.xxx.xxx.xxx]
TASK: [servergrove.symfony2 | Link configs dir if not yet exists.] ************
skipping: [xxx.xxx.xxx.xxx]
TASK: [servergrove.symfony2 | Check if parameters file exists.] ***************
ok: [xxx.xxx.xxx.xxx]
TASK: [servergrove.symfony2 | Create symlink for parameters file from shared directory.] ***
failed: [xxx.xxx.xxx.xxx] => {"failed": true}
msg: unsupported parameter for module: creates
FATAL: all hosts have already failed -- aborting
After updating to latest project version (v2.0.1-alpha) I get this error on the "Dump assetic assets":
require_once([...]/app/bootstrap.php.cache): failed to open stream: No such file or directory
AFAIK that file is automatically generated when building the cache, so is there a missing step?
Thank you!
When running the following command:
ansible-playbook -l test -i inventory.ini -e "symfony2_project_release=1" deploy.yml -vvv
I get this error:
msg: refusing to convert between directory and link for /var/www/vhosts/exampl/releases/1/app/logs
I have confirmed that the folder exists in the repo and the only file in the folder is a ".gitkeep" file.
I'm thinking about making some of the includes, e.g. the git checkout part as overwriteable include, to provide more freedom of customizing (nearly) every step in the deployment process.
example:
---
- include: "{{ symfony_project_my_custom_git_handling | default('11-git.yml') }}"
This solution uses the "hook" handling.
Checklist of open points for a 1.0 release:
Hi.
I need to execute Incenteev\\ParameterHandler\\ScriptHandler::buildParameters
interactively. Is this possible?
My deploy config is:
---
- name: Deploy project to S6 production server
hosts: s6
roles:
- { role: servergrove.symfony2 }
vars:
# custom config
vhost_name: "<HIDDEN_SECRET>"
vhost_path: "<HIDDEN_SECRET>"
# mandatory role config
symfony_project_root: "{{ vhost_path }}/{{ vhost_name }}"
symfony_project_composer_path: "{{ vhost_path }}/{{ vhost_name }}/shared/composer.phar"
symfony_project_repo: "<HIDDEN_SECRET>"
symfony_project_env: "prod"
# optional role config
symfony_project_branch: "master"
symfony_project_keep_releases: 3
symfony_project_composer_opts: "--no-dev --optimize-autoloader"
symfony_project_shared_folders:
- { name: logs, src: app/logs, path: app/logs }
Why is not included a clear cache or warmup taks in deploy task? There is some reason? Thanks
Running the ansible-symfony2 playbook gives me an error while creating a symlink for release.
FAILED! => {"changed": false, "gid": 33, "group": "www-data", "mode": "0774", "msg": "refusing to convert between directory and link for /var/www/my.app.com/current", "owner": "www-data", "path": "/var/www/my.app.com/current", "size": 4096, "state": "directory", "uid": 33}
I have removed app/logs and app/cache from my repo but its still not working. I currently have no clue how to proceed.
Is this project still maintained and suitable to deploy SF3.3/3.4 projects in production?
I tried ansistrano but I didn't managed to do it easily with the handling/hooks of symlinks of the shared folder on iSCSI shared disks..
Thanks in advance.
Hello,
We have a situation where a project has some deployed server/environment variables that are different than development or other deployments - for example its behind a reverse proxy and so we have to set some base_path/url overrides. We've done this by adding this to our config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: config_who.yml, ignore_errors: true }
Thus if the config_who.yml filed doesn't exist it continues on, but if it does it's included with its config overrides.
Now if we want to use this role, we'd like to put that file in the same shared/app/config directory and have it symlink to the releases/ReleaseVersion/app/config directory. Looking at the system there are no hooks that apply or configuration options for this.
I'm wondering how we should solve this. I don't mind creating a PR but it seems this could be solved two ways.
1 - Add something to the 10-config.yml file to do the same thing for parameters.yml for other files. Probably changing it so that it works on a loop of files to link with only parameters.yml as default
2 - pre-cache hook.
Which would you prefer?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.