Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pop from Proxy & RDBMS storage getter #511

Merged
merged 33 commits into from
Aug 21, 2018

Conversation

manugupt1
Copy link
Member

@manugupt1 manugupt1 commented Aug 17, 2018

This PR is huge. I did not really want it that way, however as I was making CI (Travis work), I was making changes and was in a complete rabbit hole. If required, I can always separate it out it in multiple ways and in the process.

  • It makes the proxy Pop free
  • It keeps olympus using pop as CDN is a part of olympus and it has an RDBMS driver with tests
  • It will update the CI to use a postgres database as this commit from @arschles removes mysql https://github.com/gomods/athens/pull/487/files
  • It updates the migration files to have postgres dump so that it can be streamlined again.
  • It changes default docker-compose image to use for postgres to use postgres and postgres which is the default and is used as most commonly for most systems that are not docker based, so it streamlines dev build using docker and otherwise when you look at database.yml.
  • It removes unneeded code from cdn driver
  • It changes the rdbms cdn driver to use test as the test unless GO_ENV is specified otherwise

Fixes #496
Fixes #494
Fixes #450
Fixes #487

manugupt1 and others added 8 commits August 16, 2018 20:55
- Not sourcing from cmd/proxy/.env, because that doesn't export any variables
- Removing mysql support (I feel like 1 database is enough)
- Pruning networks on teardown

I'm happy to split these changes up into separate PRs - it's the end of the day for me so I wanted to get everything in 😄
@manugupt1 manugupt1 changed the title Remove pop & rdbms [WIP] Remove pop & rdbms Aug 17, 2018
@codecov-io
Copy link

codecov-io commented Aug 18, 2018

Codecov Report

Merging #511 into master will increase coverage by 1%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master     #511    +/-   ##
========================================
+ Coverage    39.9%   40.91%    +1%     
========================================
  Files         112      104     -8     
  Lines        3205     3065   -140     
========================================
- Hits         1279     1254    -25     
+ Misses       1799     1688   -111     
+ Partials      127      123     -4
Impacted Files Coverage Δ
cmd/olympus/actions/storage.go 0% <ø> (ø) ⬆️
cmd/olympus/actions/app.go 69.15% <ø> (-1.38%) ⬇️
cmd/proxy/actions/app.go 59.43% <ø> (ø) ⬆️
cmd/proxy/actions/storage.go 16.66% <ø> (+1.85%) ⬆️
cmd/olympus/models/models.go 100% <100%> (+37.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8b64fd...97ea321. Read the comment docs.

@manugupt1 manugupt1 changed the title [WIP] Remove pop & rdbms Remove pop from Proxy & RDBMS storage getter Aug 18, 2018
@rohancme rohancme mentioned this pull request Aug 19, 2018
@@ -1,22 +1,5 @@
package models
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need these 2 files at all after this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not think so at all. I have kept it simply because I am coming from an RoR space where convention over configuration. Buffalo by default creates models.go and that is why I have kept it around.

If we want we can remove it!

@@ -34,12 +33,6 @@ func GetStorage() (storage.Backend, error) {
return nil, err
}
return mongo.NewStorage(mongoURI)
case "postgres", "sqlite", "cockroach", "mysql":
Copy link
Member

Choose a reason for hiding this comment

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

we are removing postgres support, is that right? we keep postgres image running and we have olympus database yaml saying dialect: "postgres"

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to have Postgres image and the yml file on Olympus because we have a CDN RDBMS driver. This way, we can run tests for CDN but still remove RDBS storage support from pkg/

// DB is a connection to your database to be used
// throughout your application.
var DB *pop.Connection

func init() {
Copy link
Member

Choose a reason for hiding this comment

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

please remove init(), there's no point of having it

func Test_ModelSuite(t *testing.T) {
as := &ModelSuite{suite.NewModel()}
suite.Run(t, as)

Copy link
Member

Choose a reason for hiding this comment

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

m: whitespace

@arschles
Copy link
Member

@manugupt1 a have the nitpickey-ist of all nitpicks, sorry in advance!

Instead of writing:

Fixes the following

#496
#494
#450
#487

Can you write this:

Fixes #496
Fixes #494
Fixes #450
Fixes #487

This way, GitHub will properly close all 4 of those issues when this PR is merged.

Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

Just one tiny change about the Makefile.

And the rest are questions

@@ -20,8 +20,9 @@ before_script:
- make setup-dev-env
- wget "https://dl.minio.io/server/minio/release/linux-amd64/minio"
- chmod +x minio && nohup ./minio server . &
- buffalo db create
- buffalo db migrate up
- buffalo db create -e $GO_ENV -d -c $POP_PATH/database.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this if we're removing pop and rdbms storage?
Same thing for the line below.

Copy link
Member Author

Choose a reason for hiding this comment

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

See below!

@@ -7,8 +7,8 @@ go:
env:
global:
- PATH=${PATH}:./bin
- POP_PATH=$PWD/cmd/proxy
- GO_ENV=test_postgres
- POP_PATH=$PWD/cmd/olympus
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need POP_PATH at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes! because we still have the CDN rdbms driver which is dependent on Pop. So, I made sure that the proxy is independent of Pop but olympus is not.
Once, we have voted on CDN to be kicked out of olympus, the next step would be to create a PR that basically removes POP_PATH from travis

Copy link
Contributor

Choose a reason for hiding this comment

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

@manugupt1 so say we keep CDN, do we still need RDBMS in the CDN? can we not remove RDBMS and use another storage for CDN?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right on!

So, if we decide not to support the RDBMS driver for CDN, we do not need it at all.
For example,
https://github.com/gomods/athens/blob/master/pkg/cdn/metadata/cdn_metadata_entry.go#L14-L19

Supports both mongo and SQL based tags!
If we remove the rdbms driver that stores the metadata https://github.com/gomods/athens/tree/master/pkg/cdn/metadata/rdbms

Then, we can remove all the dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we decided to remove RDBMS from anything Athens related, but we can do it in another PR. @arschles correct me if im wrong :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh cool! I was not aware of of that! Let us wait for @arschles to confirm.

Copy link
Member

Choose a reason for hiding this comment

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

I do believe that RDBMS in CDN is without use. there are no relationships there so any document db will do just fine. Let's get rid of it

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to address it in this or a separate PR @manugupt1

Makefile Outdated
@@ -74,3 +73,4 @@ down:
dev-teardown:
docker-compose -p athensdev down
docker volume prune
docker network prune
Copy link
Contributor

Choose a reason for hiding this comment

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

this should already happen with docker-compose -p athensdev down -- if not, let's do it in another PR :)

Copy link
Contributor

@marwan-at-work marwan-at-work left a comment

Choose a reason for hiding this comment

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

🥇

@manugupt1
Copy link
Member Author

manugupt1 commented Aug 21, 2018 via email

@michalpristas
Copy link
Member

@rchakra3 are your comments addressed?

@rohancme
Copy link
Contributor

rohancme commented Aug 21, 2018

Based on the comments here I'm assuming we'll get rid of olympus/models entirely with the follow up PR to completely remove the rdbms driver anyway?
If so LGTM @michalpristas!

@manugupt1
Copy link
Member Author

Yep! @rchakra3

@marwan-at-work marwan-at-work merged commit c0635b7 into gomods:master Aug 21, 2018
@marpio marpio mentioned this pull request Aug 23, 2018
Sign up for free to 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.

6 participants