Skip to content

Commit

Permalink
Merge pull request #410 from openaddresses/switch-to-protomaps-for-pr…
Browse files Browse the repository at this point in the history
…eview

Use Protomaps for fabric map
  • Loading branch information
iandees authored Nov 20, 2024
2 parents 601a56e + fc0b339 commit 40db11f
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ On every commit, GitHub actions will build the latest Docker image and push it t
This parameter will be populated automatically by the `deploy` cli and simply points the stack
to use the correspondingly Docker image from ECR.

#### MapboxToken
#### ProtomapsKey

A read-only Mapbox API token for displaying base maps underneath our address data. (Token should start with `pk.`)
A Protomaps API key ([from here](https://protomaps.com/dashboard)) for displaying base maps underneath our address data.

#### Bucket

Expand Down
4 changes: 2 additions & 2 deletions api/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export default class Config {
this.R2Bucket = process.env.R2Bucket;
}

if (!process.env.MAPBOX_TOKEN) {
throw new Error('not ok - MAPBOX_TOKEN env var required');
if (!process.env.PROTOMAPS_KEY) {
throw new Error('not ok - PROTOMAPS_KEY env var required');
}

if (!process.env.CLOUDFLARE_ACCOUNT_ID) {
Expand Down
2 changes: 1 addition & 1 deletion api/lib/types/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Map extends Generic {

static map() {
return {
token: process.env.MAPBOX_TOKEN
protomaps_key: process.env.PROTOMAPS_KEY
};
}

Expand Down
3 changes: 1 addition & 2 deletions api/web/src/components/Fabric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ export default {
init: async function() {
try {
const res = await window.std('/api/map');
mapboxgl.accessToken = res.token;
this.map = new mapboxgl.Map({
container: 'map',
center: this.tilejson.center,
zoom: this.tilejson.minzoom,
style: 'mapbox://styles/ingalls/ckvh0wwm8g2cw15r05ozt0ybr'
style: 'https://api.protomaps.com/styles/v2/grayscale.json?key=' + res.protomaps_key
});
this.map.addControl(new mapboxgl.NavigationControl(), 'bottom-right');
Expand Down
4 changes: 2 additions & 2 deletions cloudformation/batch.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const stack = {
Type: 'String',
Description: 'Gitsha to Deploy'
},
MapboxToken: {
ProtomapsKey: {
Type: 'String',
Description: '[secure] Mapbox API Token to create Slippy Maps With'
Description: '[secure] Protomaps API Key to create Slippy Maps With'
},
Bucket: {
Type: 'String',
Expand Down
2 changes: 1 addition & 1 deletion cloudformation/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default {
{ Name: 'T3_CLUSTER_ASG', Value: cf.importValue('t3-cluster-asg') },
{ Name: 'MEGA_QUEUE', Value: cf.importValue('mega-queue') },
{ Name: 'ECS_LOG_LEVEL', Value: 'debug' },
{ Name: 'MAPBOX_TOKEN', Value: cf.ref('MapboxToken') },
{ Name: 'PROTOMAPS_KEY', Value: cf.ref('ProtomapsKey') },
{ Name: 'OPENCOLLECTIVE_API_KEY', Value: cf.ref('OpenCollective') },
{ Name: 'POSTGRES', Value: cf.join(['postgresql://openaddresses:', cf.ref('DatabasePassword'), '@', cf.getAtt('DBInstanceVPC', 'Endpoint.Address'), ':5432/openaddresses?sslmode=no-verify']) },
{ Name: 'SharedSecret', Value: cf.sub('{{resolve:secretsmanager:${AWS::StackName}/api/signing-secret:SecretString::AWSCURRENT}}') },
Expand Down
2 changes: 1 addition & 1 deletion cloudformation/lib/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
ContainerProperties: {
Environment: [
{ Name: 'T3_CLUSTER_ASG', Value: cf.importValue('t3-cluster-asg') },
{ Name: 'MAPBOX_TOKEN', Value: cf.ref('MapboxToken') },
{ Name: 'PROTOMAPS_KEY', Value: cf.ref('ProtomapsKey') },
{ Name: 'R2_ACCESS_KEY_ID', Value: cf.ref('R2AccessKeyID') },
{ Name: 'R2_SECRET_ACCESS_KEY', Value: cf.ref('R2SecretAccessKey') },
{ Name: 'CLOUDFLARE_ACCOUNT_ID', Value: cf.ref('CloudflareAccountID') },
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- 5001:5000
environment:
- POSTGRES=postgres://docker:docker@postgis:5432/gis
- MAPBOX_TOKEN
- PROTOMAPS_KEY

postgis:
image: kartoza/postgis:13.0
Expand Down
2 changes: 1 addition & 1 deletion task/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:22-alpine3.19 AS node
FROM 847904970422.dkr.ecr.us-east-1.amazonaws.com/batch-machine:9.5.0
FROM 847904970422.dkr.ecr.us-east-1.amazonaws.com/batch-machine:9.6.0

COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/share /usr/local/share
Expand Down
2 changes: 1 addition & 1 deletion task/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function process_job(job) {
'--layer', job.layer,
'--layersource', job.name,
'--render-preview',
'--mapbox-key', process.env.MAPBOX_TOKEN,
'--protomaps-key', process.env.PROTOMAPS_KEY,
'--verbose'
],{
env: process.env
Expand Down

0 comments on commit 40db11f

Please sign in to comment.