docker-cartodb icon indicating copy to clipboard operation
docker-cartodb copied to clipboard

I want to enable https in this setup how can i do that

Open sandeepgadhwal opened this issue 7 years ago • 17 comments

I am hosting a container from this docker image on AWS EC-2 machine i have enable https in my security group and changed the port container listens to 443 problem is mydomain.com:443/login gets redirected to mydomain.com/login. This application ignores the port used is there a workaround.

sandeepgadhwal avatar Feb 15 '18 07:02 sandeepgadhwal

The carto service is running in development mode which disables ssl. To force the service to redirect to https you need to add config.force_ssl = true to the /cartodb/config/environments/development.rb.

The container is running nginx which is configured (/etc/nginx/sites-enabled/default) for http (port 80) not https. The nginx has to be configured for ssl, see https://nginx.org/en/docs/http/configuring_https_servers.html and https://certbot.eff.org/#ubuntuxenial-nginx to get a private/public key pair.

sverhoeven avatar Feb 16 '18 11:02 sverhoeven

After adding config.force_ssl = true i get redirections.

sandeepgadhwal avatar Mar 30 '18 23:03 sandeepgadhwal

Is there a way i can change http to https for widgets the same way here

Edit cartodb/app/models/user/user_decorator.rb line 100, replace base_url: public_url, with base_url: public_url.sub('http','https'),

sandeepgadhwal avatar Mar 30 '18 23:03 sandeepgadhwal

Edit resources_url_template in container

nano /Windshaft-cartodb/config/environments/development.js #Find resources_url_template change http to https in protocol of https version. Final Block like this:

,resources_url_templates: {
    http: 'http://carto.gq:{{=it.port}}/user/{{=it.user}}/api/v1/map',
    https: 'http://carto.gq:{{=it.port}}/user/{{=it.user}}/api/v1/map'
}

sandeepgadhwal avatar Mar 31 '18 00:03 sandeepgadhwal

hello, all is okay with https passage by the way i have one error :

Template 'tpl_1c38d890_a943_44ca_94dc_107b4c183493' of user 'dev' not found on dashboard when calling https://domain.ltd/user/dev/api/v1/map/static/named/tpl_1c38d890_a943_44ca_94dc_107b4c183493/300/170.png

any suggestion ?

Best regards

stockhausen avatar May 18 '18 14:05 stockhausen

It is generally a cache issue try to delete cache of your browser.

On Tue 29 May, 2018, 2:32 PM Stefan Verhoeven, [email protected] wrote:

Reopened #22 https://github.com/sverhoeven/docker-cartodb/issues/22.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sverhoeven/docker-cartodb/issues/22#event-1650558994, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2Myxri_Mp-oO_drSxhkRU8BjmsyCks5t3Q6TgaJpZM4SGa5_ .

sandeepgadhwal avatar May 29 '18 09:05 sandeepgadhwal

@sandeepgadhwal not working on browser it's 404 error of tpl cartodb server.

stockhausen avatar Jun 25 '18 11:06 stockhausen

Are the permissions to access map right because this happens when map template is not accessible either due to cache or access settings.

On Mon 25 Jun, 2018, 4:55 PM Fabien Leprovost, [email protected] wrote:

@sandeepgadhwal https://github.com/sandeepgadhwal not working on browser it's 404 error of tpl cartodb server.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sverhoeven/docker-cartodb/issues/22#issuecomment-399918995, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2CD_vz6jLu3493yarc9krHyLlyGNks5uAMiNgaJpZM4SGa5_ .

sandeepgadhwal avatar Jun 25 '18 11:06 sandeepgadhwal

yep data is public and carto is public

stockhausen avatar Jun 25 '18 11:06 stockhausen

Can you attach a screenshot

On Mon 25 Jun, 2018, 5:00 PM Fabien Leprovost, [email protected] wrote:

yep data is public and carto is public

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sverhoeven/docker-cartodb/issues/22#issuecomment-399920182, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2HWo-QzP68Mi_djPTrhzsjWf9c76ks5uAMnBgaJpZM4SGa5_ .

sandeepgadhwal avatar Jun 25 '18 11:06 sandeepgadhwal

the exact error is /**/ typeof _cdbc_2147922390_1 === 'function' && _cdbc_2147922390_1({"errors":["Template 'tpl_48540e68_87b2_4c5b_96c2_9e80e43b6d30' of user 'dev' not found"],"errors_with_context":[{"type":"unknown","message":"Template 'tpl_48540e68_87b2_4c5b_96c2_9e80e43b6d30' of user 'dev' not found"}]});

stockhausen avatar Jun 25 '18 13:06 stockhausen

I'm experiencing this exact same issue.

mgottholsen avatar Sep 10 '18 19:09 mgottholsen

Confirming that this issue (template for user 'dev' not found) is still present in master

caspervg avatar Jan 20 '19 12:01 caspervg

Credit goes to Aaron for this solution.

Hi Sandeep, I think I have worked it out.

if you are interested, the trick seems to be setting the ruby environment variable to production, otherwise, the ruby carto code will redirect you now, looks like carto have made a few changes lately.

I used sed to find and replace lines of code to speed up the trial and error process.

my docker file: FROM sverhoeven/cartodb:latest

RUN apt-get update RUN apt-get install -y -q nano

RUN cd /home/cartodb &&
mkdir tile_assets &&
chown -R 777 tile_assets

ENV RAILS_ENV production

RUN sed -i 's/base_url: public_url/base_url: public_url.sub('http','https')/g' /cartodb/app/models/user/user_decorator.rb

RUN sed -i "s/protocol: 'http'/protocol: 'https'/g" /cartodb/config/app_config.yml RUN sed -i "s/port: '80'/port: '443'/g" /cartodb/config/app_config.yml RUN sed -i "s/protocol: 'http'/protocol: 'https'/g" /cartodb/config/app_config.yml RUN sed -i "s/port: 80/port: 443/g" /cartodb/config/app_config.yml RUN sed -i 's/"http"/"https"/g' /cartodb/config/app_config.yml RUN sed -i 's/"80"/"443"/g' /cartodb/config/app_config.yml

RUN sed -i "s/http: 'http:/http: 'https:/g" /Windshaft-cartodb/config/environments/development.js RUN sed -i "s/https: 'http:/https: 'https:/g" /Windshaft-cartodb/config/environments/development.js

RUN cp /cartodb/config/environments/development.rb /cartodb/config/environments/production.rb

RUN sed -i "s/database: carto_db_production/database: carto_db_development/g" /cartodb/config/database.yml

RUN ls

On Sun 20 Jan, 2019, 5:30 PM Casper Van Gheluwe <[email protected] wrote:

Confirming that this issue (template for user 'dev' not found) is still present in master

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sverhoeven/docker-cartodb/issues/22#issuecomment-455860368, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2MH3wckCYujIAiNxc4_NOvJoxKB1ks5vFFpCgaJpZM4SGa5_ .

sandeepgadhwal avatar Jan 20 '19 12:01 sandeepgadhwal

Indeed setting ENV RAILS_ENV production is necessary to make CartoDB work with HTTPS. However, it unfortunately doesn't seem to solve the issue with templates that are not found.

caspervg avatar Jan 21 '19 15:01 caspervg

@sandeepgadhwal Do you have this fully working without the templates not found errors?

glaroc avatar May 10 '19 17:05 glaroc

I finally got this working without the missing templates problem. The key seems to be in setting this section of the app_config.yml file:

tiler:
    filter: 'mapnik'
    internal:
      protocol:      'http'
      domain:        ''
      port:          '8181'
      host:          '0.0.0.0'
      verifycert:     false

The rest of the private and public sections are set to https and port 443. These are the settings that worked for me. Now the missing template problem is gone.

I tried to summarize my configs in this fork: https://github.com/glaroc/docker-cartodb-https

glaroc avatar May 14 '19 20:05 glaroc