-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a specialized database container (#1726)
* Add db initialization to database container * Add database to build components * Update GitHub Actions to build & update database component * Add test build of database container to GitHub Actions workflow
- Loading branch information
Showing
11 changed files
with
155 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: database | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
docker_build: | ||
if: ${{ github.event.type }} == "PullRequest" | ||
runs-on: ubuntu-latest | ||
steps: | ||
# For subfolders, currently a full checkout is required. | ||
# See: https://github.com/marketplace/actions/build-and-push-docker-images#path-context | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build database image | ||
run: | | ||
deploy/scripts/build.py --components database | ||
shell: bash | ||
- name: Image digest | ||
run: | | ||
docker image inspect combine_database:latest -f '{{json .Id}}' | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM mongo:5.0 | ||
|
||
WORKDIR /app | ||
|
||
RUN mkdir /data/semantic-domains | ||
|
||
# Copy semantic domain import files | ||
COPY semantic_domains/* /data/semantic-domains/ | ||
|
||
# from https://hub.docker.com/_/mongo | ||
# Initializing a fresh instance | ||
# When a container is started for the first time it will execute files | ||
# with extensions .sh and .js that are found in /docker-entrypoint-initdb.d. | ||
# Files will be executed in alphabetical order. .js files will be executed | ||
# by mongosh (mongo on versions below 6) using the database specified by | ||
# the MONGO_INITDB_DATABASE variable, if it is present, or test otherwise. | ||
# You may also switch databases within the .js script. | ||
COPY init/* /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#! /usr/bin/bash | ||
|
||
mongoimport -d CombineDatabase -c SemanticDomainTree /data/semantic-domains/tree.json --mode=merge --upsertFields=id,guid,lang | ||
mongoimport -d CombineDatabase -c SemanticDomains /data/semantic-domains/nodes.json --mode=merge --upsertFields=id,guid,lang |
25 changes: 25 additions & 0 deletions
25
deploy/helm/thecombine/charts/database/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{/* Build container image name */}} | ||
{{- define "database.containerImage" -}} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- $registry := .Values.global.imageRegistry }} | ||
{{- if contains "awsEcr" .Values.global.imageRegistry }} | ||
{{- $registry = printf "%s.dkr.ecr.%s.amazonaws.com" .Values.global.awsAccount .Values.global.awsDefaultRegion }} | ||
{{- end }} | ||
{{- printf "%s/%s:%s" $registry .Values.imageName .Values.global.imageTag }} | ||
{{- else }} | ||
{{- printf "%s:%s" .Values.imageName .Values.global.imageTag }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* Get the Image Pull Policy */}} | ||
{{- define "database.imagePullPolicy" }} | ||
{{- if .Values.global.imagePullPolicy }} | ||
{{- print .Values.global.imagePullPolicy }} | ||
{{- else }} | ||
{{- if eq .Values.global.imageTag "latest" }} | ||
{{- print "Always" }} | ||
{{- else }} | ||
{{- print "IfNotPresent" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters