summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Torres2017-02-03 18:10:01 +0100
committerJavier Torres2017-02-03 18:10:20 +0100
commit51e2581d86f6ace6bcd570860b8fdd3f58ccf8ee (patch)
tree91b9b419ccae73dea21e9805e69cceca37cfd063
downloadaur-51e2581d86f6ace6bcd570860b8fdd3f58ccf8ee.tar.gz
First version
-rw-r--r--.SRCINFO33
-rw-r--r--Gemfile.patch63
-rw-r--r--PKGBUILD72
-rw-r--r--carto-builder.service14
-rw-r--r--carto-resque.service14
-rw-r--r--default_config.patch148
-rw-r--r--disable_preflight.patch41
-rw-r--r--ruby_24.patch48
8 files changed, 433 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..1b63b50d3166
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,33 @@
+# Generated by mksrcinfo v8
+# Fri Feb 3 17:10:11 UTC 2017
+pkgbase = carto-builder
+ pkgdesc = Location Intelligence & Data Visualization tool
+ pkgver = 4.0.0.r2368.feec05b8b6
+ pkgrel = 1
+ url = https://github.com/CartoDB/cartodb
+ arch = x86_64
+ license = BSD
+ makedepends = git
+ makedepends = npm
+ depends = ruby-bundler
+ depends = postgis
+ depends = redis
+ backup = etc/carto/builder/config/app_config.yml
+ backup = etc/carto/builder/config/database.yml
+ source = git+https://github.com/CartoDB/cartodb.git
+ source = Gemfile.patch
+ source = disable_preflight.patch
+ source = ruby_24.patch
+ source = default_config.patch
+ source = carto-builder.service
+ source = carto-resque.service
+ sha256sums = SKIP
+ sha256sums = b34dea111507e0044a1a059c84118c066e73280a2d9c00880c6af63d362064de
+ sha256sums = 44bdb4e954fa891745257205ca72707f985a32d7023daa03146d6512338a0097
+ sha256sums = 50ad83fadbb74ff44a19dfd1875b5ca05aac9f49ecfa690fa8ed104595868fe0
+ sha256sums = 2873a6644d7abca327c2c9125c9c1d9d1b452b1c8081149295b0e13614a4368c
+ sha256sums = 8cdc2866713b4ae0df5e007d672033b48992382186e53c8cb53d15a58755e8ae
+ sha256sums = 9dd127fc44c767fa6d7ba4f508680991006c5691466f9adc35a84e02a615aec7
+
+pkgname = carto-builder
+
diff --git a/Gemfile.patch b/Gemfile.patch
new file mode 100644
index 000000000000..7e525ffcc712
--- /dev/null
+++ b/Gemfile.patch
@@ -0,0 +1,63 @@
+diff --git a/Gemfile b/Gemfile
+index ff1065206f..deaa04d997 100644
+--- a/Gemfile
++++ b/Gemfile
+@@ -79,6 +79,8 @@ gem 'rollbar', '~>2.11.1'
+ gem 'resque', '1.25.2'
+ gem 'resque-metrics', '0.1.1'
+
++gem 'net-telnet'
++
+ # This is weird. In ruby 2 test-unit is required. We don't know why for sure
+ gem 'test-unit'
+
+diff --git a/Gemfile.lock b/Gemfile.lock
+index 8e04d12687..290278fe4d 100644
+--- a/Gemfile.lock
++++ b/Gemfile.lock
+@@ -163,7 +163,7 @@ GEM
+ hashie (>= 0.4.0)
+ multi_json (~> 1.0, >= 1.0.3)
+ journey (1.0.4)
+- json (1.8.3)
++ json (1.8.6)
+ json-schema (2.0.0)
+ jwt (1.5.4)
+ kgio (2.10.0)
+@@ -180,11 +180,12 @@ GEM
+ metaclass (~> 0.0.1)
+ mock_redis (0.16.0)
+ mono_logger (1.1.0)
+- msgpack (0.7.4)
++ msgpack (1.0.2)
+ multi_json (1.11.2)
+ multi_xml (0.5.5)
+ multipart-post (2.0.0)
+ net-ldap (0.11)
++ net-telnet (0.1.1)
+ nokogiri (1.6.6.4)
+ mini_portile (~> 0.6.0)
+ oauth (0.4.5)
+@@ -313,7 +314,7 @@ GEM
+ statsd-client (0.0.7)
+ test-unit (3.1.7)
+ power_assert
+- thin (1.6.4)
++ thin (1.7.0)
+ daemons (~> 1.0, >= 1.0.9)
+ eventmachine (~> 1.0, >= 1.0.4)
+ rack (~> 1.0)
+@@ -386,6 +387,7 @@ DEPENDENCIES
+ mocha (= 1.1.0)
+ mock_redis
+ net-ldap (= 0.11)
++ net-telnet
+ nokogiri (~> 1.6.6.2)
+ oauth (= 0.4.5)
+ oauth-plugin (= 0.4.0.pre4)
+@@ -429,4 +431,4 @@ DEPENDENCIES
+ webrick (= 1.3.1)
+
+ BUNDLED WITH
+- 1.11.2
++ 1.13.7
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..7bee7e51486e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,72 @@
+# Maintainer: Javier Torres <jtorres@carto.com>
+pkgname=carto-builder
+pkgver=4.0.0.r2368.feec05b8b6
+pkgrel=1
+pkgdesc="Location Intelligence & Data Visualization tool"
+arch=('x86_64')
+url="https://github.com/CartoDB/cartodb"
+license=('BSD')
+groups=()
+depends=('ruby-bundler' 'postgis' 'redis')
+makedepends=('git' 'npm')
+provides=()
+conflicts=()
+replaces=()
+backup=('etc/carto/builder/config/app_config.yml' 'etc/carto/builder/config/database.yml')
+options=()
+install=
+source=('git+https://github.com/CartoDB/cartodb.git'
+ 'Gemfile.patch'
+ 'disable_preflight.patch'
+ 'ruby_24.patch'
+ 'default_config.patch'
+ 'carto-builder.service'
+ 'carto-resque.service')
+noextract=()
+sha256sums=('SKIP'
+ 'b34dea111507e0044a1a059c84118c066e73280a2d9c00880c6af63d362064de'
+ '44bdb4e954fa891745257205ca72707f985a32d7023daa03146d6512338a0097'
+ '50ad83fadbb74ff44a19dfd1875b5ca05aac9f49ecfa690fa8ed104595868fe0'
+ '2873a6644d7abca327c2c9125c9c1d9d1b452b1c8081149295b0e13614a4368c'
+ '8cdc2866713b4ae0df5e007d672033b48992382186e53c8cb53d15a58755e8ae'
+ '9dd127fc44c767fa6d7ba4f508680991006c5691466f9adc35a84e02a615aec7')
+
+pkgver() {
+ cd "$srcdir/cartodb"
+ printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
+}
+
+prepare() {
+ cd "$srcdir/cartodb"
+ patch -p1 < "$srcdir/Gemfile.patch"
+ patch -p1 < "$srcdir/disable_preflight.patch"
+ patch -p1 < "$srcdir/ruby_24.patch"
+}
+
+build() {
+ cd "$srcdir/cartodb"
+ bundle install --path vendor/bundle
+ npm install
+ git submodule update --init
+ bundle exec node_modules/.bin/grunt
+}
+
+package() {
+ cd "$srcdir/cartodb"
+ mkdir -p "$pkgdir/opt/carto/builder"
+ cp -ar app .bundle config config.ru db Gemfile Gemfile.lock lib package.json public Rakefile script services vendor "$pkgdir/opt/carto/builder"
+ rm "$pkgdir/opt/carto/builder/lib/tasks/random_data.rake"
+ find "$pkgdir/opt/carto/builder" -name spec -type d -prune -exec rm -r {} \;
+
+ # Link to config
+ rm "$pkgdir/opt/carto/builder/config/app_config.yml" "$pkgdir/opt/carto/builder/config/database.yml"
+ ln -s "/etc/carto/builder/config/app_config.yml" "/etc/carto/builder/config/database.yml" "$pkgdir/opt/carto/builder/config"
+
+ install -Dm0644 "$srcdir/carto-builder.service" "$pkgdir/usr/lib/systemd/system/carto-builder.service"
+ install -Dm0644 "$srcdir/carto-resque.service" "$pkgdir/usr/lib/systemd/system/carto-resque.service"
+ install -Dm0644 config/app_config.yml.sample "$pkgdir/etc/carto/builder/config/app_config.yml"
+ install -Dm0644 config/database.yml.sample "$pkgdir/etc/carto/builder/config/database.yml"
+ install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+ mkdir -p "$pkgdir/var/log/carto/builder"
+}
diff --git a/carto-builder.service b/carto-builder.service
new file mode 100644
index 000000000000..257a5b894277
--- /dev/null
+++ b/carto-builder.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=CARTO Builder
+After=syslog.target network.target
+
+[Service]
+Type=simple
+WorkingDirectory=/opt/carto/builder
+Environment=RAILS_ENV=development
+Environment=HOME=/tmp
+Environment=RAILS_LOG_BASE_PATH=/var/log/carto/builder
+ExecStart=/usr/bin/bundle exec thin start --threaded -p 3000 --threadpool-size 5
+
+[Install]
+WantedBy=multi-user.target
diff --git a/carto-resque.service b/carto-resque.service
new file mode 100644
index 000000000000..3251d69efd35
--- /dev/null
+++ b/carto-resque.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=CARTO Builder queue
+After=syslog.target network.target
+
+[Service]
+Type=simple
+WorkingDirectory=/opt/carto/builder
+Environment=RAILS_ENV=development
+Environment=HOME=/tmp
+Environment=RAILS_CONFIG_BASE_PATH=/etc/carto/builder
+ExecStart=/usr/bin/bundle exec ./script/resque
+
+[Install]
+WantedBy=multi-user.target
diff --git a/default_config.patch b/default_config.patch
new file mode 100644
index 000000000000..83d0a27473cc
--- /dev/null
+++ b/default_config.patch
@@ -0,0 +1,148 @@
+diff --git a/config.ru b/config.ru
+index 8137b61079..0ba4f5d4fa 100644
+--- a/config.ru
++++ b/config.ru
+@@ -17,4 +17,5 @@
+ # ---------------------
+
+ require ::File.expand_path('../config/environment', __FILE__)
++use Rack::Static, :urls => ["/assets"], :root => "public"
+ run CartoDB::Application
+diff --git a/config/app_config.yml.sample b/config/app_config.yml.sample
+index 4dad079ad0..408d668aa9 100644
+--- a/config/app_config.yml.sample
++++ b/config/app_config.yml.sample
+@@ -9,15 +9,15 @@ defaults: &defaults
+ csv_guessing: true
+ debug_assets: true
+ mandatory_keys: [layer_opts, sql_api, varnish_management, redis, session_domain]
+- session_domain: '.localhost.lan'
++ session_domain: 'localhost'
+ # If activated, urls will use usernames in format //SESSION_DOMAIN/user/USERNAME and ignore subdomains if present
+- subdomainless_urls: false
++ subdomainless_urls: true
+ http_port: 3000 # nil|integer. HTTP port to use when building urls. Leave empty to use default (80)
+- https_port: # nil|integer. HTTPS port to use when building urls. Leave empty to use default (443)
++ https_port: 3000 # nil|integer. HTTPS port to use when building urls. Leave empty to use default (443)
+ secret_token: '71c2b25921b84a1cb21c71503ab8fb23'
+- account_host: 'localhost.lan:3000'
++ account_host: 'localhost:3000'
+ account_path: '/account'
+- vizjson_cache_domains: ['.localhost.lan']
++ vizjson_cache_domains: ['.localhost']
+ data_library:
+ username: 'common-data'
+ path: '/data-library'
+@@ -28,33 +28,33 @@ defaults: &defaults
+ filter: 'mapnik'
+ internal:
+ protocol: 'http'
+- domain: 'localhost.lan'
++ domain: 'localhost'
+ port: '8181'
+ host: '127.0.0.1'
+ verifycert: false
+ private:
+ protocol: 'http'
+- domain: 'localhost.lan'
++ domain: 'localhost'
+ port: '8181'
+ verifycert: false
+ public:
+ protocol: 'http'
+- domain: 'localhost.lan'
++ domain: 'localhost'
+ port: '8181'
+ verifycert: false
+ sql_api:
+ private:
+ protocol: 'http'
+- domain: 'localhost.lan'
++ domain: 'localhost'
+ endpoint: '/api/v1/sql'
+ port: 8080
+ public:
+ protocol: 'http'
+- domain: 'localhost.lan'
++ domain: 'localhost'
+ endpoint: '/api/v2/sql'
+ port: 8080
+ api_requests_service_url: ''
+- developers_host: 'http://developers.localhost.lan:3000'
++ developers_host: 'http://developers.localhost:3000'
+ google_analytics:
+ primary: ''
+ embeds: ''
+@@ -152,7 +152,7 @@ defaults: &defaults
+ timeout: 5 # socket timeout
+ trigger_verbose: true
+ redis:
+- host: '127.0.0.1'
++ host: '10.42.0.1'
+ port: 6379
+ connect_timeout: 2
+ read_timeout: 3
+@@ -163,7 +163,7 @@ defaults: &defaults
+ users_metadata: 5
+ redis_migrator_logs: 6
+ org_metadata_api:
+- host: 'localhost.lan'
++ host: 'localhost'
+ port: '3000'
+ username: "extension"
+ password: "elephant"
+@@ -253,10 +253,10 @@ defaults: &defaults
+ interactivity: "cartodb_id"
+ debug: false
+ visible: true
+- tiler_domain: "localhost.lan"
++ tiler_domain: "localhost"
+ tiler_port: "80"
+ tiler_protocol: "http"
+- sql_domain: "localhost.lan"
++ sql_domain: "localhost"
+ sql_port: "80"
+ sql_protocol: "http"
+ extra_params: { cache_policy: 'persist' }
+@@ -283,12 +283,12 @@ defaults: &defaults
+ # max_size_in_bytes: 1048576 # Optional, default is 1 MB
+ # location: 'organization_assets' # Optional subdirectory for local assets, default is 'organization_assets'
+ app_assets:
+- asset_host: "//cartodb-libs.global.ssl.fastly.net/cartodbui"
++ # asset_host: "//cartodb-libs.global.ssl.fastly.net/cartodbui"
+ avatars:
+ gravatar_enabled: true
+- base_url: 'example.com/avatars'
+- kinds: ['stars', 'mountains']
+- colors: ['red', 'blue']
++ base_url: '/assets/unversioned/images/avatars'
++ kinds: ['ghost', 'heart', 'marker', 'mountain', 'pacman', 'planet', 'star']
++ colors: ['green', 'orange', 'red', 'yellow']
+ dropbox_api_key: ""
+ gdrive:
+ api_key: ""
+@@ -535,6 +535,7 @@ defaults: &defaults
+ sqlserver:
+ enabled: false
+ max_rows: 500000
++ enforce_non_empty_layer_css: false
+
+ development:
+ <<: *defaults
+@@ -547,7 +548,6 @@ development:
+ url_purge_command: 'url.purge'
+ retries: 5
+ timeout: 5
+- enforce_non_empty_layer_css: false
+
+ test:
+ <<: *defaults
+@@ -557,7 +557,7 @@ test:
+ port: 6335
+ enforce_non_empty_layer_css: false
+ api_requests_es_service:
+- url: "http://api-calls-service.localhost.lan/search"
++ url: "http://api-calls-service.localhost/search"
+ body: ""
+
+ staging:
diff --git a/disable_preflight.patch b/disable_preflight.patch
new file mode 100644
index 000000000000..64796d30da7a
--- /dev/null
+++ b/disable_preflight.patch
@@ -0,0 +1,41 @@
+diff --git a/Gruntfile.js b/Gruntfile.js
+index 89c0a6d335..5f89ab7a18 100644
+--- a/Gruntfile.js
++++ b/Gruntfile.js
+@@ -27,36 +27,6 @@
+
+ if (timer) timer.init(grunt);
+
+- function preFlight(done) {
+- function checkVersion(cmd, versionRegExp, name, done) {
+- require("child_process").exec(cmd, function (error, stdout, stderr) {
+- var err = null;
+- if (error) {
+- err = 'failed to check version for ' + name;
+- } else {
+- if (!versionRegExp.test(stdout)) {
+- err = 'installed ' + name + ' version does not match with required one ' + versionRegExp.toString() + " installed: " + stdout;
+- }
+- }
+- if (err) {
+- grunt.log.fail(err);
+- }
+- done && done(err ? new Error(err): null);
+- });
+- }
+- checkVersion('npm -v', REQUIRED_NPM_VERSION, 'npm', done);
+- checkVersion('node -v', REQUIRED_NODE_VERSION, 'node', done);
+- }
+-
+- preFlight(function (err) {
+- if (err) {
+- grunt.log.fail("############### /!\\ CAUTION /!\\ #################");
+- grunt.log.fail("PLEASE installed required versions to build CARTO:\n- npm: " + REQUIRED_NPM_VERSION + "\n- node: " + REQUIRED_NODE_VERSION);
+- grunt.log.fail("#################################################");
+- process.exit(1);
+- }
+- });
+-
+ var duplicatedModules = duplicatedDependencies(require('./npm-shrinkwrap.json'), SHRINKWRAP_MODULES_TO_VALIDATE);
+ if (duplicatedModules.length > 0) {
+ grunt.log.fail("############### /!\\ CAUTION /!\\ #################");
diff --git a/ruby_24.patch b/ruby_24.patch
new file mode 100644
index 000000000000..fe90a907d6ef
--- /dev/null
+++ b/ruby_24.patch
@@ -0,0 +1,48 @@
+diff --git a/config/initializers/02_extensions.rb b/config/initializers/02_extensions.rb
+index 7f20f24fee..c66c417911 100644
+--- a/config/initializers/02_extensions.rb
++++ b/config/initializers/02_extensions.rb
+@@ -1,3 +1,27 @@
+ # Disable XML parameter parsing, see:
+ # http://www.insinuator.net/2013/01/rails-yaml/
+-ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
++ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
++
++# Patches for Ruby 2.4
++class ActiveSupport::Duration
++ def coerce(other)
++ [other, to_i]
++ end
++end
++
++require 'arel'
++module Arel
++ module Visitors
++ class Dot
++ alias :visit_Integer :visit_String
++ end
++
++ class ToSql
++ alias :visit_Integer :literal
++ end
++
++ class DepthFirst
++ alias :visit_Integer :terminal
++ end
++ end
++end
+diff --git a/db/migrate/20110125100508_tags.rb b/db/migrate/20110125100508_tags.rb
+index fdfd0ef53a..1967aff57b 100644
+--- a/db/migrate/20110125100508_tags.rb
++++ b/db/migrate/20110125100508_tags.rb
+@@ -4,8 +4,8 @@ class TagsMigration < Sequel::Migration
+ create_table :tags do
+ primary_key :id
+ String :name, :null => false
+- Fixnum :user_id, :null => false, :index => true
+- Fixnum :table_id, :null => false, :index => true
++ Integer :user_id, :null => false, :index => true
++ Integer :table_id, :null => false, :index => true
+ index [:user_id, :table_id, :name], :unique => true
+ end
+ end