diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e237b706026a41bd677eee748fb4654f5eebd910..50618075bfd71767609b22a2e26082400f31ab0d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -180,7 +180,7 @@ e2e: variables: ENV_HOST: workflow before_script: - - docker build -t base-build:ci --target base-build -f apps/web/Dockerfile.dev . + - docker build -t base-build:ci --target base-build -f apps/web/Dockerfile --build-arg env=dev . - docker build -t e2e:${CI_COMMIT_SHORT_SHA} -f apps/web/Dockerfile.ci . script: # setting env variables with .env https://docs.docker.com/compose/environment-variables/ diff --git a/Makefile b/Makefile index 3a15a0f68eaf096f140a92a2b353f99b2fb95521..dd8aba6707d4354fe473bb308eb09aab6294dc58 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all: dev check-build # Check if local code will pass CI build check-build: docker-base docker-dev-images-locally test-dev -# Run tests on Dockerfile.dev images +# Run tests on Dockerfile images test-dev: docker run nrao:workflow ./bin/run-tests.sh docker run nrao:capability ./bin/run-tests.sh @@ -32,7 +32,7 @@ alembic-update: cd schema; \ env CAPO_PROFILE=local alembic upgrade head -# Build images from Dockerfile.dev +# Build images from Dockerfile docker-dev-images-locally: docker build -t nrao:workflow -f services/workflow/Dockerfile.local . --build-arg capo_env=docker docker build -t nrao:capability -f services/capability/Dockerfile.local . --build-arg capo_env=docker diff --git a/apps/web/Dockerfile.dev b/apps/web/Dockerfile similarity index 87% rename from apps/web/Dockerfile.dev rename to apps/web/Dockerfile index c5421ed3bc23d24bf95cb67f3649fc21f5c1bde0..44387361ccd2168fffe6c0addcb99db31c05b304 100644 --- a/apps/web/Dockerfile.dev +++ b/apps/web/Dockerfile @@ -1,5 +1,10 @@ FROM ssa-containers.aoc.nrao.edu/ops/base:nodejs-14 as base-build +# Requies build-arg $env +# Build arg that sets environment; sets to "dev" if no build arg is given +ARG env=dev +ENV ENV=${env} + # Switch to vlapipe USER vlapipe @@ -37,7 +42,7 @@ USER vlapipe COPY --chown=vlapipe:vlapipe ./apps/web ./ # Build the angular app -RUN ./node_modules/.bin/ng build --configuration=dev --output-path=dist +RUN ./node_modules/.bin/ng build --configuration=${ENV} --output-path=dist # ## NGINX section of multi-stage image diff --git a/apps/web/Dockerfile.ci b/apps/web/Dockerfile.ci index b9586b7e85bd66c630e924497a68ed7a7dc2d4fd..89395a15fbe2649291ed7b2087392fd793a6ed41 100644 --- a/apps/web/Dockerfile.ci +++ b/apps/web/Dockerfile.ci @@ -1,9 +1,9 @@ -# base-build:ci references the first stage in app/web/Dockerfile.dev +# base-build:ci references the first stage in app/web/Dockerfile # in which npm install has already been ran and app/web/ has been # copied to /app in the image # For e2e testing, we want to use this first stage as the base for our -# e2e container when we run e2e tests in the CI. We'll copy /app/ from +# e2e container when we run e2e tests in the CI. We'll copy /app/ from # base-build:ci and copy it to /app of the trion/ng-cli-karma:11.2.7 image. # Then we are able to run `ng e2e` with our Angular environment already setup. # https://hub.docker.com/r/trion/ng-cli-karma/ @@ -17,4 +17,3 @@ WORKDIR /app COPY --from=web-base /home/vlapipe/app/ ./ CMD ./node_modules/protractor/bin/webdriver-manager update --versions.chrome 89.0.4389.114 && ng e2e --configuration=ci --webdriver-update=false - diff --git a/apps/web/angular.json b/apps/web/angular.json index 4d3f27bb2c4a9a8b2e391a2c519d97f61279123f..81dcdd0e2915f6bc2779ae07a6acf9da34655f60 100644 --- a/apps/web/angular.json +++ b/apps/web/angular.json @@ -36,7 +36,7 @@ "scripts": [] }, "configurations": { - "production": { + "prod": { "fileReplacements": [ { "replace": "src/environments/environment.ts", @@ -183,6 +183,9 @@ }, "test": { "baseUrl": "https://ws-test.nrao.edu" + }, + "prod": { + "baseUrl": "https://ws.nrao.edu" } } }, diff --git a/apps/web/src/environments/environment.prod.ts b/apps/web/src/environments/environment.prod.ts index 15fdc275f440b3113759c346d2402109f3bb760b..913b12f975a017434f2a343e47d4634fdaa4b9d8 100644 --- a/apps/web/src/environments/environment.prod.ts +++ b/apps/web/src/environments/environment.prod.ts @@ -1,7 +1,7 @@ export const environment = { production: true, // archive search services - apiUrl: 'https://webtest.aoc.nrao.edu/archive-service/', + apiUrl: "https://data.nrao.edu/archive-service/", // workspace services - workspacesUrl: 'http://localhost:3457/' + workspacesUrl: "http://ws.nrao.edu/", }; diff --git a/ci/build.template.yml b/ci/build.template.yml index d3c8ce507f036fcf8bf3225b24f25601d5d7e63d..4f12887b36c9966c30cc265213aa3da27ba21097 100644 --- a/ci/build.template.yml +++ b/ci/build.template.yml @@ -1,11 +1,9 @@ # CI Build Template .build: - variables: - CAPO_BUILD_ARG: "docker" script: - echo "Building branch or tag -- ${IMAGE_TAG}" - NAME="${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}" - - docker build -t ${NAME}:${CI_COMMIT_SHORT_SHA} -f ${PATH_PREFIX}${SERVICE_NAME}/Dockerfile.dev . --build-arg capo_env=${CAPO_BUILD_ARG} --build-arg TAGNAME=${CI_COMMIT_SHORT_SHA} + - docker build -t ${NAME}:${CI_COMMIT_SHORT_SHA} -f ${PATH_PREFIX}${SERVICE_NAME}/Dockerfile . --build-arg env=${DEPLOY_ENV} --build-arg TAGNAME=${CI_COMMIT_SHORT_SHA} - docker tag ${NAME}:${CI_COMMIT_SHORT_SHA} ${NAME}:${IMAGE_TAG} - echo "TAG=${IMAGE_TAG}" >> build.env artifacts: @@ -15,9 +13,12 @@ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: IMAGE_TAG: $CI_COMMIT_BRANCH + DEPLOY_ENV: "dev" - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' variables: IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME + DEPLOY_ENV: "dev" + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/' variables: IMAGE_TAG: $CI_COMMIT_TAG @@ -27,4 +28,4 @@ variables: IMAGE_TAG: $CI_COMMIT_TAG # override DEPLOY_ENV - DEPLOY_ENV: "prod" \ No newline at end of file + DEPLOY_ENV: "prod" diff --git a/config/htcondor/submit/99-workspaces-submit.prod.conf b/config/htcondor/submit/99-workspaces-submit.prod.conf new file mode 100644 index 0000000000000000000000000000000000000000..7ba55acf9c8c9c18bce38fb43e16afdf25e96254 --- /dev/null +++ b/config/htcondor/submit/99-workspaces-submit.prod.conf @@ -0,0 +1,21 @@ +CONDOR_HOST = nmpost-cm.aoc.nrao.edu + +use ROLE : Submit + +ALLOW_WRITE = *.aoc.nrao.edu +ALLOW_DAEMON = $(ALLOW_WRITE) + +# one or more submit hosts has an external IP +PRIVATE_NETWORK_NAME = nrao.edu + +# while not in production yet +CONDOR_ADMIN = krowe@nrao.edu + +# send email if job errors +JOB_DEFAULT_NOTIFICATION = ERROR + +# Differentiate from other pools if needed +PoolName = "nmpost" + +# Set UID domain +UID_DOMAIN = aoc.nrao.edu diff --git a/services/capability/Dockerfile.dev b/services/capability/Dockerfile similarity index 83% rename from services/capability/Dockerfile.dev rename to services/capability/Dockerfile index ae5e77d8d32d31c6e2e2ee801fe892dd81da2313..740587c73ecd0069609084e7c75e03ea3ba5475e 100644 --- a/services/capability/Dockerfile.dev +++ b/services/capability/Dockerfile @@ -20,8 +20,8 @@ ENV PATH "${PATH}:/home/vlapipe/.local/bin" RUN python setup.py develop --user -# Set Capo -ARG capo_env=dsoc-dev -ENV CAPO_PROFILE $capo_env +# Set Capo for build stage +# Gets reset to proper environment's profile in the deploy stage +ENV CAPO_PROFILE docker CMD ["pserve", "--reload", "development.ini"] diff --git a/services/notification/Dockerfile.dev b/services/notification/Dockerfile similarity index 83% rename from services/notification/Dockerfile.dev rename to services/notification/Dockerfile index 12e7470b2986ec82dd98cc9ddca91760c02f3ec7..851796570d59c868308b2f2b7e5ad18e2197b447 100644 --- a/services/notification/Dockerfile.dev +++ b/services/notification/Dockerfile @@ -20,8 +20,8 @@ ENV PATH "${PATH}:/home/vlapipe/.local/bin" RUN python setup.py develop --user -# Set Capo -ARG capo_env=dsoc-dev -ENV CAPO_PROFILE $capo_env +# Set Capo for build stage +# Gets reset to proper environment's profile in the deploy stage +ENV CAPO_PROFILE docker CMD ["pserve", "--reload", "development.ini"] diff --git a/services/workflow/Dockerfile.dev b/services/workflow/Dockerfile similarity index 77% rename from services/workflow/Dockerfile.dev rename to services/workflow/Dockerfile index 2ac9111f25066f14f46d3d32b59abf07fb5f722b..f0910f86c4425126bf6ea143afa95bab6c54b121 100644 --- a/services/workflow/Dockerfile.dev +++ b/services/workflow/Dockerfile @@ -2,6 +2,10 @@ ARG TAGNAME="tmp" FROM cache:${TAGNAME} +# Build arg that sets environment; sets to "dev" if no build arg is given +ARG env=dev +ENV ENV=${env} + USER root # HTCondor install @@ -14,7 +18,7 @@ RUN sudo apt install -y htcondor # HTCondor setup # Copy over HTCondor submit node config -COPY ./config/htcondor/submit/99-workspaces-submit.dev.conf /etc/condor/config.d/99-workspaces-submit.dev.conf +COPY ./config/htcondor/submit/99-workspaces-submit.${ENV}.conf /etc/condor/config.d/99-workspaces-submit.${ENV}.conf # Change working directory to /code WORKDIR /code @@ -34,10 +38,9 @@ ENV PATH "${PATH}:/home/vlapipe/.local/bin" RUN python setup.py develop --user -# Set Capo -ARG capo_env=dsoc-dev -ENV CAPO_PROFILE $capo_env -ENV PATH $PATH:/lustre/aoc/pipeline/$CAPO_PROFILE/workflow +# Set Capo for build stage +# Gets reset to proper environment's profile in the deploy stage +ENV CAPO_PROFILE docker USER root