Git Product home page Git Product logo

grunt-wordpress-deploy's People

Contributors

darioghilardi avatar davidthou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-wordpress-deploy's Issues

Add the ability to alias tasks

I'd like to be able to type "grunt deploy" and have it run my default grunt tasks (concat, minify, etc) then run push_db and push_files

Also would like the opposite when I type "grunt pull" or something similar.

Right now there's no way (that I've found) to register a task and still add the "target" parameter.

Error 1064 (SQL syntax) when pulling DB

grunt pull_db --target="staging"

Pulling database from 'staging' into Local
>> Creating DUMP of remote database
Password:
>> Database DUMP succesfully exported to:
>> backups/staging/20150625/16-16-06/db_backup.sql
>> Adapt the database: set the correct urls for the destination in the database.
>> Creating DUMP of local database
>> Database DUMP succesfully exported to:
>> backups/local/20150625/16-16-06/db_backup.sql
>> Importing DUMP into local database
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bash: LW9@@T^x: command not found
Usage: mysqldump [OPTIONS] database [tables]
O' at line 1
>> Database imported succesfully

Operations completed

Done, without errors.

.sql file says:

bash: LW9@@T^x: command not found
Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Hey,
I am using MAMP Pro on Yosemite. I have moved the document root folder to Sites.
I am receiving the following error when running the task: grunt pull_db --target=staging

Anyone have any ideas on how to resolve this?

Thanks in advance.

Pulling database from 'staging' into Local
>> Creating DUMP of remote database
>> Database DUMP succesfully exported to:
>> backups/staging/20141205/21-29-25/db_backup.sql
>> Adapt the database: set the correct urls for the destination in the database.
>> Creating DUMP of local database
>> Database DUMP succesfully exported to:
>> backups/local/20141205/21-29-25/db_backup.sql
>> Importing DUMP into local database
Warning: Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
>> Database imported succesfully

Operations completed

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax

When I run the task I get the following error:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bash: -c: line 0: syntax error near unexpected token `)'
bash: -c: line 0: `mysq' at line 1

Not sure if this is due to my system configuration or the plugin.

The error appears in the the staging .sql dumps but the grunt task says everything completes successfully. So it fails silently unless you add the flags --verbose --debug when calling the command.

The local db dump file shows correct SQL information.

Add support for Vagrant VM

Could this be as simple as adding the ssh_host option for local environment?

Currently I'd have to manually ssh into vagrant, cd into theme directory where my gruntfile.js is located and run commands to push & pull database.

Add 'table_prefix' config var [enhancement]

Hey thanks for releasing this module! I've been looking around a bunch for a better WP deployment flow and this is really helpful.

It'd be great if you could also add a 'table_prefix' var that could dump only tables with that prefix. On my local machine (and sometimes on production, specifically with crappy shared hosts) I'll run a few wp installs and I only want to dump/pull down one of those. I'm new to grunt so I can try my hand at it and submit a PR if I get anywhere on it myself...

Precise ssh port

I changed my ssh port for security reasons. Can i specify a custom port ?

Error importing DB due to passwords

This was a problem with grunt-deployments, so was probably not fixed at the time you forked that project.

In at least some versions of MySQL, if you put the DB password on the command line with the -p argument, the first line of the resulting .sql file will be:
"Warning: Using a password on the command line interface can be insecure."

When you then try to load this into another DB, it fails because of invalid SQ syntaxL.

A solution is to change the templates as follows:

mysqldump: "MYSQL_PWD=<%= pass %> mysqldump -h <%= host %> -u<%= user %> <%= database %>",
mysql: "MYSQL_PWD=<%= pass %> mysql -h <%= host %> -u <%= user %> <%= database %>",

Wordpress multisite support

Pardon me for asking, because this might be a stupid question, but:

Is there a way to target only a subsite (on a wordpress multisite install) with grunt-wordpress-deploy? We're working with 100+ live sites on the production environment and would like to prevent accidental overwrites.

Also it would be faster to just push and pull only the targeted subsite. Would love to hear from you, and thanks for a wonderful plugin!

Escaping spaces

The script seems to fail in the execution of mysql/mysqldump shell command execution if the password contains spaces.

Running tasks

The example gruntfile in the readme runs "wordpressdeploy" which results in:
Warning: Task "wordpressdeploy" not found. Use --force to continue.

I can run the built-in tasks like "grunt push_files --target=staging", but how should they be incorporated into the default task? Maybe a noob question :)

Thanks!

Recommendation for improvement: Target as task argument

Allow the target to be specified as a task argument like "pull_db:prod", in addition to allowing it as an option or command-line argument (--target=).

Doing so allows multiple step tasks like:

grunt.registerTask('createtest', ['db_pull:prod", 'db_push:staging"]);

Move sensible data outside of the Gruntfile.

Sensible data, like database username and password, should be written in a different file than the Gruntfile. This way you can add to version control the Gruntfile without any privacy problem.

pull_files goes in wrong directory when target path is missing trailing slash

I've been trying to pull files from an environment to my local, and the files were not being added to the path that I've set in the local "path":.
I've tried debugging it and figured out that if the target path is missing a trailing slash, it creates another folder in the local path directory, named after the target path's basename folder. Here's what I mean:

target path: "path": "/var/www/target_directory"
local path: "path": "/var/www/local_directory"
would add files in /var/www/local_directory/target_directory

Hope that makes sense. It wasn't mentioned in the docs, and the example is also missing the trailing slash.

utf8mb4_unicode_ci

With the WordPress 4.2, the new table collation is utf8mb4_unicode_ci. However that generates an error using grunt-wordpress-deploy:

ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_unicode_ci'

db push not working

I run the taks grunt push_db --target=staging
this is the result:

Pushing database from 'Local' to 'staging'
>> Creating DUMP of local database
>> Database DUMP succesfully exported to:
>> backups/local/20141210/02-58-28/db_backup.sql
>> Adapt the database: set the correct urls for the destination in the database.
>> Creating DUMP of remote database
>> Database DUMP succesfully exported to:
>> backups/staging/20141210/02-58-28/db_backup.sql
>> Importing DUMP into remote database
>> Database imported succesfully

Seems ok but when i enter the staging url the database is not updated. I thought the task upload the new db into my server.

am i wrong?

Warning message in SQL dump

Hi,

I found Warning: Using a password on the command line interface can be insecure.
was appearing on line 1 of my staging sql dump file. This was causing SQL syntax error when trying to import locally.

I didn't use SSH host option to connect to the server not sure if this has something to do with the error message?

I found the same problem referenced here: http://stackoverflow.com/questions/20751352/suppress-warning-messages-using-mysql-from-within-terminal-but-password-written which suggests to use mysql_config_editor http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html.

As a temporary fix I removed the warning message by adding:

var preoutput = exports.replace_urls(old_url, new_url, content);
var output = exports.replace_urls("Warning: Using a password on the command line interface can be insecure.", " ", preoutput);

In util.js https://github.com/webrain/grunt-wordpress-deploy/blob/master/tasks/lib/util.js#L89

Am I authenticating wrong which is causing the warning to appear? Authenticating using the ssh_host option seemed to not allow the sqldump to generate due to -jailshell: FkX: command not found errors appearing when trying to dump on the live server.

Thanks!

Unknown issue with url replacement (solved in pull request)

I have tried to push two different wordpress installations and both have had issues, either losing their widgets, random data or simply not working at all. I think it has something to do with the url replacement. If I leave my staging url identical to my local url and use http://github.com/interconnectit/search-replace-db after pushing the db, it works perfectly.

The difference I see is that "search-replace-db" uses the php @unserialize and then re-serializes which are both built in php functions. The "replace_urls_in_serialized" of course can't leverage these methods but there might be some issue with the regular expression being used.

pull_db not working properly

running pull_db --target=staging returns:

mysqldump: Got error: 1045: "Access denied for user 'wpdeploy'@'ip.of.our.server' (using password: YES)" when trying to connect

staging: {
"title": "staging",
"database": "MWPdb",
"user": "wpdeploy",
"pass": "somepassword",
"host": "our.server.com",
"url": "http://our.server.com",
"path": "/opt/sites/www/wordpress",
"ssh_host": "[email protected]"
}

But when I run the command:
mysqldump -h our.server.com -u wpdeploy -p MWPdb

It just downloads the SQL. (ofc I entered the password first)

Database Synch Not Search/Replacing or Serializing Data

I have my local and development environments setup. The files are successfully pushed to the development server and the local database is also pushed to the development server, but the values of the database are not changed (i.e. it doesn't seem like the search and replace nor the serializing data is happening on the database before it gets pushed to the development server). Any thoughts? I am posting my Gruntfile.js code below, but have changed some of the values for security purposes.

wordpressdeploy: {
      options: {
        backup_dir: "backups/",
        rsync_args: ['--verbose', '--progress', '-rlpt', '--compress', '--omit-dir-times', '--delete'],
        exclusions: ['Gruntfile.js', '.git/', 'tmp/*', 'backups/', 'wp-config.php', 'composer.json', 'composer.lock', 'README.md', '.gitignore', 'package.json', 'node_modules', '*.sublime-workspace', '*.sublime-project']
      },
      local: {
        "title": "local",
        "database": "snoringdoc",
        "user": "root",
        "pass": "root",
        "host": "localhost",
        "url": "http://localhost/Snoring-Doc/",
        "path": "/Applications/MAMP/htdocs/Snoring-Doc/"
      },
      dev: {
        "title": "dev",
        "database": "dev_snoringdoc",
        "user": "dev_admin",
        "pass": "notactualpassword",
        "host": "localhost",
        "url": "http://snoringdoc.dev.com",
        "path": "/home/dev/public_html/snoringdoc",
        "ssh_host": "[email protected]"
      }
    },

Write to wp-config.php

Just thinking out loud: it might be nice if, instead of ignoring wp-config.php, this tool actually wrote to wp-config.php, updating it with the provided environment's database credentials and URLs (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, WP_HOME) during a file deploy. Since all that information is already present in-the-clear in the Gruntfile.js, why not provide a way to provide that information to the config file during a deployment?

MariaDB

I'm getting the following error when trying to push DB to MariaDB on a production server.

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/bin/sh: mysqldump: command not found' at line 1

Does it work with MariaDB?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.