Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #973 from joyent/ether/v2.38.1-fixes
Browse files Browse the repository at this point in the history
v2.38.1 fixes
  • Loading branch information
karenetheridge authored Jan 9, 2020
2 parents 3d0380e + b3b88c3 commit 281f852
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/modules/Conch.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ helpers, routes and everything else.

## startup\_time

Stores a [Conch::Time](/modules/Conch%3A%3ATime) instance representing the time the server started accepting requests.
Stores a [Conch::Time](/modules/Conch::Time) instance representing the time the server started accepting requests.

# LICENSING

Expand Down
14 changes: 10 additions & 4 deletions docs/modules/Conch::Command::copy_user_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ copy\_user\_data - copy user data (user records and authentication tokens) betwe

# SYNOPSIS

```
```perl
bin/conch copy_user_data [long options...]

--from name of database to copy from (required)
Expand All @@ -19,6 +19,7 @@ bin/conch copy_user_data [long options...]
Use this script after restoring a database backup to a separate database, before swapping it into place to go live. e.g.:

```perl
: on db server
psql -U postgres --command="create database conch_prod_$(date '+%Y%m%d) owner conch"
pg_restore -U postgres -d conch_prod_$(date '+%Y%m%d') -j 3 -v /path/to/$(date '+%Y-%m-%d')T00:00:00Z; date

Expand All @@ -27,9 +28,14 @@ psql -U postgres conch_staging_$(date '+%Y%m%d')_user_bak --command="CREATE EXTE
pg_dump -U conch --inserts -t user_account -t user_session_token conch | psql -U conch conch_staging_$(date '+%Y%m%d')_user_bak
carton exec bin/conch copy_user_data --from conch_staging_$(date '+%Y%m%d')_user_bak --to conch_prod_$(date '+%Y%m%d')

carton exec hypnotoad -s bin/conch
psql -U postgres --command="rename database conch conch_staging_$(date '+%Y%m%d')_bak; rename database conch_prod_$(date '+%Y%m%d') conch"
carton exec hypnotoad bin/conch
: on api server
svcadm disable conch

: on db server
psql -U postgres --command="alter database conch rename to conch_staging_$(date '+%Y%m%d')_bak; alter database conch_prod_$(date '+%Y%m%d') rename to conch"

: on api server
svcadm enable conch
```

# LICENSING
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Conch::Plugin::Database.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ See ["schema"](#schema); can be used interchangeably with it.
## ro\_schema

Provides (guaranteed) read-only access to the database via [DBIx::Class](https://metacpan.org/pod/DBIx::Class). Returns a
[Conch::DB](/modules/Conch::DB) object that persists for the lifetime of the application.
[Conch::DB](/modules/Conch::DB) object that persists for the lifetime of the request (**not the application**).

Note that because of the use of `AutoCommit => 0`, database errors must be explicitly
cleared with `->txn_rollback`; see ["ReadOnly-(boolean)" in DBD::Pg](https://metacpan.org/pod/DBD::Pg#ReadOnly--boolean).
Expand Down
12 changes: 9 additions & 3 deletions lib/Conch/Command/copy_user_data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ copy_user_data - copy user data (user records and authentication tokens) between
Use this script after restoring a database backup to a separate database, before swapping it into place to go live. e.g.:
: on db server
psql -U postgres --command="create database conch_prod_$(date '+%Y%m%d) owner conch"
pg_restore -U postgres -d conch_prod_$(date '+%Y%m%d') -j 3 -v /path/to/$(date '+%Y-%m-%d')T00:00:00Z; date
Expand All @@ -28,9 +29,14 @@ Use this script after restoring a database backup to a separate database, before
pg_dump -U conch --inserts -t user_account -t user_session_token conch | psql -U conch conch_staging_$(date '+%Y%m%d')_user_bak
carton exec bin/conch copy_user_data --from conch_staging_$(date '+%Y%m%d')_user_bak --to conch_prod_$(date '+%Y%m%d')
carton exec hypnotoad -s bin/conch
psql -U postgres --command="rename database conch conch_staging_$(date '+%Y%m%d')_bak; rename database conch_prod_$(date '+%Y%m%d') conch"
carton exec hypnotoad bin/conch
: on api server
svcadm disable conch
: on db server
psql -U postgres --command="alter database conch rename to conch_staging_$(date '+%Y%m%d')_bak; alter database conch_prod_$(date '+%Y%m%d') rename to conch"
: on api server
svcadm enable conch
=cut

Expand Down

0 comments on commit 281f852

Please sign in to comment.