1.2.1 • Published 3 years ago
henrybuilt-cli v1.2.1
Usage
hb <sub-command> [options]
Available subcommands
db-sync(Dumps production database and imports it into local database)db-backup(Dumps production database and saves it to S3)pt-backup-proposals(Backs up proposal pdfs for all PT Project Versions to S3)audit-s3-file-permissions(Verifies client files are not publicly available)hb db-sync -t staging(Dumps production database and imports it into staging database)
Usage
Initial setup
cd ~git clone https://github.com/henrybuilt/henrybuilt-cli.gitcdintohenrybuilt-clisudo npm install -g- Place your env file at
~/hb.env(ask for a .env file if you don't have one) - Run
hb db-syncto test.- If there is an authentication error, run
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';in your mysql client
- If there is an authentication error, run
Updating
cdintohenrybuilt-cligit pullsudo npm install -g(if this doesn't work,sudo apt-get install npm)
Developing
- Pull
- Check out a branch
- Make modifications
- Verify script works as expected - e.g.
node ./src/hb.js db-sync -t staging - Bump version number
If you want to be able to run all commands, you need:
~/hb.envfilemysqlcommand/binary
The following are required to run each command:
pt-backup-proposals- env
HB_PRODUCTION_DB_HOST,HB_PRODUCTION_DB_USER,HB_PRODUCTION_DB_PASSWORD,HB_PRODUCTION_DB_DATABASEHB_ADMIN_ACCESS_KEY- if you want to backup to s3
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY
- env
db-syncmysqlcommandmysqldumpcommand- env
HB_PRODUCTION_DB_HOST,HB_PRODUCTION_DB_USER,HB_PRODUCTION_DB_PASSWORD,HB_PRODUCTION_DB_DATABASE- if your local mysql server has a non-empty password
HB_DEVELOPMENT_DB_PASSWORD
- if you want to sync faster, you can place
aws-remote-backup.pemin home directory and include AWS_REMOTE_IP in env file
db-backupmysqlcommandmysqldumpcommand- env
HB_PRODUCTION_DB_HOST,HB_PRODUCTION_DB_USER,HB_PRODUCTION_DB_PASSWORD,HB_PRODUCTION_DB_DATABASEAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY
wf-db-backup~/.pgpassfile with correct permissions:chmod 0600 ~/.pgpasspg_dumpcommand -brew install postgresql@11- normal error output you can ignore that we didn't have time to fix:
- SQL errors (~100 lines)
at checkExecSyncError (child_process.js:601:13)
- use --skip when repeatedly syncing for faster syncs (skips download step)
The following commands have no prerequisites:
audit-s3-file-permissions
Usage
wf-backup-db- To restore from a compressed backup:
pg_restore -Fc -h <host> -U <user> -d <db> < 2018-03-23_18-11-02.compressed - To restore from a SQL backup:
pg_restore -h <host> -U <user> -d <db> < 2018-03-23_18-11-02.sql
- To restore from a compressed backup:
TODO
- macos notifications when complete
hb audit-website-permissions- arrays of links that are supposed to (in)accessible, pt api, admin, client site other usershb de-backup-order-summarieshb check-system-statushb load-test?- log time
- backup to external service outside aws
- audit document visibility, component icon visibility
1.2.1
3 years ago