welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 167 forks source link

failed to allocate memory (NoMemoryError) #397

Closed elebumm closed 7 years ago

elebumm commented 7 years ago

I am trying to push a large database on to the server but I get this error /usr/local/rvm/gems/ruby-2.4.0/gems/wordmove-2.0.2/lib/wordmove/sql_adapter.rb:44:ingsub!': failed to allocate memory (NoMemoryError)`

I am unsure how to fix this. Is this something wrong with Wordmove or is it something on my part?

Here is the Movefile:

local:
  vhost: "http://mysite.dev"
  wordpress_path: "/srv/www/mysite/htdocs" # use an absolute path here

  database:
    name: "mysite"
    user: "root"
    password: "root"
    host: "localhost"

production:
  vhost: "http://mysite.com"
  wordpress_path: "/var/www/mysite.com/htdocs" # use an absolute path here

  database:
    name: "mydatabase"
    user: "root"
    password: "passwordhere"
    host: "localhost"
    # port: "3308" # Use just in case you have exotic server config
    # mysqldump_options: "--max_allowed_packet=1G" # Only available if using SSH

  exclude:
    - ".git/"
    - ".gitignore"
    - ".sass-cache/"
    - "node_modules/"
    - "bin/"
    - "tmp/*"
    - "Gemfile*"
    - "Movefile"
    - "wp-config.php"
    - "wp-content/*.sql"

  # paths: # you can customize wordpress internal paths
  #   wp_content: "wp-content"
  #   uploads: "wp-content/uploads"
  #   plugins: "wp-content/plugins"
  #   mu_plugins: "wp-content/mu-plugins"
  #   themes: "wp-content/themes"
  #   languages: "wp-content/languages"

  ssh:
    host: "ssh"
    user: "root"
  #   password: "password" # password is optional, will use public keys if available.
  #   port: 22 # Port is optional
    rsync_options: "-og --chown=www-data:www-data --no-perms --chmod=ugo=rwX" # Additional rsync options, optional
  #   gateway: # Gateway is optional
  #     host: "host"
  #     user: "user"
  #     password: "password" # password is optional, will use public keys if available.

  # ftp:
  #   user: "user"
  #   password: "password"
  #   host: "host"
  #   passive: true
  #   scheme: "ftps" # default "ftp"

# staging: # multiple environments can be specified
#   [...]
alessandro-fazzi commented 7 years ago

Hi there,

how big is your big database? That's look like a good old out of memory; the default SqlAdapter in Wordmove allocates all the sql dump in memory at a time. Someway it's a weak writing code approach and there a are alternative techniques.

Unfortunately this is not am immediate fix, but should require refactor all the SqlAdapter::Default class; I cannot do it enough early to let you test something.

Anyway, with the last version we have shipped an alternative SqlAdapter; you can read more about it here. In order to use it you have to:

Let me know if this approach helps :)

elebumm commented 7 years ago

Ok, I fixed my problem. I am using VVV on my local machine and I am ssh'd on my local machine. I backed out of my VM and did a vagrant reload and it fixed my issue. Strange. Thanks for the help @pioneerskies