-
Notifications
You must be signed in to change notification settings - Fork 822
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
Provide installation script #657
Comments
@kocio-pl I think something like this should work. Let me know if anything is missing. I would like to have an install script, but I think we first need to have a tested procedural description.
where 'username' is your Github username. In the 'Loading with osm2pgsql' section, use instead the command
|
It's better to use the |
Updated my original comment. |
Having an osm2pgsql database loaded with osm data is a common task and certainly not exclusive to this style. It can also be fairly platform-specific. I'm wary of creating Yet Another Guide(s) to this repo which will, inevitably, bitrot. Could we not just link to an existing guide elsewhere? |
I think the description in my comment above is the minimum description we need to give, even when we link to existing guides whenever possible. |
@pnorman Would it be possible to drop the 'Stylesheet' section from http://switch2osm.org/loading-osm-data/? The section doesn't really fit within 'Loading OSM data', and is insufficient as it doesn't talk about fonts, shapefiles etc. It would requiring removing the '--style ~/osm/openstreetmap-carto/openstreetmap-carto.style' part from the osm2pgsql line though. |
For now I just try to achieve the success, but I will try to make a clean room installation some other time to check if all instructions are correct. However I remember "pip" package should be replaced with "python-pip" and "ogr2ogr" with "gdal-bin". I guess "Yet Another Guide(s) to this repo" is highly recommended, because (a) Ubuntu 14.04 is here to stay for 5 years, so bitrot won't get it too soon =} , (b) process of installing is long and consists of many different and unusual steps, so one can easy get distracted - I'm hardly a newbie in Linux/FLOSS world, but I still couldn't get the environment ready in one go today. |
First success is here: I managed to fulfill the database! Now the TileMill is awaiting... One more thing: there should be some "cd" to the right directories in the instructions. I realized, where I should go to issue some command, by trial and error, but not everybody can effectively handle such guessing. |
So I try to create PostGIS project in TileMill and I have even found the correct "crashcourse" part, I guess (https://www.mapbox.com/tilemill/docs/guides/postgis-work/), but I don't know what is the db password, since (using tips from http://switch2osm.org/loading-osm-data/ ) I just created the user and no password was set by me: sudo -u postgres createuser -s $USER but when I omit the password, it can't connect to the database. I don't know what the ID is (the same as the database name - "gis"?). I also don't know what tables should I import and how should I calculate the extent, given that I just get only one country (Poland). |
Omit the user, password, hostname, and port, giving only the dbname. This will use local unix sockets to connect. For extents use Also use 900913 for the SRS, not the custom string they gave. Overall reading through https://www.mapbox.com/tilemill/docs/guides/postgis-work/ I see numerous problems with it. My guide to setting up TileMill to work with OpenStreetMap Carto is https://hackpad.com/TileMill-I6rxRVszKMv but I haven't had time to finish it off. |
OK, so my next right step was adding layer like this:
But I needed to add styling, so I just copied the #countries settings in style.mss as: #carto { and after saving it worked! So, now I have working database filled with current data and I can use it inside the TileMill at the basic level - double success! But what I really want is testing real carto style. Let's try it then... |
Yep: ln -s ~/osm/openstreetmap-carto ~/Documents/MapBox/project/ did the trick! Now I have my forked style as a separate TileMill project and it starts loading... However today I won't wait to see how long it takes and if my computer has enough of resources to work with entire country data. It's just a nice point to stop for now. Combined instructions and my guessing were OK, now let's make them simpler and no-guessing. |
You should be able to just run through the commands at https://hackpad.com/TileMill-I6rxRVszKMv, which will get you all the way to running TileMill, which depends on your setup, and opening the project from within TileMill, which is fairly simple. I have no interest in writing a guide which runs through the steps without explaining, as then you have no idea why you've done what you've done, and if the slightest thing changes the person has no knowledge of what's going on. I have shell scripts which run all the commands to set up an osm2pgsql database from scratch and install TileMill, but they're extremely fragile. |
Hm, I'm a bit confused now: this ticket is all about installation script - do you think it is completely unnecessary or you just have some minor/technical issues? What parts are so fragile (for example I don't think package installation is such a part)? Maybe the script should have some conditionalities with hints ("Which source do you chose to download data from: 1..., 2..., 3..., skip downloading [press Enter for default: 1]")? |
Given that switch2osm will be getting a guide on setting up the stylesheet when the writing is finished, I think it's unnecessary. A script will bitrot unless written very carefully. Writing robust scripts isn't trivial. This is based on experience, and answering support questions, as well as having my scripts break. |
No. We need a style file from a stylesheet as one shouldn't expect the default.style to work with a particular stylesheet. I've chosen to go with the openstreetmap-carto.style file instead of one of the others. |
IMPORTANT: Current version resides in #657 (comment) @math1985 - new version: edits in the beginning, working ogr2ogr installation, missing cd, symbolic link. Needs testing, preferably by somebody new to developing OSM styles. Instructions for installation on Ubuntu 14.04
If you want to contribute to the stylesheet, first create a fork by clicking the Fork button on Github, and then in the 'Stylesheet' section in switch2osm guide, instead execute
where 'username' is your Github username. In the 'Loading with osm2pgsql' section, use instead the command
|
I tested and improved previous comment (mostly wording - and two instructions "Open Tilemill and close it" + final one). |
As far as I'm concerned, we add this to https://github.com/math1985/openstreetmap-carto/blob/master/INSTALL.md . |
I have had nothing but problems with ppa:developmentseed/mapbox causing conflicts with other versions. |
So what is the proper way of installing Tilemill? There are recommending this method on their website. Or is there a suitable replacement for Tilemill? |
I'd prefer recommending Kosmtik over Tilemill.
The main differences with Kosmtik install and setup are
For a new user creating new projects which will only involve 1 MSS file, I could see recommending Tilemill, as the built-in text editor makes it easier to start, but it just doesn't work on large projects. |
Nope, sadly. Creating a Debian package is not really an issue in se, but I need to sit down a bit to find the best way to deal with Mapnik. |
Kosmtik sounds nice (I am not fan of Tilemill but I was unaware that alternative exists), lets hope that standard installation from source is straightforward. BTW, is there any performance difference compared to Tilemill? |
I try to install from source on Ubuntu Utopic, but I get this error (I got node package from regular repositories) - is it the same as @yohanboniface was talking?:
|
For map development, not really. You're still bottlenecked by Mapnik, which on machines with slow disks and low RAM means you're bottlenecked by the database. There's also the metatile size tradeoff between throughput and responsiveness. I can't speak to time to export tilesets or images. It's probably marginally quicker in some ways, as it does less. |
Have a look at openstreetmap/openstreetmap-website#1290 |
Default Ubuntu image is currently 14.04, so I would use rather |
There are also known best practices for using apt-get in Docker, related to its extensive caching. Basically - always use If we want to always have fresh git content from osm-carto (every time the container is started, not only when building new image), we should update it through ENTRYPOINT. And when we have all the needed containers, we have to start them in a coordinated way - it can be made with a simple script, but there also exists Vagrant, which is popular VM "orchestrating" software. See this example. |
@Kocio DId you get the geo-data image to work? I repeatedly get '2016-10-14 20:42:37 UTC FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied'. |
No, I didn't try it because of lack of the license - I don't like to waste the time with such uncertain project. I can test it however in a few days, if it would be useful to you in any way. |
I have some problems building, but you could also try with a fork which has quite fresh build available:
|
Here's the dockerfile I have FROM debian:testing
# Install style dependencies and Kosmtik dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
nodejs nodejs-legacy npm \
zip unzip curl git ca-certificates \
fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont \
&& rm -rf /var/lib/apt/lists/*
RUN npm install kosmtik
RUN mkdir -p /openstreetmap-carto
WORKDIR /openstreetmap-carto
# Get the shapefiles
ADD get-shapefiles.sh ./
RUN ./get-shapefiles.sh Next steps would be to make a docker-compose file which
The data loading also requires another dockerfile for osm2pgsql which will load the data into the PostGIS container. I'm doing an OS upgrade so might not get back to this for a few days. |
I was not aware of Docker Compose, but it looks like a better way than Bash scripts or Vagrant rules - thanks! |
OS upgrade finished, and I have something that partially works master...pnorman:docker starts two containers, one for the DB, the other for Kosmtik, and docker-compose up brings them up together. I'm still working on the import side. to-do before opening a PR for discussion
|
Why don't you use Joxit/docker-kosmtik, which you mentioned yourself, or kosmtik/kosmtik for example? |
I'd have needed to do just as much work modifying it, or end up with another container which does the work of downloading the shapefiles. |
So currently the import process fails (amongst others) because it has no |
Yes. Well, not that version, |
Thanks. Do you have any other local changes? Half implementations are fine. |
The issue I'm not having is:
In other words, at the moment createdb is executed, the psql server is not yet fully running. Is there a way to handle this? |
Not sure. |
I added a |
Good point. |
Next problem: the import Docker file contains |
I would try to look at this, since I consider having easy toolset for developers to be quite important thing - getting to know some details takes me years, so it's good to have some developers to take care for some easier tasks, so we have more people ready to work with the code in the longer perspective. |
Sometimes this could be of help... |
Would https://shinesolutions.com/2016/12/30/generating-high-res-maps-with-mapnik-and-docker/ help us with the docker work? |
they're using a flag file to indicate if the DB is initialized and hard-coding the location of the data that gets imported. It doesn't help with what we still need to work out. |
I have updated the branch (master...nebulon42:docker) and added some documentation. It basically works. The only thing I have not looked at is if we can prevent Another thing is that the shapefile data currently is owned by the user with UID 1000. First it was root which was even worse. We have to think of something for systems where 1000 is not the default user. We also have to think about if we should build the containers and upload them to the registry to avoid that everybody has to re-build them. |
Version for Ubuntu 14.04: #657 (comment)
Current setup instructions require unnecessary figuring out what and how it should be done.
But it is possible to assume that user have certain Linux (for example in VM) and provide installation script. It would be possible to provide entire installation instruction also in form:
install Lubuntu 14.04, it may be a virtual machine
$ sudo apt-get install git
$ git clone openstreetmap-carto
$ sudo sh ./openstreetmap-carto/lubuntu14.04_installation_script.sh
script would include
Note that currently some people even make pull requests without testing them (see for example #654 ).
I may make and test the installation script (it would be mostly copy of http://switch2osm.org/loading-osm-data/ ).
The text was updated successfully, but these errors were encountered: