Skip to content

Add pg client to big-poppa - #551

Merged
thejsj merged 3 commits into
masterfrom
SAN-5087-add-postgres-client-to-big-poppa
Sep 20, 2016
Merged

Add pg client to big-poppa#551
thejsj merged 3 commits into
masterfrom
SAN-5087-add-postgres-client-to-big-poppa

Conversation

@thejsj

@thejsjthejsj commented Sep 20, 2016

Copy link
Copy Markdown
Member
  • I removed this function
  • I fixed all these things, etc.

Reviewers

Tests

Test any modifications on one of our environments.

Deployment (post-merge)

Ensure that all environments have the given changes.

  • deployed to epsilon
  • deployed to gamma
  • deployed to delta

@thejsj

Copy link
Copy Markdown
MemberAuthor

It works:

root@ip-10-4-13-234:/home/ubuntu# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96a093b1d98e registry.runnable.com/runnable/big-poppa-worker:add-creator-field-to-org "/bin/sh -c 'ulimit -" About an hour ago Up About an hour silly_wing
d750fd6090c4 registry.runnable.com/runnable/big-poppa-http:add-creator-field-to-org "/bin/sh -c 'ulimit -" About an hour ago Up About an hour 0.0.0.0:7788->7788/tcp small_ptolemy
70b72bb48557 registry.runnable.com/runnable/pheidi:fix-rollbar-reporting "/bin/sh -c 'ulimit -" 3 hours ago Up 3 hours trusting_mirzakhani
f8c44f60198a registry.runnable.com/runnable/cream-http:v1.6.3 "/bin/sh -c 'ulimit -" 4 hours ago Up 4 hours 0.0.0.0:8899->8899/tcp mad_mcclintock
dcdb1e32b793 registry.runnable.com/runnable/cream-worker:v1.6.3 "/bin/sh -c 'ulimit -" 4 hours ago Up 4 hours goofy_lamarr
2d32c77e48cb registry.runnable.com/runnable/eru:v6.1.3 "bash -c 'supervisord" 6 hours ago Up 6 hours 0.0.0.0:33266->5501/tcp, 0.0.0.0:33265->5502/tcp high_heisenberg
6446a31a617b registry.runnable.com/runnable/drake-worker:v1.3.2 "/bin/sh -c 'ulimit -" 16 hours ago Up 16 hours cranky_saha
4256b2aebecb registry.runnable.com/runnable/drake-http:v1.3.2 "/bin/sh -c 'ulimit -" 16 hours ago Up 16 hours 0.0.0.0:33260->80/tcp stupefied_easley
fd53229252fd registry.runnable.com/runnable/shiva:v7.5.0 "/bin/sh -c 'ulimit -" 2 days ago Up 21 hours sleepy_shockley
926be9b81b31 registry.runnable.com/runnable/github-varnish:v1.0.0 "/start.sh" 10 weeks ago Up 10 weeks 0.0.0.0:8765->80/tcp ecstatic_goodall
7e5f6dc7fd1f registry.runnable.com/runnable/detention:v1.3.2 "/bin/sh -c 'ulimit -" 4 months ago Up 4 months 0.0.0.0:9123->9123/tcp stoic_pare
root@ip-10-4-13-234:/home/ubuntu# docker exec -it 96a093b1d98e bash
root@big-poppa-worker:/big-poppa-worker# psql $POSTGRES_CONNECT_STRING

dockerfile_pre_install_commands: [
"echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc"
"apt-get update",
"apt-get install postgresql-client -y",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you only install a specific version instead of master all the time ?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Updating.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added and tested.

@und1sk0und1sk0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shall pass!

@thejsj
thejsj merged commit 044581c into masterSep 20, 2016
@thejsj
thejsj deleted the SAN-5087-add-postgres-client-to-big-poppa branch September 20, 2016 22:13
thejsj added a commit to CodeNow/big-poppa that referenced this pull request Sep 21, 2016
### What this PR does
* Add `creator` field to organization
* Populated `creator` field during org creation
### Dependencies
- CodeNow/devops-scripts#551
### Reviewers
- [x] @anandkumarpatel - [x] @Nathan219 ### Deployment 1. Get all organizations with users
```
SELECT id,github_id,name,stripe_customer_id,trial_end,active_period_end FROM organizations LEFT JOIN organizations_users
ON organizations.id = organizations_users.organization_id WHERE organizations_users.organization_id is NULL;
```
2. Run the following query to delete all orgs with no users:
```
DELETE FROM organizations
WHERE id IN (
SELECT id FROM organizations LEFT JOIN organizations_users
ON organizations.id = organizations_users.organization_id WHERE organizations_users.organization_id is NULL
);
```
3. Deploy new version of BP
4. Run the following query to use new user relationships:
```
big_poppa=# SELECT DISTINCT ON (organizations.id) organizations.id, name, creator, users.created_at
big_poppa-# FROM organizations_users
big_poppa-# LEFT JOIN organizations
big_poppa-# ON organizations.id = organizations_users.organization_id
big_poppa-# LEFT JOIN users
big_poppa-# ON users.id = organizations.creator
big_poppa-# ORDER BY organizations.id, users.created_at DESC;
```
### Rollback steps
1. `ssh` into `app-services`
2. Start one of the BP containers with a different command (`sleep infinity`)
3. Run `npm run rollback`
4. Revert commit for BP
5. Re-deploy BP
### Tests
- [x] Run migration in gamma
- [x] Test route
- [x] Create new org in gamma
### Commits
* Add migration for creator field
* Fix functional tests
* Add creator property to big-poppa
* Update migration. Add logs
* Fix logger ref
* Make column have no default and have it be NOT NULL
* Add max number of retries
* Fix JSdoc. Add retryDelay
* Delete the delete workers
* Fix stuff
* Change name of table. Ignore db-backups
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thejsj@anandkumarpatel@und1sk0