-
Notifications
You must be signed in to change notification settings - Fork 821
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
Quick dev. environment using Vagrant & Salt #1342
Conversation
Ubuntu 14.04.1 with osm2pgsql, postgis and kosmtik ready to use - Uses Vagrant to quickly create a VM based on Ubuntu 14.04.1 LTS - Easily add kosmtik plugins using a configuration file - Added .vagrant/ and Vagrantfile to the ignore list to avoid unintentional mixups - Does NOT import any .pbfs automatically, as it can quickly get messy doing such. However, I've played around with it and it works -- as long as you've got the memory and you're not importing overlapping areas. - Sets up kosmtik as a service; $ sudo service kosmtik start - Edit as you please and reload it for kosmtik to pick it up
| @@ -3,3 +3,5 @@ layers/ | |||
| data/ | |||
| *.xml | |||
| node_modules/ | |||
| .vagrant/ | |||
| Vagrantfile | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're checking in the Vagrantfile, should it really be ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pnorman It's mentioned in the commit, but it's ignored to avoid accidentally pushing a modified Vagrantfile unless it really is your intention, as you'd use it to configure the virtual machines number of CPU cores, memory, on/off for the hardware extensions for virtualization -- as well as changing which kosmtik plugins get installed during/by the Salt highstate / vagrant provision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it sounds like switching between branches might cause problems then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you'll have to commit or stash your changes, otherwise git will get vocal. Stashing would be the most convenient, then you can just pop wherever you checkout, and potentially git update-index --assume-unchanged Vagrantfile if you'd like to tell git to be quiet about it.
An alternative approach is to never commit the Vagrantfile, and instead have a Vagrantfile.default or similarly that a user would have to rename to Vagrantfile. That sort of makes a simple thing somewhat more complex, but also can avoid minor things down the road.
|
|
||
| # Every Vagrant virtual environment requires a box to build off of. | ||
| # This can be changed to anything else, but keep in mind the states | ||
| # are only written with 14.04.1 in mind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14.04.2 now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pnorman Not as of yet; the trusty64 box has yet to be updated to 14.04.2. This isn't much of a problem, as .2 mainly consists of kernel and hardware support updates (beyond other typical package updates).
|
It looks useful and I've added some comments, but is this the right repo for this? I'm not the best judge, as I know I'd never use it. |
👍 Glad to hear. If it'd make a difference I could link to other projects doing so, but it shouldn't be included on the merit of "somebody else does it!", rather if it makes sense. Potentially as mentioned in the PR, I could split it out to its own repository, but then it'd be harder to find, which again would decrease the usefulness of it.
I'm not going to try to convince you to do so, but could you give me some pointers on what makes it less useful for you, or irrelevant, so that I could potentially improve it for other people alike? |
I have multiple database servers running on bare hardware. I will be running a minutely updated osm2pgsql database on my dev box. I edit multiple stylesheets. I could virtualize Kosmtik and point it at an existing database host with PGHOST, but I wouldn't gain much out of that. |
Second batch of changes, with reduced amount of required setup. - gisuser runs kosmtik - full access to kosmtik install - postgres reads any .conf in /conf.d/ - no nodesource dependency -- although it might be required in the future - runs shapefiles only every 24 hours.
|
I think this is useful, but it should be managed in a separate repository. I'm happy to link to that repository in the documentation. Like @pnorman I wouldn't use it myself so I'm reluctant to have it in the main repository - it would be misleading. I run multiple stylesheets and databases, and use multiple tools (kosmtik, tilemill) and multiple text editors - never mind compiling my own mapnik (for testing various things) and linking node-mapnik against that custom mapnik. All in all, I wouldn't want to run tilemill/kosmtik in an isolated environment. I can see that it will be useful for other people, but it's best managed separately. |
Understandable. I'll close the pull request and see if I can put the files together in a way that makes it as convenient as possible to get started with it. When it's ready, how should I get in touch re: linking to it, if desireable? |
|
@thor |
|
@mkoniecz Absolutely -- it's a complex combination of different components, and there's no reason why I shouldn't try to make it useful for power users in the same way you'd try to make it quick and easy for new users. 👍 A thought that did occur to me is that it is silly to have the PostGIS database on the same VM as mapnik/kosmtik/tilemill, simply because you'd never want to constantly be destroying and re-importing your PostGIS data -- it's time consuming and useless. It seems the main target audience isn't you folks ( ;-) ), but even I grow tired of importing Great Britain among others! I'm setting it up so that either way, even if you're a new user, the PostGIS database and your choice of rendering/editing are on two different machines. (If you use a "cloud" provider or OpenStack provider, vSphere, KVM, etc, Vagrant can still take care of deploying the VM to your own stack. 💡 ) |
So I'm closing the PR. Feel free to continue discussing here about setting this up elsewhere. |
|
furry-sansa is also related, being a tool to manage importing osm2pgsql databases and set up config files. Slightly different use-case. |
|
Just a quick note: I'm interested in Docker and I know that Vagrant 1.6+ can use Docker images, so probably that could be a perfect match for all the OS-es. BTW: Docker is said to be running only in 64-bit Linux, but that's not the full truth - we could run containers also on 32-bit Linux if we use special 32-bit base images (like https://github.com/docker-32bit/ubuntu or https://registry.hub.docker.com/repos/32bit/), so all the Linuxes would run at full speed, with no VM overhead. |
Following straight from the commit:
I queried @pnorman about this very briefly in #osm-dev at some point, and so here is a PR to see if there is any interest in adding this as part of the repo.
The benefits are mainly listed above, but the recap would be the following:
get-shapefiles.shFor those of you not familiar with Vagrant, you won't be adding a whole VM to the repository -- just a configuration file for Vagrant and Salt roots for configuring the VM for osm2pgsql, kosmtik and postgis. (Though, not in that order.) You can also clone my branch and simply run
vagrant uponce you've installed Vagrant on your computer, and have a look.Usage is currently as follows:
vagrant upfrom within the repository.vagrant sshto SSH in, so that you can run your ownosm2pgsqlimport. (Place any files in data/ and they'll be available at/srv/openstreetmap-carto/data/inside the VM.)vagrant destroy && vagrant upif you want to recreate it.Either way, if it's not something for you folks, that's completely understandable: the PR addes one file to the root, as well as an entire folder containing 4 files. (These can be put elsewhere if desired.) Should it be something that is a bit too meta, then I'll just keep it separated in its own repository. However, at least for me it's really practical when I can clone a repo, run
vagrant upand be at the finish line for what I need to contribute to a project. ☀️If there is an interest in it, but something is amiss, let me know and I'll try what I can to fix & improve it.