GithubHelp home page GithubHelp logo

magepsycho / magento2-db-code-backup-bash-script Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 6.0 303 KB

Bash Script: Backup Magento2 Code + Database

Home Page: https://blog.magepsycho.com/bash-script-easily-backup-magento2-code-files-database/

Shell 100.00%
backup-database backup-files backup-script bash-script centos code database debian linux magento magento2 media shell-script ssh terminal ubuntu

magento2-db-code-backup-bash-script's Introduction

Hi, I am Raj KB ๐Ÿ‘‹

A passionate full-stack developer & indie hacker

magepsycho

magepsycho

magepsycho

Adobe Magento Extensions

Premium Extensions

FREE Extensions

Connect with me:

magepsycho magepsycho magepsycho 887385 @magepsycho @magepsycho

Languages and Tools:

aws babel bash circleci codeigniter css3 cypress docker elasticsearch express figma firebase git graphql html5 javascript jenkins laravel linux mongodb mysql nginx nodejs php postgresql postman rabbitMQ react reactnative redis redux rust sass selenium solr sqlite symfony tailwind typescript webpack

Support:

magepsycho



magepsycho

ย magepsycho

magepsycho

magento2-db-code-backup-bash-script's People

Contributors

magepsycho 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

Watchers

 avatar  avatar  avatar

magento2-db-code-backup-bash-script's Issues

re: Restore

Any chance you can share a restore script based on this backup script?

Issue with redis

When redis is enabled for sessions a variable called 'host' exists within this part of the config.
When the script runs the following command
grep host "app/etc/env.php" | cut -d "'" -f 4

It returns 2 lines. In my case it returns the following
localhost (from the db config)
127.0.0.1 (from the session config)

This breaks the mysqldump command.
For now I have manually entered localhost into the script instead of letting it look it up in env.php, but the script needs a means of differentiating between multiple 'host' variables in env.php

Below is my session config for reference.
'session' => [
'save' => 'redis',
'redis' => [
'host' => '127.0.0.1',
'port' => '6379',
'password' => '',
'timeout' => '2.5',
'persistent_identifier' => '',
'database' => '2',
'compression_threshold' => '2048',
'compression_library' => 'gzip',
'log_level' => '1',
'max_concurrency' => '6',
'break_after_frontend' => '5',
'break_after_adminhtml' => '30',
'first_lifetime' => '600',
'bot_first_lifetime' => '60',
'bot_lifetime' => '7200',
'disable_locking' => '0',
'min_lifetime' => '60',
'max_lifetime' => '2592000'
]
],

tput: No value for $TERM and no -T specified

Hi
Firstly thanks for creating this tool, I find it really useful.

I am running the following command as a nightly cronjob on my Ubuntu 20.04 box and I get the following output

/usr/local/bin/mage2-backup --backup-code --skip-media --use-mysql-config --src-dir=/var/www/html --dest-dir=/S3/backups/LIVE/CODE/

tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified

Cheers
Rob

incorporate GDPR-dump as an alternate for anonymised backups

Hi, more of a feature request than a bug, but it would massively streamline operations if you could incorporate the drop-in replacement for mysqldump, GDPR-dump that can be called by an --anonymous flag in the command:

https://github.com/machbarmacher/gdpr-dump

example usage: ./mage2-backup.sh --backup-code --skip-media --anonymous --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination

the drop in version of gdpr-dump needs parameters added to a [mysqldump] section in the user's my.cnf file but would certainly smooth things in terms of dev environments considerably.

(there is a non-drop in version by https://github.com/Smile-SA/gdpr-dump that has more configurable options through a .yaml but i imagine that would be more hassle to incorporate, it is however more actively developed)

app/etc/env.php missing

What is the reason for excluding app/etc/env.php when creating the codebase archive? We just tried to perform a restore and realised the file is missing which prevents the restored site from working.

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.