Skip to content

Configurable port number #59

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ ENV GDAL_DATA /usr/share/gdal/2.2
ENV SYNC_TABLES_INTERVAL 3600

ADD ./startup.sh /opt/startup.sh
ADD ./healthcheck.sh /opt/healthcheck.sh

CMD ["/bin/bash", "/opt/startup.sh"]
HEALTHCHECK CMD curl -f http://localhost || exit 1
HEALTHCHECK CMD /bin/bash /opt/healthcheck.sh
4 changes: 2 additions & 2 deletions config/WS-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ var config = {
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `base_url_detached`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
,resources_url_templates: {
http: 'http://cartodb.localhost/user/{{=it.user}}/api/v1/map',
https: 'http://cartodb.localhost/user/{{=it.user}}/api/v1/map'
http: 'http://CARTO_HOST/user/{{=it.user}}/api/v1/map',
https: 'http://CARTO_HOST/user/{{=it.user}}/api/v1/map'
}

// Maximum number of connections for one process
Expand Down
44 changes: 22 additions & 22 deletions config/app_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ defaults: &defaults
csv_guessing: true
debug_assets: true
mandatory_keys: [layer_opts, sql_api, varnish_management, redis, session_domain]
session_domain: 'cartodb.localhost'
session_domain: 'CARTO_HOST'
# If activated, urls will use usernames in format //SESSION_DOMAIN/user/USERNAME and ignore subdomains if present
subdomainless_urls: true
http_port: # 3000 # nil|integer. HTTP port to use when building urls. Leave empty to use default (80)
http_port: CARTO_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)
secret_token: '71c2b25921b84a1cb21c71503ab8fb23'
account_host: 'cartodb.localhost:3000'
account_host: 'CARTO_HOST:3000'
# Here you can define other hosts different to account_host that also will be CORS enabled
# cors_enabled_hosts:
# - example.com
Expand All @@ -33,32 +33,32 @@ defaults: &defaults
filter: 'mapnik'
internal:
protocol: 'http'
domain: 'cartodb.localhost'
port: '80'
domain: 'CARTO_HOST'
port: 'CARTO_PORT'
verifycert: false
private:
protocol: 'http'
domain: 'cartodb.localhost'
port: '80'
domain: 'CARTO_HOST'
port: 'CARTO_PORT'
verifycert: false
public:
protocol: 'http'
domain: 'cartodb.localhost'
port: '80'
domain: 'CARTO_HOST'
port: 'CARTO_PORT'
verifycert: false
sql_api:
private:
protocol: 'http'
domain: 'cartodb.localhost'
domain: 'CARTO_HOST'
endpoint: '/api/v2/sql'
port: 80
port: CARTO_PORT
public:
protocol: 'http'
domain: 'cartodb.localhost'
domain: 'CARTO_HOST'
endpoint: '/api/v2/sql'
port: 80
port: CARTO_PORT
api_requests_service_url: ''
developers_host: 'http://developers.cartodb.localhost:3000'
developers_host: 'http://developers.CARTO_HOST:3000'
google_analytics:
primary: ''
embeds: ''
Expand Down Expand Up @@ -145,7 +145,7 @@ defaults: &defaults
reports:
mail_to: ''
mailer:
from: 'cartodb.localhost <support@cartodb.localhost>'
from: 'CARTO_HOST <support@CARTO_HOST>'
address: ''
port: ''
user_name: ''
Expand Down Expand Up @@ -293,11 +293,11 @@ defaults: &defaults
interactivity: "cartodb_id"
debug: false
visible: true
tiler_domain: "cartodb.localhost"
tiler_port: "80"
tiler_domain: "CARTO_HOST"
tiler_port: "CARTO_PORT"
tiler_protocol: "http"
sql_domain: "cartodb.localhost"
sql_port: "80"
sql_domain: "CARTO_HOST"
sql_port: "CARTO_PORT"
sql_protocol: "http"
extra_params: { cache_policy: 'persist' }
tile_style_history: []
Expand All @@ -308,7 +308,7 @@ defaults: &defaults
kind: "background"
options: { color: '#ffffff' }
cartodb_com_hosted: false
cartodb_central_domain_name: 'cartodb.localhost'
cartodb_central_domain_name: 'CARTO_HOST'
aws:
s3:
access_key_id: "test"
Expand All @@ -325,7 +325,7 @@ 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.localhost"
asset_host: "//CARTO_HOST:CARTO_PORT"
avatars:
gravatar_enabled: true
base_url: '/assets/unversioned/images/avatars'
Expand Down Expand Up @@ -753,7 +753,7 @@ test:
port: 6335
enforce_non_empty_layer_css: false
api_requests_es_service:
url: "http://api-calls-service.cartodb.localhost/search"
url: "http://api-calls-service.CARTO_HOST/search"
body: ""
session_domain: '.localhost.lan'
subdomainless_urls: false
Expand Down
4 changes: 3 additions & 1 deletion config/cartodb.nginx.proxy.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
server {
server_name cartodb.localhost *.cartodb.localhost;
server_name CARTO_HOST *.CARTO_HOST;

listen CARTO_PORT default_server;

client_max_body_size 150M;

Expand Down
6 changes: 6 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash

export CARTO_HOSTNAME=${CARTO_HOSTNAME:=$HOSTNAME}
export CARTO_PORT=${CARTO_PORT:=80}

curl -f http://localhost:${CARTO_PORT} || exit 1
4 changes: 3 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

export CARTO_HOSTNAME=${CARTO_HOSTNAME:=$HOSTNAME}
export CARTO_PORT=${CARTO_PORT:=80}

perl -pi -e 's/cartodb\.localhost/$ENV{"CARTO_HOSTNAME"}/g' /etc/nginx/sites-enabled/default /cartodb/config/app_config.yml /Windshaft-cartodb/config/environments/development.js
perl -pi -e 's/CARTO_HOST/$ENV{"CARTO_HOSTNAME"}/g' /etc/nginx/sites-enabled/default /cartodb/config/app_config.yml /Windshaft-cartodb/config/environments/development.js
perl -pi -e 's/CARTO_PORT/$ENV{"CARTO_PORT"}/g' /etc/nginx/sites-enabled/default /cartodb/config/app_config.yml

PGDATA=/var/lib/postgresql
if [ "$(stat -c %U $PGDATA)" != "postgres" ]; then
Expand Down