• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    JavaScript
  • Created about 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dockerization for CartoDB

docker-cartodb

This is a dockerized production Carto(DB) installation, based on the official Carto Installation Documentation, using the latest dependencies including ogr2ogr2.1.

You should be able to map most of the steps in the Dockerfile with those on the install documentation. The steps below were written with a Digital Ocean droplet (docker pre-installed) in mind.

dockerizecarto

Production vs Development

This Dockerfile assumes you want to run Carto with SSL, which requires a few configuration steps beyond just building the docker container. The biggest difference from other Dockerfiles is setting the production environment variables, and then adding ssl certificates to the nginx configuration.

This build also makes use of Docker volumes, so that the the data can persist. This should allow for an easier upgrade path when new versions of the core components are release.

How to Build

Get yourself a Droplet

We have had success installing Carto in a Docker container on a Digital Ocean droplet with 8GB of Ram, 80GB Storage and 4 cores, which runs $80/month. You can choose an Ubuntu 16.04 image with Docker preinstalled and save yourself some time. SSH into that bad boy and get ready to Docker.

Edit the sample app_config.yml

You will need a FQDN with an A record pointing to your server's IP address. You need to edit config/app_config.sample.yml, and replace every instance of 'yourdomain.com' with your domain name and save the file as app_config.yml. The dockerfile will insert this into the new container during the build process.

Build the Container

Go make a sandwich and watch some youtube videos, this will take a while... (About an hour as of the time I wrote this)

git clone https://github.com/chriswhong/docker-cartodb.git
docker build -t="cartodb" docker-cartodb/

Run the Container

This command runs the container with the three main services mapped to the host machine. 3000 for the frontend, 8080 for the Windshaft Map Tiler (Maps API), and 8181 for the SQL API. Use docker run -d -p 3000:3000 -p 8080:8080 -p 8181:8181 cartodb the first time you run it.

If you are replacing an existing container built with this image, add the --volumes from flag like docker run --volumes-from {id of old container} -d -p 3001:3000 -p 8081:8080 -p 8182:8181 cartodb

You can't connect from the outside world until you setup nginx to forward specific URLs to the three ports

Configure Nginx

Install nginx apt-get install nginx and then copy config/cartodb.nginx.proxy.conf from this repo to /etc/nginx/conf.d/.

Use certbot-auto to quickly install SSL certificates for your domain. Take note of where it tells you it stored the new SSL certificates

Edit the file to include your production domain name and the paths to the SSL certificates.

Restart nginx service nginx restart

Users

The Dockerfile will create a user named admin with a default password of pass1234. You should change this when you first login.

To make more users, run the create_user script from inside the running container. docker exec -it {containerid} /bin/bash The script is in /cartodb/script/create_user edit it to set the new username and password, then run it sh create_user

Add more map layers to a User's Account

User accounts will only be allowed to add 4 layers to a map in the editor by default, you can change this by using the rails console. First get to the command line in your container: docker exec -it {containerid} /bin/bash

cd cartodb
bundle exec rails c
u = User.find(username:'username')
u.max_layers = 15
u.save

Revert to old Editor

We are using this carto server strictly as a tile/data service, so the builder is not needed, but is enabled by default. To disable it, you must run SQL update users set builder_enabled = false where username = 'myusername'; To run this sql, run a command prompt in the running container docker exec -it {containerid} /bin/bash Once you are in, switch to postgres user su postgres and use psql to connect psql -d carto_db_production

Enable Private Maps

UPDATE users SET private_maps_enabled = 't';

To enable GZIP

This can also be done in nginx, you just need to enable gzip and add the mime types that carto uses.

To use carto-served vector tiles

This is unrelated to carto in Docker, but It's exciting so I thought I would share it. See this gist

Attribution

First and foremost, thank you to the Carto team for such a great product that is also open source! This Dockerfile was inspired by and largely based on Stefan Verhoeven's image. I could not get it working and descided to start over using the official installation docs. All of the configs are borrowed directly from his.

Pull requests and issues welcomed!

If this doesn't work for you, please open an issue and let's figure out why.

More Repositories

1

nyctaxi

Repo for NYC Taxis: A Day in the Life, a data visualization that shows the movements and earnings of a single NYC taxi over 24 hours.
JavaScript
456
star
2

leaflet-globeminimap

A 3d Globe minimap for leaflet
JavaScript
119
star
3

uber-trip-script

Script that gets your uber Trip Data and exports it as geoJSON
JavaScript
95
star
4

ReallySimpleOpenData

A no-frills open data portal built with node, express, and mongodb
JavaScript
86
star
5

mtaMarylandBusTracking

Gets real-time bus locations in Baltimore and throws them on a leaflet map.
JavaScript
68
star
6

awesome-mapbox-external-developer-resources

An awesome list of third-party developer resources to help you work with the Mapbox suite of location-based services, APIs, ADKs, libraries, and data.
59
star
7

plutoplus

A "clip & ship" download tool for NYC PLUTO tax lot datadata
JavaScript
47
star
8

nycturnstiles

Scripts that tinker with the MTA's turnstile data
Processing
38
star
9

awesome-mapboxgl-demos

An Awesome List of Web Map Demos built with Mapbox tools and services.
35
star
10

urbanscratchoff

Compare historic and modern aerial photos of NYC by "scratching off" the top layer
JavaScript
34
star
11

awesome-mapbox-webmaps

An Awesome List of Web Map Applications built with Mapbox tools and services.
30
star
12

nyc-subway-isochrones

Scripts (nodejs and R) for generating travel time isochrones from stations in the New York City subway.
JavaScript
30
star
13

nyc-311-digest

A react app for exploring recent NYC 311 complaints in user-defined areas of interest
JavaScript
20
star
14

phillyBikeThefts

Animation of Philly Bike Theft Data using D3 and Leaflet
CSS
19
star
15

responsive-web-map-layout

A useful responsive layout to use in your web mapping project
HTML
19
star
16

mapbox-gl-fontawesome-markers

A Mapbox GL JS plugin that adds Fontawesome icons to Map Markers
JavaScript
18
star
17

nycbudget

Using Jim Vallandingham's d3 tutorial to create a budget visualization for NYC
CoffeeScript
18
star
18

311plus

Custom Download Tool for NYC's 311 OpenData
JavaScript
16
star
19

taxMap

Node App for mapping of Property Tax Bills in NYC
JavaScript
12
star
20

dangit

DAta Nudged into GIT - File-based datasets that use git for version control of individual records
JavaScript
11
star
21

mta-realtime-test

Node app to consume and transform GTFS-realtime data from the New York City Subway
JavaScript
11
star
22

mapboxgl-nyc-subway

Data and styles for rendering the NYC subway on a mapboxGL map
JavaScript
11
star
23

map-tile-functions

Script to convert a WGS84 latitude and longitude into a tile coordinate for a given zoom level
JavaScript
11
star
24

paint-the-town

Collaborative Data Art using NYC tax lots data (MapPLUTO)
JavaScript
10
star
25

electron-nest-cam-viewer

An electron app for viewing a nest cam feed in a tiny, always-on-top window.
JavaScript
9
star
26

open-data-excuses

A site with lots of excuses for not opening data, and their rebuttals
JavaScript
9
star
27

nyc-tax-data-notes

Notes for munging scraped NYC tax bill data
8
star
28

nyc-civic-jobs

A simple website for browsing NYC government job listings
JavaScript
8
star
29

console-log-geojson

Hijacks `console.log()` and checks for valid geoJSON. If it exists, prints a simple summary and a link to inspect/edit the geojson in geojson.io.
JavaScript
8
star
30

applesoft-ninjaturtle

Applesoft Low Resolution Graphics from 1991
7
star
31

amazon-orders-collage

Creates a collage (grid) of product images for each product in an amazon.com order history report.
JavaScript
7
star
32

streeteasy-subways

A Chrome Extension that overlays NYC Subway lines on streeteasy.com's maps
JavaScript
7
star
33

amtrak-map

JavaScript
7
star
34

bubblecharge

A D3 force bubble chart with on-the-fly charge changes to highlight a bubble.
7
star
35

justinGrimesGeojson

Scripts to convert Justin Grimes' Icon from SVG to geoJSON
HTML
6
star
36

leafletHeatmap

Animated heatmaps using Leaflet and heatmap.js
JavaScript
6
star
37

daycareProxy

A proxy API that scrapes NYC DOH Childcare Connect and outputs JSON
JavaScript
6
star
38

ai-hydra-time-offset

Node.js script for shifting the light schedule for an AquaIllumination Hydra26 Aquarium Light by a specified number of minutes
JavaScript
6
star
39

airportTaxiData

Data analysis of JFK Airport Taxi Dropoffs
5
star
40

circulatortrafficviz

Processing Animation of real-time location data for the Charm City Circulator Bus (Baltimore)
Processing
5
star
41

node-geosupport

Node.js bindings for geosupport, NYC's official geocoder
JavaScript
4
star
42

mapbox-gl-globe-minimap

A Mapbox GL JS Plugin to add a configurable globe minimap showing the main map's center
JavaScript
4
star
43

govsee

JavaScript
4
star
44

checkbooknyc-proxy-api

A simplified API that makes requests to checkbooknyc.com and returns JSON
JavaScript
4
star
45

subway-roulette

An app that helps you choose a random NYC subway station to visit.
JavaScript
4
star
46

node-nyc-tax-scraper

Node script to pull the NYC property tax bill for a given BBL and scrape data from it
JavaScript
4
star
47

bikescrape

Ruby script to pull the ~450 stations on NYC's draft Citibike station map for use in creating a shapefile
Ruby
4
star
48

boromoji

Create simple images of NYC's 5 borough boundaries using leaflet and puppeteer
JavaScript
4
star
49

budgetScrape

Node scraper for NYC Budget PDFs
JavaScript
3
star
50

nyc-construction-codes-scraper

node.js scraper for NYC construction codes in PDF format
JavaScript
3
star
51

us-county-osm-highway-lengths

Commands and SQL for calculating the length of roads by `highway` key in Open Street Map data by U.S. County.
JavaScript
3
star
52

mapbox-developer-cheatsheet

JavaScript
3
star
53

daycare_scraper

Ruby scraper for pulling daycare information from the NYC Dept of Mental Hygiene
3
star
54

nyc-construction-codes-data

directory structure and JSON data for the NYC construction codes
3
star
55

great-saunter-map

JavaScript
3
star
56

capital-budget-scrape-old

Node.js scraper for the NYC capital budget publication
JavaScript
2
star
57

stroll-down-flatbush

JavaScript
2
star
58

geojson-io-vite

Porting geojson.io to a vite app
JavaScript
2
star
59

nyc-pizzashops

Sample dataset for the dangit project
2
star
60

plowScrape

Simply downloads and saves geoJSON from NYC's plow map.
JavaScript
2
star
61

nymap

D3 map with flyout that follows the cursor
JavaScript
2
star
62

nyc-capital-commitment-scrape-old

node.js scraping script for NYC OMB Capital Budget PDFs
JavaScript
2
star
63

simpleTransitApp

A simple transit app that takes a stop number and shows arrival times
CSS
2
star
64

nyc-jobs-scraper

Scrapes current NYC government jobs from a127-jobs.nyc.gov using puppeteer and cheerio
JavaScript
2
star
65

metronome

A web version of Metronome, the public art clock display in Union Square, New York City
JavaScript
2
star
66

nwsalerts-to-geojson

A node script to convert NWS/NOAA CAP alerts XML into valid geoJSON
JavaScript
2
star
67

nycOpenDataForce

D3 Force-directed graph of NYC Open Datasets
JavaScript
2
star
68

otp-subway-deserts

scripts to process data for v2 of my subway deserts map
JavaScript
2
star
69

acris-tiff-converter

Hacking around on-the-fly conversion of ACRIS tiff images
JavaScript
2
star
70

class-5-demo-2024

A demo of interactivity features in Mapbox GL JS
JavaScript
2
star
71

mtaparse

Splits the Maryland MTA GTFS file into separate and complete GTFS files for Marc, light rail, commuter bus, metro, and bus
Ruby
2
star
72

nyc-capital-budget-site

An express.js website for exploring the NYC Capital Budget
JavaScript
2
star
73

sickweather

SickWeather DataViz in Processing
Processing
2
star
74

nyc-trees-map

An experimental map combining a lidar-based dataset of trees in New York City with the 3D tree models available in Mapbox GL JS v3 and the Mapbox Standard Style.
HTML
2
star
75

chronosubway

JavaScript
2
star
76

pizza-map-2024

JavaScript
2
star
77

mapwarper-tile-cache

Express.js tile cache for NYPL Mapwarper Imagery, used in Urban Scratchoff
JavaScript
2
star
78

class-4-map

JavaScript
1
star
79

class-3-map

JavaScript
1
star
80

nycbustiming

Node scripts for logging MTA Bustime Real-Time Vehicle Locations
JavaScript
1
star
81

maputnik-push-api

Koa API for short-term hosting of mapboxGL styles. Automates use of Maputnik Style Editor in Web Map Development
JavaScript
1
star
82

311pusher

pushes chunks of 311 data to cartodb using the SQL api
JavaScript
1
star
83

nyc-capital-commitments-scrape

Node scraper for NYC Capital Commitments
JavaScript
1
star
84

mimolite-door-buzzer

SmartThings Custom Device Handler for MIMOlite connected to an apartment intercom
Groovy
1
star
85

sailingrace

KMZ track of a sailboat race, with 3D model
1
star
86

condo-docs

JavaScript
1
star
87

property-tax-project

Web Map for detailed exploration of NYC property tax bills
JavaScript
1
star
88

budgetude

NYC budget visualization app
JavaScript
1
star
89

nyc-zoning-lots-map

JavaScript
1
star
90

qri-dokku

A dockerfile and documentation for running a qri instance as a dokku app
Dockerfile
1
star
91

webinars

Code used in Mapbox Webinars
HTML
1
star
92

nyc_positions

Scraper for NYC full-time employee position data from the Supporting Schedules Budget Docs
JavaScript
1
star
93

maputnik-push

A mapboxGL plugin that pushes styles to Maputnik
JavaScript
1
star
94

mapboxgl-view-bounds

A simple demo that gets and visualizes the viewport quadrangle of a mapboxGL map.
HTML
1
star
95

nycbusproxy

Real-time Proxy API to convert MTA bustime API output to valid GeoJSON
JavaScript
1
star
96

icebreaker-map

A Mapbox-powered app for quickly searching for locations and adding markers for a selected location on a rotating globe
JavaScript
1
star
97

capital-budget-scrape

Scrapers for NYC Capital Budget pdfs
JavaScript
1
star
98

labs-pitch-deck

A pitch deck for starting NYC Planning Labs
JavaScript
1
star
99

portfolio

A projects portfolio that I may actually finish someday
JavaScript
1
star
100

arduinoACremoteV2

Using Socket.io and Websockets to control a Window Air Conditioner from the web
C++
1
star