henrybuilt-cli
v1.2.1
Published
`hb <sub-command> [options]`
Downloads
1
Readme
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.git
cd
intohenrybuilt-cli
sudo npm install -g
- Place your env file at
~/hb.env
(ask for a .env file if you don't have one) - Run
hb db-sync
to 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
cd
intohenrybuilt-cli
git pull
sudo 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.env
filemysql
command/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_DATABASE
HB_ADMIN_ACCESS_KEY
- if you want to backup to s3
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
- env
db-sync
mysql
commandmysqldump
command- 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.pem
in home directory and include AWS_REMOTE_IP in env file
db-backup
mysql
commandmysqldump
command- env
HB_PRODUCTION_DB_HOST
,HB_PRODUCTION_DB_USER
,HB_PRODUCTION_DB_PASSWORD
,HB_PRODUCTION_DB_DATABASE
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
wf-db-backup
~/.pgpass
file with correct permissions:chmod 0600 ~/.pgpass
pg_dump
command -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-summaries
hb check-system-status
hb load-test
?- log time
- backup to external service outside aws
- audit document visibility, component icon visibility