Comments (16)
I fully bootstrapped Drupal in a similar fashion (https://github.com/pantheon-systems/quicksilver-examples/pull/13/files). I wonder what your pantheon.yml file looks like and where it is located relative to the Drupal root?
from quicksilver-examples.
My pantheon.yml file is in the drupal root as required. I am able to run other quicksilver examples like after code syncs and database clones that post to slack.
I see in your example you bootstrap drupal to FULL and I was only bootstrapping to DATABASE, so I tried bootstrapping to FULL and that still didn't work.
here is my pantheon.yml file
api_version: 1
workflows:
deploy:
after:
- type: webphp
description: post to slack after each deploy
script: private/scripts/slack_deploy_notification.php
# Notify team of new commit to master
sync_code:
after:
- type: webphp # we are told there will be more
description: post to slack after each code pushed
script: private/scripts/slack_sync_notification.php
# Notify, sanitize,and notify on db clone
clone_database:
before:
- type: webphp
description: post to slack before cloning the database
script: private/scripts/slack_before_db_clone.php
after:
- type: webphp
description: Environment DEBUGGING
script: private/scripts/debug.php
- type: webphp
description: Empty solr authorization
script: private/scripts/solr_deauth_post_db_clone.php
The debug.php script runs fine.
from quicksilver-examples.
@danshumaker, I spoke with @greg-1-anderson and we think the errors you're seeing may be resolved by changing directory to the Drupal Root, as in @Gfriedman21's example.
chdir(DRUPAL_ROOT);
before
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL)
from quicksilver-examples.
Tried that today and it didn't work. Still get same error. I can send you the workflow id if you want or I can put it in the pantheon support ticket. It reveals db password so I won't paste it here.
from quicksilver-examples.
Do you have any redirects in your settings.php file, or anything else that might call exit()
during bootstrap?
Have you tried #13 with your site, and seen if that works?
from quicksilver-examples.
No redirects used in the settings.php
Of the five lines in the script:
<?php
header('Content-Type: text/plain; charset=UTF-8');
define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
I've put print statements after each line and tested them. All four lines work fine (validated by the prints showing up in the output). It is only on the drupal_bootstrap line 5 that the script then fails and gives the output mentioned in the first comment.
#13 uses the deploy step for bootstrapping and I'm using the clone_database step, I'll switch my debugging script over to the deploy step and see if I can get drupal to bootstrap there.
from quicksilver-examples.
Hi Greg,
I switched my drupal debug script over to the deploy and sync_code steps and neither of them worked. They get the same error as before.
PANTHEON ERROR:
Expected status 200, got: 301 while running your Quicksilver operation.
Please check your script path is correct and try again.
from quicksilver-examples.
@danshumaker sounds like bootstrapping drupal is resulting in a redirect, probably because of something in settings.php
that's there for a good reason for normal web requests, but isn't so good for Quicksilver.
This is one of the challenges with more complex operations vis webphp. I'm sure it can be worked around, but it's also one of the reasons we are keen to offer direct invocation of Drush and WP-CLI.
from quicksilver-examples.
@joshkoenig Thanks for your response. Yes, we do indeed have a bunch of redirects in settings.php that are necessary. @greg-1-anderson , sorry about that, I didn't check my settings.php earlier when I answered you in haste.
What I'd like to do is turn off and on modules depending on the environment. So I could do this manually with drush after each database push but it seems like Quicksilver is a perfect place for this type of thing.
Specifically:
On Prod = turn off devel
On dev/test/multi = turn on devel
On dev = turn on field_ui, views_ui
On Prod = turn off field_ui, views_ui
When you say "direct inovcation of drush" are you saying to do it within php in quicksilver or via my terminal on my laptop?
Thanks again.
from quicksilver-examples.
I'll spill the beans -- I have invocations of Drush working from within a webphp script. Hopefully we will be able deploy this soon. This will help you, because once you call Drush via a simple 'passthru' or 'exec' to Drush, and bootstrapping will just work, provided that you disable your redirects. This is easier when calling your site via exec("drush...")
than bootstrapping directly in your webphp script, because php_sapi_name() == "cli"
can be used to determine if your site is being loaded from a cli script. This is the typical way that redirects in settings.php are disabled. Unfortunately, it is currently difficult to differentiate between a webphp script and a page load of your site, because the webphp environment has all of the same environment variables set as page requests. We should really set a PANTHEON_QUICKSILVER environment variable, or something of that nature, so that you can differentiate between page requests and Quicksilver calls.
Note that calling a Drush script from the webphp script is not the same as the upcoming "direct invocation" of Drush (from Quicksilver itself, rather than from within a webphp script) that Josh is talking about above. If you call Drush from your webphp script, you are still subject to the 120s timeout, and cannot affect the processing of the operation (e.g. to cancel a code sync if a sanity check fails). Direct execution (withough webphp) is also in the works, but will take longer to deliver than my simple bugfix that allows Drush to be called from within a webphp script.
from quicksilver-examples.
@greg-1-anderson Many thanks for the details. The PANTHEON_QUICKSILVER sounds very appropriate and I could foresee multiple uses for it. I'll hold tight for direct drush invocation, ENV, and/or drush within webphp stuff.
from quicksilver-examples.
You could put putenv(PANTHEON_QUICKSILVER, true);
on the first line of your webphp script, and check for that in your settings.php file.
from quicksilver-examples.
@greg-1-anderson do we have an answer for this now? ;)
from quicksilver-examples.
Yes and no. It is now possible to call drush
directly in a Quicksilver webphp script, and it will bootstrap Drupal for you. (The same sort of rework for wp-cli is also underway, but not deployed yet.) However, in the case of this particular error, the bootstrap will still fail in settings.php due to the redirect.
If you bootstrap with drush
, you should be able to test php_sapi_name() == "cli"
in your settings.php, and subvert any redirects on matches. That should fix things up for you.
from quicksilver-examples.
@greg-1-anderson Thanks Greg and Josh, I'll give that a try asap.
from quicksilver-examples.
This should be working well now. We have some examples. Thanks for helping us beta test!
from quicksilver-examples.
Related Issues (20)
- Can sync_code detect a git tag creation? HOT 1
- URL Checker value always 1 HOT 1
- Slack Notifications don't work with multidev HOT 2
- undefined variable: deploy tag in new_relic_deploy.php script HOT 2
- Example of Programmatic Backup?
- New Relic API v2 HOT 3
- Example wanted: Post Solr schema after creating new multidev env with Drupal HOT 5
- [docs] Timeout 60 seconds
- Reducing secrets.json credential overlap or confusion
- Add curl timeout to New Relic API request, to prevent hung php worker / failed deploy workflow
- Edit readme to make it clearer
- Remove SpotBot VRT script
- False positive quicksilver status on passthru HOT 10
- Is it possible to setup database version ? HOT 2
- diffy.website integration is unnecessarily tedious HOT 1
- autopilot_vrt example
- Slack integration - correct script location
- Script path and 404 while running your Quicksilver operation HOT 2
- Copying example.pantheon.yml file may cause some error
- GitHub Action from GitHub App example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quicksilver-examples.