Skip to content

Commit

Permalink
Merge pull request #54 from UKHomeOffice/feature/public-search
Browse files Browse the repository at this point in the history
Feature/public search
  • Loading branch information
lennym committed Oct 26, 2020
2 parents 8a0ffde + b57eecd commit 65eb2ab
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
41 changes: 34 additions & 7 deletions conductor.json
Expand Up @@ -39,7 +39,8 @@
"links": [
"postgres",
"asl-permissions",
"asl-workflow"
"asl-workflow",
"asl-public-search"
],
"env": {
"WORKFLOW_SERVICE": "http://{{services.asl-workflow.host}}:{{services.asl-workflow.port}}",
Expand All @@ -53,7 +54,8 @@
"KEYCLOAK_CLIENT": "{{env.KEYCLOAK_CLIENT}}",
"KEYCLOAK_SECRET": "{{env.KEYCLOAK_SECRET}}",
"KEYCLOAK_USERNAME": "{{env.KEYCLOAK_USERNAME}}",
"KEYCLOAK_PASSWORD": "{{env.KEYCLOAK_PASSWORD}}"
"KEYCLOAK_PASSWORD": "{{env.KEYCLOAK_PASSWORD}}",
"SEARCH_SERVICE": "http://{{services.asl-public-search.host}}:{{services.asl-public-search.port}}"
}
},
{
Expand Down Expand Up @@ -106,7 +108,7 @@
"ASL_DATABASE_HOST": "{{services.postgres.host}}",
"NOTIFICATIONS_SERVICE": "http://{{services.asl-notifications.host}}:{{services.asl-notifications.port}}",
"PERMISSIONS_SERVICE": "http://{{services.asl-permissions.host}}:{{services.asl-permissions.port}}",
"SEARCH_SERVICE": "http://{{services.asl-search.host}}:{{services.asl-search.port}}"
"SEARCH_SERVICE": "http://{{services.asl-internal-search.host}}:{{services.asl-internal-search.port}}"
}
},
{
Expand Down Expand Up @@ -177,7 +179,7 @@
"asl-permissions",
"asl-workflow",
"asl-public-api",
"asl-search"
"asl-internal-search"
],
"env": {
"API_URL": "http://{{services.asl-public-api.host}}:{{services.asl-public-api.port}}",
Expand All @@ -191,7 +193,7 @@
"KEYCLOAK_URL": "{{env.KEYCLOAK_URL}}",
"KEYCLOAK_CLIENT": "{{env.KEYCLOAK_CLIENT}}",
"KEYCLOAK_SECRET": "{{env.KEYCLOAK_SECRET}}",
"SEARCH_SERVICE": "http://{{services.asl-search.host}}:{{services.asl-search.port}}"
"SEARCH_SERVICE": "http://{{services.asl-internal-search.host}}:{{services.asl-internal-search.port}}"
}
},
{
Expand Down Expand Up @@ -253,7 +255,8 @@
}
},
{
"name": "asl-search",
"name": "asl-internal-search",
"image": "quay.io/ukhomeofficedigital/asl-search",
"port": 8090,
"links": [
"postgres",
Expand All @@ -268,7 +271,31 @@
"KEYCLOAK_REALM": "{{env.KEYCLOAK_REALM}}",
"KEYCLOAK_URL": "{{env.KEYCLOAK_URL}}",
"KEYCLOAK_CLIENT": "{{env.KEYCLOAK_CLIENT}}",
"KEYCLOAK_SECRET": "{{env.KEYCLOAK_SECRET}}"
"KEYCLOAK_SECRET": "{{env.KEYCLOAK_SECRET}}",
"ENABLE_GLOBAL_SEARCH": "'TRUE'",
"ENABLE_INDEXER": "'TRUE'"
}
},
{
"name": "asl-public-search",
"image": "quay.io/ukhomeofficedigital/asl-search",
"port": 8091,
"links": [
"postgres",
"elasticsearch"
],
"env": {
"ELASTIC_NODE": "http://{{services.elasticsearch.host}}:{{services.elasticsearch.port}}",
"DATABASE_NAME": "{{env.DATABASE_NAME}}",
"DATABASE_USERNAME": "{{env.DATABASE_USERNAME}}",
"DATABASE_PASSWORD": "{{env.DATABASE_PASSWORD}}",
"DATABASE_HOST": "{{services.postgres.host}}",
"KEYCLOAK_REALM": "{{env.KEYCLOAK_REALM}}",
"KEYCLOAK_URL": "{{env.KEYCLOAK_URL}}",
"KEYCLOAK_CLIENT": "{{env.KEYCLOAK_CLIENT}}",
"KEYCLOAK_SECRET": "{{env.KEYCLOAK_SECRET}}",
"ENABLE_GLOBAL_SEARCH": "'FALSE'",
"ENABLE_INDEXER": "'FALSE'"
}
},
{
Expand Down
21 changes: 18 additions & 3 deletions lib/conductor.js
Expand Up @@ -28,11 +28,26 @@ module.exports = (settings, args) => {
return { ...service };
};

const getLatestTag = name => {
return fetch(`https://quay.io/api/v1/repository/ukhomeofficedigital/${name}/tag`).json
.then(response => Object.values(response.tags))
.then(tags => tags[0]);
};

const getImage = service => {
if (service.image && service.image !== service.name && !service.image.includes(':')) {
const imageName = service.image.split('/').pop();
return getLatestTag(imageName)
.then(tag => tag && `${service.image}:${tag.name}`)
.then(image => {
return ImageCache.write(service.name, image)
.then(() => {
return { ...service, image };
});
});
}
if (args.pull && !service.image && !service.build) {
return fetch(`https://quay.io/api/v1/repository/ukhomeofficedigital/${service.name}/tag`).json
.then(response => Object.values(response.tags))
.then(tags => tags[0])
return getLatestTag(service.name)
.then(tag => tag && `quay.io/ukhomeofficedigital/${service.name}:${tag.name}`)
.then(image => {
return ImageCache.write(service.name, image)
Expand Down

0 comments on commit 65eb2ab

Please sign in to comment.