diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..2eb7290 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,8 @@ +[bumpversion] +current_version = 2.0.0 +commit = True +tag = False + +[bumpversion:file:omnibus-undrop-for-innodb/config/projects/undrop-for-innodb.rb] +search = build_version '{current_version}' +replace = build_version '{new_version}' diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..bcaee72 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [akuzminsky] diff --git a/.gitignore b/.gitignore index 37d83c8..660f3fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ innochecksum_changer lex.yy.c sql_parser.c stream_parser +.DS_Store diff --git a/Makefile b/Makefile index d9ce3f7..5ab8586 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,15 @@ TARGETS = stream_parser c_parser innochecksum_changer SRCS = stream_parser.c include/mysql_def.h c_parser.c INC_PATH = -I./include LIBS = -pthread -lm -BINDIR = ./bin +BINDIR ?= ./bin CC ?= gcc INSTALL ?=install YACC = bison LEX = flex +OS_VERSION ?= jammy + CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -fgnu89-inline INSTALLFLAGS ?=-s CentOS5 = $(findstring .el5,$(shell cat /proc/version)) @@ -67,10 +69,27 @@ install: $(TARGETS) clean: rm -f $(OBJECTS) $(TARGETS) lex.yy.c sql_parser.c sql_parser.output sys_parser rm -f *.o *.core + rm -rf omnibus-undrop-for-innodb/pkg/ + +package: ## Build package - OS_VERSION can be: focal, jammy. + @docker run \ + -v $(shell pwd):/undrop-for-innodb \ + --name builder_undrop \ + --rm \ + --env OS_VERSION=${OS_VERSION} \ + "twindb/omnibus-ubuntu:${OS_VERSION}" \ + bash -l /undrop-for-innodb/omnibus-undrop-for-innodb/omnibus_build.sh + docker-start: @docker run \ - -v $(shell pwd):/undrop-for-innodb \ - -it \ - --rm \ - centos:7 bash -l + -v $(shell pwd):/undrop-for-innodb \ + -it \ + --name builder_undrop \ + --rm \ + --dns 8.8.8.8 \ + --dns 208.67.222.222 \ + --env PLATFORM=${PLATFORM} \ + --env OS_VERSION=${OS_VERSION} \ + "twindb/omnibus-ubuntu:${OS_VERSION}" \ + bash -l diff --git a/README.md b/README.md index a997318..a90d9e2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # TwinDB data recovery toolkit ## Supported Failures -[![Join the chat at https://gitter.im/twindb/undrop-for-innodb](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/twindb/undrop-for-innodb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Join the chat at https://gitter.im/twindb/undrop-for-innodb](https://badges.gitter.im/Join%20Chat.svg)](https://matrix.to/#/#twindb_undrop-for-innodb_undrop-for-innodb:gitter.im) + TwinDB Data Recovery Toolkit is a set of tools that operate with MySQL files at low level and allow to recover InnoDB databases after different failure scenarios. The toolkit is also known as **UnDrop for InnoDB**, which is more accurate name because the toolkit works with InnoDB tables. @@ -17,6 +18,25 @@ The tool recovers data when backups are not available. It supports recovery from - InnoDB files were accidentally deleted. - A table was dropped and created empty one. ## Installation + + +Undrop for InnoDB overview with installation instructions and demo. +[![Undrop for InnoDB overview](https://img.youtube.com/vi/-1LeLhGjAWM/0.jpg)](https://www.youtube.com/watch?v=-1LeLhGjAWM) + +### From packages + +For Ubuntu `focal` and `jammy` you can install the toolkit from +a Debian package. + +```shell +# export CODENAME="jammy" +# curl "https://infrahouse-release-$CODENAME.s3.us-west-1.amazonaws.com/pool/main/u/undrop-for-innodb/undrop-for-innodb_2.0.0-1_amd64.deb" > undrop-for-innodb_2.0.0-1_amd64.deb +# apt install ./undrop-for-innodb_2.0.0-1_amd64.deb +``` + + +### From sources + The source code of the toolkit is hosted on GitHub. The tool has been developed on Linux, it’s known to work on CentOS 4,5,6,7, Debian, Ubuntu and Amazon Linux. Only 64 bit systems are supported. To best way to get the source code is to clone it from GitHub. @@ -34,25 +54,3 @@ To build the toolkit run make in the source code root: ``` # make ``` -## Usage -There is a series of blog posts that describe in great details recovery from different failures. - - * [Recover Table Structure From InnoDB Dictionary](https://twindb.com/recover-table-structure-from-innodb-dictionary/) – how to generate CREATE TABLE statement if you have ibdata1 file. - * [Take image from corrupted hard drive](https://twindb.com/take-image-from-corrupted-hard-drive/) – what you should do if a hard disk is dying. - * [Recover Corrupt MySQL Database](https://twindb.com/recover-corrupt-mysql-database/) – how to recover database from corrupt InnoDB tablespace. The same approach can be taken to recover from corrupt file system. - * [Recover after DROP TABLE. Case 2](https://twindb.com/recover-after-drop-table-innodb_file_per_table-on/) – how to recover InnoDB table if it was dropped and innodb_file_per_table was ON (a separate .ibd file per table). - * [Recover after DROP TABLE. Case 1](https://twindb.com/recover-innodb-table-after-drop-table-innodb/) – how to recover InnoDB table if it was dropped and innodb_file_per_table was OFF (all tables are in ibadat1 file). - * [Recover InnoDB dictionary](https://twindb.com/how-to-recover-innodb-dictionary/) – how to recover and read InnoDB dictionary tables. - * [UnDROP tool for InnoDB](https://twindb.com/undrop-tool-for-innodb/) – describes tools of the toolkit, their usage, command line options. - * [InnoDB dictionary](https://twindb.com/innodb-dictionary/) – describes InnoDB dictionary, its tables and format. - * [Overview of Undrop-for-InnoDB](https://yq.aliyun.com/articles/281230?utm_content=m_37044) - Recovery after DROP table, `innodb_file_per_table` ON and OFF, corrupted database recovery (在普通话) - -## Commercial Support and Data Recovery Service - -You can recover your database using the toolkit and detailed instructions from the blog posts. -We can help you to do it much faster. - -[Aleksandr Kuzminsky](https://www.linkedin.com/in/akuzminsky) is an author of TwinDB data recovery toolkit and its forks. -Since 2008 he dealt with many hundreds recovery cases. - -Check [MySQL Data Recovery Service](https://twindb.com/mysql-data-recovery/) to learn more about prices, prerequisites and contact details. diff --git a/omnibus-undrop-for-innodb/.gitignore b/omnibus-undrop-for-innodb/.gitignore new file mode 100644 index 0000000..cd0f4a1 --- /dev/null +++ b/omnibus-undrop-for-innodb/.gitignore @@ -0,0 +1,10 @@ +*.gem +.bundle +.kitchen/ +.kitchen.local.yml +vendor/bundle +pkg/* +.vagrant +bin/* +files/**/cache/ +vendor/cookbooks diff --git a/omnibus-undrop-for-innodb/.kitchen.yml b/omnibus-undrop-for-innodb/.kitchen.yml new file mode 100644 index 0000000..699e69d --- /dev/null +++ b/omnibus-undrop-for-innodb/.kitchen.yml @@ -0,0 +1,41 @@ +driver: + name: vagrant + forward_agent: yes + customize: + cpus: 2 + memory: 2048 + synced_folders: + - ['.', '/home/vagrant/undrop-for-innodb'] + +provisioner: + name: chef_zero + +platforms: + - name: centos-6 + run_list: yum-epel::default + - name: centos-7 + run_list: yum-epel::default + - name: debian-8 + run_list: apt::default + - name: debian-9 + run_list: apt::default + - name: freebsd-10 + run_list: freebsd::portsnap + - name: freebsd-11 + run_list: freebsd::portsnap + - name: ubuntu-14.04 + run_list: apt::default + - name: ubuntu-16.04 + run_list: apt::default + - name: ubuntu-18.04 + run_list: apt::default + +suites: + - name: default + run_list: omnibus::default + attributes: + omnibus: + build_user: vagrant + build_user_group: vagrant + build_user_password: vagrant + install_dir: /opt/undrop-for-innodb diff --git a/omnibus-undrop-for-innodb/Berksfile b/omnibus-undrop-for-innodb/Berksfile new file mode 100644 index 0000000..acac58e --- /dev/null +++ b/omnibus-undrop-for-innodb/Berksfile @@ -0,0 +1,12 @@ +source 'https://supermarket.chef.io' + +cookbook 'omnibus' + +# Uncomment to use the latest version of the Omnibus cookbook from GitHub +# cookbook 'omnibus', github: 'chef-cookbooks/omnibus' + +group :integration do + cookbook 'apt', '~> 2.8' + cookbook 'freebsd', '~> 0.3' + cookbook 'yum-epel', '~> 0.6' +end diff --git a/omnibus-undrop-for-innodb/Gemfile b/omnibus-undrop-for-innodb/Gemfile new file mode 100644 index 0000000..d8e515c --- /dev/null +++ b/omnibus-undrop-for-innodb/Gemfile @@ -0,0 +1,21 @@ +source 'https://rubygems.org' + +# Install omnibus +gem 'omnibus', '~> 9.0' + +# Use Chef's software definitions. It is recommended that you write your own +# software definitions, but you can clone/fork Chef's to get you started. +# gem 'omnibus-software', github: 'chef/omnibus-software' + +# This development group is installed by default when you run `bundle install`, +# but if you are using Omnibus in a CI-based infrastructure, you do not need +# the Test Kitchen-based build lab. You can skip these unnecessary dependencies +# by running `bundle install --without development` to speed up build times. +group :development do + # Use Berkshelf for resolving cookbook dependencies + gem 'berkshelf' + + # Use Test Kitchen with Vagrant for converging the build environment + gem 'test-kitchen' + gem 'kitchen-vagrant' +end diff --git a/omnibus-undrop-for-innodb/Gemfile.lock b/omnibus-undrop-for-innodb/Gemfile.lock new file mode 100644 index 0000000..e23bc82 --- /dev/null +++ b/omnibus-undrop-for-innodb/Gemfile.lock @@ -0,0 +1,373 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + awesome_print (1.9.2) + aws-eventstream (1.2.0) + aws-partitions (1.809.0) + aws-sdk-core (3.181.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.71.0) + aws-sdk-core (~> 3, >= 3.177.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.116.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sdk-secretsmanager (1.82.0) + aws-sdk-core (~> 3, >= 3.177.0) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.6.0) + aws-eventstream (~> 1, >= 1.0.2) + bcrypt_pbkdf (1.1.0) + berkshelf (8.0.7) + chef (>= 15.7.32) + chef-config + cleanroom (~> 1.0) + concurrent-ruby (~> 1.0) + minitar (>= 0.6) + mixlib-archive (>= 1.1.4, < 2.0) + mixlib-config (>= 2.2.5) + mixlib-shellout (>= 2.0, < 4.0) + octokit (~> 4.0) + retryable (>= 2.0, < 4.0) + solve (~> 4.0) + thor (>= 0.20) + builder (3.2.4) + chef (17.10.0) + addressable + aws-sdk-s3 (~> 1.91) + aws-sdk-secretsmanager (~> 1.46) + chef-config (= 17.10.0) + chef-utils (= 17.10.0) + chef-vault + chef-zero (>= 14.0.11) + corefoundation (~> 0.3.4) + diff-lcs (>= 1.2.4, < 1.6.0, != 1.4.0) + erubis (~> 2.7) + ffi (>= 1.5.0) + ffi-libarchive (~> 1.0, >= 1.0.3) + ffi-yajl (~> 2.2) + iniparse (~> 1.4) + inspec-core (~> 4.23) + license-acceptance (>= 1.0.5, < 3) + mixlib-archive (>= 0.4, < 2.0) + mixlib-authentication (>= 2.1, < 4) + mixlib-cli (>= 2.1.1, < 3.0) + mixlib-log (>= 2.0.3, < 4.0) + mixlib-shellout (>= 3.1.1, < 4.0) + net-sftp (>= 2.1.2, < 4.0) + ohai (~> 17.0) + plist (~> 3.2) + proxifier (~> 1.0) + syslog-logger (~> 1.6) + train-core (~> 3.2, >= 3.2.28) + train-winrm (>= 0.2.5) + uuidtools (>= 2.1.5, < 3.0) + vault (~> 0.16) + chef-cleanroom (1.0.5) + chef-config (17.10.0) + addressable + chef-utils (= 17.10.0) + fuzzyurl + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) + tomlrb (~> 1.2) + chef-telemetry (1.1.1) + chef-config + concurrent-ruby (~> 1.0) + chef-utils (17.10.0) + concurrent-ruby + chef-vault (4.1.11) + chef-zero (15.0.11) + ffi-yajl (~> 2.2) + hashie (>= 2.0, < 5.0) + mixlib-log (>= 2.0, < 4.0) + rack (~> 2.0, >= 2.0.6) + uuidtools (~> 2.1) + webrick + citrus (3.0.2) + cleanroom (1.0.0) + coderay (1.1.3) + concurrent-ruby (1.2.2) + contracts (0.16.1) + corefoundation (0.3.13) + ffi (>= 1.15.0) + diff-lcs (1.5.0) + ed25519 (1.3.0) + erubi (1.12.0) + erubis (2.7.0) + faraday (1.4.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + multipart-post (>= 1.2, < 3) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday_middleware (1.2.0) + faraday (~> 1.0) + ffi (1.15.5) + ffi-libarchive (1.1.3) + ffi (~> 1.0) + ffi-yajl (2.6.0) + libyajl2 (>= 1.2) + fuzzyurl (0.9.0) + gssapi (1.3.1) + ffi (>= 1.0.1) + gyoku (1.4.0) + builder (>= 2.1.2) + rexml (~> 3.0) + hashie (4.1.0) + httpclient (2.8.3) + iniparse (1.5.0) + inspec-core (4.56.20) + addressable (~> 2.4) + chef-telemetry (~> 1.0, >= 1.0.8) + faraday (>= 0.9.0, < 1.5) + faraday_middleware (~> 1.0) + hashie (>= 3.4, < 5.0) + license-acceptance (>= 0.2.13, < 3.0) + method_source (>= 0.8, < 2.0) + mixlib-log (~> 3.0) + multipart-post (~> 2.0) + parallel (~> 1.9) + parslet (>= 1.5, < 2.0) + pry (~> 0.13) + rspec (>= 3.9, <= 3.11) + rspec-its (~> 1.2) + rubyzip (>= 1.2.2, < 3.0) + semverse (~> 3.0) + sslshake (~> 1.2) + thor (>= 0.20, < 2.0) + tomlrb (>= 1.2, < 2.1) + train-core (~> 3.0) + tty-prompt (~> 0.17) + tty-table (~> 0.10) + iostruct (0.0.5) + ipaddress (0.8.3) + jmespath (1.6.2) + json (2.6.3) + kitchen-vagrant (1.14.1) + test-kitchen (>= 1.4, < 4) + libyajl2 (2.1.0) + license-acceptance (2.1.13) + pastel (~> 0.7) + tomlrb (>= 1.2, < 3.0) + tty-box (~> 0.6) + tty-prompt (~> 0.20) + license_scout (1.3.6) + ffi-yajl (~> 2.2) + mixlib-shellout (>= 2.2, < 4.0) + toml-rb (>= 1, < 3) + little-plugger (1.1.4) + logging (2.3.1) + little-plugger (~> 1.1) + multi_json (~> 1.14) + method_source (1.0.0) + minitar (0.9) + mixlib-archive (1.1.7) + mixlib-log + mixlib-authentication (3.0.10) + mixlib-cli (2.1.8) + mixlib-config (3.0.27) + tomlrb + mixlib-install (3.12.27) + mixlib-shellout + mixlib-versioning + thor + mixlib-log (3.0.9) + mixlib-shellout (3.2.7) + chef-utils + mixlib-versioning (1.2.12) + molinillo (0.8.0) + multi_json (1.15.0) + multipart-post (2.3.0) + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-sftp (2.1.2) + net-ssh (>= 2.6.5) + net-ssh (7.2.0) + net-ssh-gateway (2.0.0) + net-ssh (>= 4.0.0) + nori (2.6.0) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + ohai (17.9.1) + chef-config (>= 14.12, < 18) + chef-utils (>= 16.0, < 18) + ffi (~> 1.9) + ffi-yajl (~> 2.2) + ipaddress + mixlib-cli (>= 1.7.0) + mixlib-config (>= 2.0, < 4.0) + mixlib-log (>= 2.0.1, < 4.0) + mixlib-shellout (~> 3.2, >= 3.2.5) + plist (~> 3.1) + train-core + wmi-lite (~> 1.0) + omnibus (9.0.22) + aws-sdk-s3 (~> 1.116.0) + chef-cleanroom (~> 1.0) + chef-utils (>= 15.4) + contracts (>= 0.16.0, < 0.17.0) + ffi-yajl (~> 2.2) + license_scout (~> 1.0) + mixlib-shellout (>= 2.0, < 4.0) + mixlib-versioning + ohai (>= 16, < 19) + pedump + rexml (~> 3.2) + ruby-progressbar (~> 1.7) + thor (>= 0.18, < 2.0) + parallel (1.23.0) + parslet (1.8.2) + pastel (0.8.0) + tty-color (~> 0.5) + pedump (0.6.6) + awesome_print + iostruct (>= 0.0.4) + multipart-post (>= 2.0.0) + rainbow + zhexdump (>= 0.0.2) + plist (3.7.0) + proxifier (1.0.3) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (5.0.3) + rack (2.2.8) + rainbow (3.1.1) + retryable (3.0.5) + rexml (3.2.6) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.11.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-support (3.11.1) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + rubyntlm (0.6.3) + rubyzip (2.3.2) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + semverse (3.0.2) + solve (4.0.4) + molinillo (~> 0.6) + semverse (>= 1.1, < 4.0) + sslshake (1.3.1) + strings (0.2.1) + strings-ansi (~> 0.2) + unicode-display_width (>= 1.5, < 3.0) + unicode_utils (~> 1.4) + strings-ansi (0.2.0) + syslog-logger (1.6.8) + test-kitchen (3.5.0) + bcrypt_pbkdf (~> 1.0) + chef-utils (>= 16.4.35) + ed25519 (~> 1.2) + license-acceptance (>= 1.0.11, < 3.0) + mixlib-install (~> 3.6) + mixlib-shellout (>= 1.2, < 4.0) + net-scp (>= 1.1, < 5.0) + net-ssh (>= 2.9, < 8.0) + net-ssh-gateway (>= 1.2, < 3.0) + thor (>= 0.19, < 2.0) + winrm (~> 2.0) + winrm-elevated (~> 1.0) + winrm-fs (~> 1.1) + thor (1.2.2) + toml-rb (2.2.0) + citrus (~> 3.0, > 3.0) + tomlrb (1.3.0) + train-core (3.10.8) + addressable (~> 2.5) + ffi (!= 1.13.0) + json (>= 1.8, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + net-scp (>= 1.2, < 5.0) + net-ssh (>= 2.9, < 8.0) + train-winrm (0.2.13) + winrm (>= 2.3.6, < 3.0) + winrm-elevated (~> 1.2.2) + winrm-fs (~> 1.0) + tty-box (0.7.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-cursor (~> 0.7) + tty-color (0.6.0) + tty-cursor (0.7.1) + tty-prompt (0.23.1) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.9.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) + unicode-display_width (2.4.2) + unicode_utils (1.4.0) + uuidtools (2.2.0) + vault (0.17.0) + aws-sigv4 + webrick (1.8.1) + winrm (2.3.6) + builder (>= 2.1.2) + erubi (~> 1.8) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0, >= 0.6.3) + winrm-elevated (1.2.3) + erubi (~> 1.8) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.3.5) + erubi (~> 1.8) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 2.0) + winrm (~> 2.0) + wisper (2.0.1) + wmi-lite (1.0.7) + zhexdump (0.0.2) + +PLATFORMS + ruby + x86_64-linux + +DEPENDENCIES + berkshelf + kitchen-vagrant + omnibus (~> 9.0) + test-kitchen + +BUNDLED WITH + 2.3.5 diff --git a/omnibus-undrop-for-innodb/README.md b/omnibus-undrop-for-innodb/README.md new file mode 100644 index 0000000..a7eef9e --- /dev/null +++ b/omnibus-undrop-for-innodb/README.md @@ -0,0 +1,124 @@ +undrop-for-innodb Omnibus project +================================= +This project creates full-stack platform-specific packages for +`undrop-for-innodb`! + +Installation +------------ +You must have a sane Ruby 2.0.0+ environment with Bundler installed. Ensure all +the required gems are installed: + +```shell +$ bundle install --binstubs +``` + +Usage +----- +### Build + +You create a platform-specific package using the `build project` command: + +```shell +$ bin/omnibus build undrop-for-innodb +``` + +The platform/architecture type of the package created will match the platform +where the `build project` command is invoked. For example, running this command +on a MacBook Pro will generate a Mac OS X package. After the build completes +packages will be available in the `pkg/` folder. + +### Clean + +You can clean up all temporary files generated during the build process with +the `clean` command: + +```shell +$ bin/omnibus clean undrop-for-innodb +``` + +Adding the `--purge` purge option removes __ALL__ files generated during the +build including the project install directory (`/opt/undrop-for-innodb`) and +the package cache directory (`/var/cache/omnibus/pkg`): + +```shell +$ bin/omnibus clean undrop-for-innodb --purge +``` + +### Publish + +Omnibus has a built-in mechanism for releasing to a variety of "backends", such +as Amazon S3. You must set the proper credentials in your +[`omnibus.rb`](omnibus.rb) config file or specify them via the command line. + +```shell +$ bin/omnibus publish path/to/*.deb --backend s3 +``` + +### Help + +Full help for the Omnibus command line interface can be accessed with the +`help` command: + +```shell +$ bin/omnibus help +``` + +Version Manifest +---------------- + +Git-based software definitions may specify branches as their +default_version. In this case, the exact git revision to use will be +determined at build-time unless a project override (see below) or +external version manifest is used. To generate a version manifest use +the `omnibus manifest` command: + +``` +omnibus manifest PROJECT -l warn +``` + +This will output a JSON-formatted manifest containing the resolved +version of every software definition. + + +Kitchen-based Build Environment +------------------------------- +Every Omnibus project ships with a project-specific +[Berksfile](https://docs.chef.io/berkshelf.html) that will allow you to build +your omnibus projects on all of the platforms listed in the +[`.kitchen.yml`](.kitchen.yml). You can add/remove additional platforms as +needed by changing the list found in the [`.kitchen.yml`](.kitchen.yml) +`platforms` YAML stanza. + +This build environment is designed to get you up-and-running quickly. However, +there is nothing that restricts you from building on other platforms. Simply use +the [omnibus cookbook](https://github.com/chef-cookbooks/omnibus) to setup your +desired platform and execute the build steps listed above. + +The default build environment requires Test Kitchen and VirtualBox for local +development. Test Kitchen also exposes the ability to provision instances using +various cloud providers like AWS, DigitalOcean, or OpenStack. For more +information, please see the [Test Kitchen documentation](https://kitchen.ci/). + +Once you have tweaked your [`.kitchen.yml`](.kitchen.yml) (or +[`.kitchen.local.yml`](.kitchen.local.yml)) to your liking, you can bring up an +individual build environment using the `kitchen` command. + + +```shell +$ bin/kitchen converge ubuntu-1804 +``` + +Then login to the instance and build the project as described in the Usage +section: + +```shell +$ bin/kitchen login ubuntu-1804 +[vagrant@ubuntu...] $ . load-omnibus-toolchain.sh +[vagrant@ubuntu...] $ [ -e .bundle ] && sudo chown -R vagrant:vagrant .bundle +[vagrant@ubuntu...] $ cd undrop-for-innodb # or 'cd undrop-for-innodb/omnibus' if your omnibus project is embedded in your main project +[vagrant@ubuntu...] $ bundle install +[vagrant@ubuntu...] $ bin/omnibus build undrop-for-innodb +``` + +For a complete list of all commands and platforms, run `kitchen list` or +`kitchen help`. diff --git a/omnibus-undrop-for-innodb/config/projects/undrop-for-innodb.rb b/omnibus-undrop-for-innodb/config/projects/undrop-for-innodb.rb new file mode 100644 index 0000000..4acc476 --- /dev/null +++ b/omnibus-undrop-for-innodb/config/projects/undrop-for-innodb.rb @@ -0,0 +1,26 @@ +# +# Copyright 2019 TwinDB LLC +# +# All Rights Reserved. +# + +name "undrop-for-innodb" +maintainer 'TwinDB Development Team ' +homepage 'https://github.com/twindb' + +# Defaults to C:/undrop-for-innodb on Windows +# and /opt/undrop-for-innodb on all other platforms +install_dir "#{default_root}/#{name}" + +build_version '2.0.0' +build_iteration 1 + +# Creates required build directories +dependency "preparation" + +# undrop-for-innodb dependencies/components +dependency 'undrop-for-innodb' + + +exclude "**/.git" +exclude "**/bundler/git" diff --git a/omnibus-undrop-for-innodb/config/software/preparation.rb b/omnibus-undrop-for-innodb/config/software/preparation.rb new file mode 100644 index 0000000..092daf7 --- /dev/null +++ b/omnibus-undrop-for-innodb/config/software/preparation.rb @@ -0,0 +1,30 @@ +# +# Copyright 2023 YOUR NAME +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "preparation" +description "the steps required to prepare the build" +default_version "1.0.0" + +license :project_license +skip_transitive_dependency_licensing true + +build do + block do + touch "#{install_dir}/embedded/lib/.gitkeep" + touch "#{install_dir}/embedded/bin/.gitkeep" + touch "#{install_dir}/bin/.gitkeep" + end +end diff --git a/omnibus-undrop-for-innodb/config/software/undrop-for-innodb-zlib.rb b/omnibus-undrop-for-innodb/config/software/undrop-for-innodb-zlib.rb new file mode 100644 index 0000000..220b67b --- /dev/null +++ b/omnibus-undrop-for-innodb/config/software/undrop-for-innodb-zlib.rb @@ -0,0 +1,55 @@ +# +# Copyright 2023 YOUR NAME +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# These options are required for all software definitions +name "undrop-for-innodb-zlib" +default_version "1.2.6" + +# A software can specify more than one version that is available for install +version("1.2.6") { source md5: "618e944d7c7cd6521551e30b32322f4a" } +version("1.2.8") { source md5: "44d667c142d7cda120332623eab69f40" } + +# Sources may be URLs, git locations, or path locations +source url: "http://downloads.sourceforge.net/project/libpng/zlib/#{version}/zlib-#{version}.tar.gz" + +# This is the path, inside the tarball, where the source resides +relative_path "zlib-#{version}" + +build do + # Setup a default environment from Omnibus - you should use this Omnibus + # helper everywhere. It will become the default in the future. + env = with_standard_compiler_flags(with_embedded_path) + + # Manipulate any configure flags you wish: + # For some reason zlib needs this flag on solaris + env["CFLAGS"] << " -DNO_VIZ" if solaris? + + # "command" is part of the build DSL. There are a number of handy options + # available, such as "copy", "sync", "ruby", etc. For a complete list, please + # consult the Omnibus gem documentation. + # + # "install_dir" is exposed and refers to the top-level projects +install_dir+ + command "./configure" \ + " --prefix=#{install_dir}/embedded", env: env + + # You can have multiple steps - they are executed in the order in which they + # are read. + # + # "workers" is a DSL method that returns the most suitable number of + # builders for the currently running system. + command "make -j #{workers}", env: env + command "make -j #{workers} install", env: env +end diff --git a/omnibus-undrop-for-innodb/config/software/undrop-for-innodb.rb b/omnibus-undrop-for-innodb/config/software/undrop-for-innodb.rb new file mode 100644 index 0000000..4269bad --- /dev/null +++ b/omnibus-undrop-for-innodb/config/software/undrop-for-innodb.rb @@ -0,0 +1,39 @@ +# +# Copyright 2019 TwinDB LLC +# +# These options are required for all software definitions +name 'undrop-for-innodb' + +license 'GNU General Public License v2.0' +license_file 'LICENSE' +skip_transitive_dependency_licensing true + + +source path: '/undrop-for-innodb' +relative_path 'undrop-for-innodb' + +build do + # Setup a default environment from Omnibus - you should use this Omnibus + # helper everywhere. It will become the default in the future. + env = with_standard_compiler_flags(with_embedded_path) + + # Manipulate any configure flags you wish: + # For some reason zlib needs this flag on solaris + # env["CFLAGS"] << " -DNO_VIZ" if solaris? + + # "command" is part of the build DSL. There are a number of handy options + # available, such as "copy", "sync", "ruby", etc. For a complete list, please + # consult the Omnibus gem documentation. + # + # "install_dir" is exposed and refers to the top-level projects +install_dir+ + # command "./configure" \ + # " --prefix=#{install_dir}/embedded", env: env + + # You can have multiple steps - they are executed in the order in which they + # are read. + # + # "workers" is a DSL method that returns the most suitable number of + # builders for the currently running system. + command 'make', env: env + command "make BINDIR=#{install_dir}/embedded/bin install", env: env +end diff --git a/omnibus-undrop-for-innodb/omnibus.rb b/omnibus-undrop-for-innodb/omnibus.rb new file mode 100644 index 0000000..32db2fa --- /dev/null +++ b/omnibus-undrop-for-innodb/omnibus.rb @@ -0,0 +1,57 @@ +# +# This file is used to configure the undrop-for-innodb project. It contains +# some minimal configuration examples for working with Omnibus. For a full list +# of configurable options, please see the documentation for +omnibus/config.rb+. +# + +# Build internally +# ------------------------------ +# By default, Omnibus uses system folders (like +/var+ and +/opt+) to build and +# cache components. If you would to build everything internally, you can +# uncomment the following options. This will prevent the need for root +# permissions in most cases. +# +# Uncomment this line to change the default base directory to "local" +# ------------------------------------------------------------------- +# base_dir './local' +# +# Alternatively you can tune the individual values +# ------------------------------------------------ +# cache_dir './local/omnibus/cache' +# git_cache_dir './local/omnibus/cache/git_cache' +# source_dir './local/omnibus/src' +# build_dir './local/omnibus/build' +# package_dir './local/omnibus/pkg' +# package_tmp './local/omnibus/pkg-tmp' + +# Disable git caching +# ------------------------------ +# use_git_caching false + +# Enable S3 asset caching +# ------------------------------ +# use_s3_caching true +# s3_access_key ENV['AWS_ACCESS_KEY_ID'] +# s3_secret_key ENV['AWS_SECRET_ACCESS_KEY'] +# s3_profile ENV['AWS_S3_PROFILE'] +# s3_iam_role_arn ENV['S3_IAM_ROLE_ARN'] +# s3_bucket ENV['AWS_S3_BUCKET'] + +# Customize compiler bits +# ------------------------------ +# solaris_compiler 'gcc' +# build_retries 5 +# fetcher_read_timeout 120 +# fetcher_retries 5 + +# Load additional software +# ------------------------------ +# software_gems ['omnibus-software', 'my-company-software'] +# local_software_dirs ['/path/to/local/software'] + +# Windows architecture defaults +# ------------------------------ +windows_arch %w{x86 x64}.include?((ENV['OMNIBUS_WINDOWS_ARCH'] || '').downcase) ? + ENV['OMNIBUS_WINDOWS_ARCH'].downcase.to_sym : :x86 + +append_timestamp false diff --git a/omnibus-undrop-for-innodb/omnibus_build.sh b/omnibus-undrop-for-innodb/omnibus_build.sh new file mode 100755 index 0000000..66d940e --- /dev/null +++ b/omnibus-undrop-for-innodb/omnibus_build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -ex + +cd /undrop-for-innodb/omnibus-undrop-for-innodb + +bundle install --binstubs + +bin/omnibus build undrop-for-innodb diff --git a/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postinst b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postinst new file mode 100644 index 0000000..b731118 --- /dev/null +++ b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postinst @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Perform necessary undrop-for-innodb setup steps +# after package is installed. +# + +PROGNAME=`basename $0` + +error_exit() +{ + echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2 + exit 1 +} + +for ep in c_parser stream_parser +do + if ! test -L /usr/bin/${ep} + then + ln -s "/opt/undrop-for-innodb/embedded/bin/${ep}" /usr/bin/${ep} + fi +done + +echo "Thank you for installing undrop-for-innodb!" + +exit 0 diff --git a/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postrm b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postrm new file mode 100644 index 0000000..ae36abe --- /dev/null +++ b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/postrm @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Perform necessary undrop-for-innodb removal steps +# after package is uninstalled. +# + +if [ "$1" = 0 ] +then + for ep in c_parser stream_parser + do + rm "/usr/bin/${ep}" + done +fi + +echo "undrop-for-innodb has been uninstalled!" + +exit 0 diff --git a/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/preinst b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/preinst new file mode 100644 index 0000000..2acf548 --- /dev/null +++ b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/preinst @@ -0,0 +1,7 @@ +#!/bin/sh +# +# Perform necessary undrop-for-innodb setup steps +# before package is installed. +# + +echo "You're about to install undrop-for-innodb!" diff --git a/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/prerm b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/prerm new file mode 100644 index 0000000..edb0c17 --- /dev/null +++ b/omnibus-undrop-for-innodb/package-scripts/undrop-for-innodb/prerm @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Perform necessary undrop-for-innodb setup steps +# prior to installing package. +# + +PROGNAME=$(basename "$0") + +error_exit() +{ + echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2 + exit 1 +} + +find /opt/undrop-for-innodb/ -name .gitkeep -delete + +exit 0