ssbak-test

command module
v0.0.0-...-fe5cfc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 1 Imported by: 0

README

SSBak - sspak database/asset backup & restore tool for Silverstripe

Go Report Card

SSBak is a backup & restore tool for Silverstripe websites, written in Go. It backs up the assets and database, and is heavily based on (and largely compatible with) SSPak.

Why rewrite SSPak?

It was written to solve the backup/restore size limitations of the original SSPak utility, and can largely work as a drop-in replacement for SSPak (see features and limitations). SSPak has a nasty file size limitation due to undocumented PharData limits (see 1, 2 and 3). I have personally experienced these issues with SSPak and archives over 4GB, which resulted in partial asset backups with no warnings or errors at the time of backup.

SSBak does not have these file size limitations.

Features

  • Compatible with the default *.sspak file format (tar non-executable files).
  • Create and restore database and/or assets from a Silverstripe website regardless of asset / database size.
  • Optionally create or restore without resampled images (--ignore-resampled). Note: this skips most common image manipulations except for ResizedImages which are usually generated for HTMLText and cannot be regenerated "on the fly".
  • SSBak does not require (or use) PHP at all (see limitations).
  • Multiplatform static binaries (Linux, Mac & Windows). The only system requirements are mysql(.exe) and mysqldump(.exe) in your path. All other actions such as tar, gzip etc are handled directly in SSBak.
  • Checks temporary and output locations have sufficient storage space before doing operations (Linux / Mac only)
  • Optional verbose output to see what it is doing.
  • Shell completion (see ssbak completion -h)

Usage

SSBak - sspak database/asset backup & restore tool for Silverstripe.

Support/Documentation
  https://github.com/axllent/ssbak-test

Usage:
  ssbak [command]

Available Commands:
  extract      Extract .sspak backup
  load         Restore database and/or assets from .sspak backup
  save         Create .sspak backup of database and/or assets
  saveexisting Create .sspak backup from existing database SQL dump and/or assets
  version      Display the app version & update information

Flags:
  -h, --help   help for ssbak

Use "ssbak [command] --help" for more information about a command.

Installation & requirements

  • Download a suitable binary for your architecture (see releases), extract the make it executable and place it in your $PATH. You can optionally save this as SSPak to use as a drop-in replacement for SSPak (see limitations).
  • MySQL and MySQLDump must be installed and in your $PATH. SSBak uses these system tools for backing up and restoring database backups.

To compile SSBak from source: go get -u github.com/axllent/ssbak-test (Go >= 1.11 required).

Environment settings

SSBak automatically tries to parse either a .env or a _ss_environment.php in your webroot to detect the database settings. You can however export (or override) any of the following values by exporting them first in your shell:

  • SS_DATABASE_SERVER (required)
  • SS_DATABASE_NAME (required) (supports SS_DATABASE_PREFIX, SS_DATABASE_SUFFIX & SS_DATABASE_CHOOSE_NAME)
  • SS_DATABASE_USERNAME (required)
  • SS_DATABASE_PASSWORD
  • SS_DATABASE_PORT
  • SS_DATABASE_CLASS (currently only MySQL supported & defaults to MySQL if unspecified)

By default SSBak uses your system temporary directory (eg: /tmp/ on Linux/Mac) to save and load the temporary files from your .sspak archive. You can override this path by setting the TMPDIR in your command:

TMPDIR="/drive/with/more/space" ssbak save . website.sspak

Limitations

SSBak is designed as a database & asset backup & restore tool, and is largely drop-in replacement for the existing SSPak tool. There are however a few limitations:

  • SSBak currently only supports MySQL databases. If there is demand for PostgreSQL then this can be requested and may be added in the future.
  • SSBak is written in Go which does not have any PHP-parsing capabilities (it uses regular expressions). For all database dump & restore operations it requires either a .env or a _ss_environment.php file containing SS_DATABASE_SERVER, SS_DATABASE_USERNAME, SS_DATABASE_PASSWORD & SS_DATABASE_NAME in the root or parent directory of your website folder. You can however also export the required variables (see Environment settings).
  • It does not (yet?) support remote ssh storage, git-remote / install, or CSV import/export features from SSPak.

Issues & vulnerabilities

Issues and vulnerabilities should be reported via the Github issues tracker.

Contributing

Code contributions should be supplied in the form of a merge request, and forked from the develop branch.

Documentation

Overview

Copyright 2020-Now() Ralph Slooten <axllent@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL