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

Integrate with make_osc & deploy on osm-database #541

Merged
merged 2 commits into from
May 22, 2017

Conversation

Hoverbear
Copy link
Collaborator

@Hoverbear Hoverbear commented Jan 10, 2017

There was an make_osc.rb and string_hstore.rb file on the deployed instances which was not in any of our repos. These are currently required for syncing between PostgreSQL and MySQL.

This PR converts configures things to appropriately talk to it.

Copy link
Collaborator

@schultyy schultyy left a comment

Choose a reason for hiding this comment

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

Found some minor things otherwise lgtm and good work to convert it into a Rake Task

require 'pg'
require 'builder'

$fields = [ 'shop', 'office', 'aerialway', 'aeroway', 'amenity', 'tourism', 'historic', 'sport', 'leisure', 'public_transport' ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason this has to be a global variable? I'm asking because of the $.

Copy link
Collaborator Author

@Hoverbear Hoverbear Jan 13, 2017

Choose a reason for hiding this comment

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

I don't know. I didn't write this code.

namespace :make_osc do
desc 'Make OSC files.'
task :full => :environment do
$conn = PGconn.open(:dbname => 'osm', :user => 'osm', :password => 'osm', :host => 'osm-database')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above? Does this one have to be global?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know. I didn't write this code.

end

task :diff => :environment do
$conn = PGconn.open(:dbname => 'osm', :user => 'osm', :password => 'osm', :host => 'osm-database')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above with $conn

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know. I didn't write this code.

Gemfile Outdated
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
group :default do
gem 'rails', '~> 4.1.0'
gem 'mysql2', '~> 0.3.18'
gem 'pg', '~> 0.18.4'
Copy link
Collaborator

Choose a reason for hiding this comment

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

The pg gem requires some native extensions to be build on installation. For that it requires the Postgres dev packages. By having it in the :default group we require all devs to have Postgres installed on their machines when they want to work on wheelmap.

I'd propose to have a separate group for this we then can exclude during installation via bundle install --without.

Copy link
Collaborator Author

@Hoverbear Hoverbear Jan 13, 2017

Choose a reason for hiding this comment

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

Hm, this seems reasonable. I'll work on this.

@Hoverbear
Copy link
Collaborator Author

We discussed removing the $ from the variables. Will follow up with this.

@Hoverbear Hoverbear force-pushed the feature/infra-rebuild-syncing branch 2 times, most recently from 2925593 to b692d2a Compare January 13, 2017 09:43
@Hoverbear
Copy link
Collaborator Author

Hoverbear commented Jan 13, 2017

@schultyy Those should be resolved. Am testing...

@Hoverbear
Copy link
Collaborator Author

Requested changes made and work.

@Xylakant
Copy link
Collaborator

I would consider stopping this effort: What's the gain compared to the effort invested and the dependencies introduces into the main app. I'd rather see this in a small standalone script with a gemfile that's separate from the main wheelmap app.

@Hoverbear
Copy link
Collaborator Author

@Xylakant So a separate repo which we also deploy via capistrano or?

@Xylakant
Copy link
Collaborator

I'm uncertain if cap is not an overkill in that case. This will not see many updates, installing that on the machine via chef should be perfectly fine.

@Hoverbear
Copy link
Collaborator Author

@Xylakant Well, the only dependency we introduce is pg which we've moved into the production group anyways so it can be excluded. It's a rather important part of a deployment of wheelmap anyways and I'm concerned placing it somewhere else would cause it to get forgotten/lost (again).

@Xylakant
Copy link
Collaborator

The use of a group is somewhat limited, people expect bundle install to install all development dependencies and excludes should be limited to environments that are production or close to. It also requires us to install pg on all app machines that should not require it currently.

I agree that it should be committed somewhere - it can even live in a "tools" or "osm-sync" subfolder of this repo, but I don't think the effort of folding this into the rake task has any positive ROI either in time or reduced complexity.

@Hoverbear
Copy link
Collaborator Author

So my reasoning for making it a rake task was that it was called by a rake task already, so it seemed easy to integrate that way.

I suppose it wouldn't be much harder to drop this in a subfolder and give it it's own gemfile then modify capistrano to have the dependencies installed when it is deployed.

@Xylakant
Copy link
Collaborator

as I said - I don't think that installing it via CAP has any positive ROI either, but that's a minor point. I'd really go and move it to a dedicated repo and treat it like we treat any other dependency: We assume that it's available at the point where we install the app.

@Hoverbear
Copy link
Collaborator Author

Ok.

@Hoverbear Hoverbear changed the title Integrate make_osc from old infra into rake Integrate with make_osc Jan 13, 2017
@Hoverbear Hoverbear changed the title Integrate with make_osc Integrate with make_osc & deploy on osm-database Jan 13, 2017
@Hoverbear
Copy link
Collaborator Author

Okay, this should be good to go.

@Hoverbear
Copy link
Collaborator Author

Rebased on top of feature/infra-rebuild

@Hoverbear Hoverbear force-pushed the feature/infra-rebuild-syncing branch from c369343 to ca7d305 Compare April 25, 2017 13:07
@Hoverbear
Copy link
Collaborator Author

Rebased.

@Hoverbear Hoverbear merged commit 49ccec1 into feature/infra-rebuild May 22, 2017
@Hoverbear Hoverbear deleted the feature/infra-rebuild-syncing branch May 22, 2017 09:03
@holgerd holgerd removed the review label May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants