Skip to content

Commit

Permalink
Merge branch 'develop' into feature/improve_build_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ke4 authored Dec 18, 2023
2 parents 714a212 + f0e1e8a commit dfa3117
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,15 @@ The sceond step is simply:
```

The script `build-and-deploy-webapp.sh` puts it altogether and will eventually launch a Tomcat container with a running
dev instance of Single Cell Expression Atlas.
dev instance of Single Cell Expression Atlas. The script before launching the web application can build only the back-end or front-end component or both.

Here is the usage of this script:

- -f Use this flag if you would like to build the front-end javascript packages.
- -b Use this flag if you would like to build the back-end of the web application.
- -h Displaying the help file of this script.

If you don't give any flags, or you add both then the script is going to build both front and back-end part of the web application.

### Gradle shell
It
Expand Down
46 changes: 45 additions & 1 deletion build-and-deploy-webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,57 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ENV_FILE=${SCRIPT_DIR}/docker/dev.env
source ${ENV_FILE}

function show_usage {
echo "Usage: build-and-deploy-webapp.sh [OPTION]..."
echo "It is building and deploying our web application."
echo ""
echo "All options are disabled if omitted."
echo -e "-f\tUse this flag if you would like to build the front-end javascript packages."
echo -e "-b\tUse this flag if you would like to build the back-end of the web application."
echo -e "-h\tDisplaying this help file."
echo -e "\nIf you don't give any flags or you add both then the script is going to build both front and back-end part of the web application."
}

function get_build_type() {
if [[ $BUILD_FRONTEND == "true" && $BUILD_BACKEND != "true" ]]; then
echo "-ui-only"
elif [[ $BUILD_FRONTEND != "true" && $BUILD_BACKEND == "true" ]]; then
echo "-war-only"
elif [[ $BUILD_FRONTEND == "true" && $BUILD_BACKEND == "true" ]] || [[ -z $BUILD_FRONTEND && -z $BUILD_BACKEND ]]; then
echo "-all"
fi
}

while getopts ":fbh" opt; do
case $opt in
f)
BUILD_FRONTEND=true
;;
b)
BUILD_BACKEND=true
;;
h)
show_usage
exit 1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo ""
show_usage
exit 1
;;
esac
done

BUILD_POSTFIX=$(get_build_type)

DOCKER_COMPOSE_COMMAND="docker compose \
--project-name ${PROJECT_NAME} \
--env-file=${ENV_FILE} \
-f ./docker/docker-compose-solrcloud.yml \
-f ./docker/docker-compose-postgres.yml \
-f ./docker/docker-compose-tomcat.yml \
-f ./docker/docker-compose-build.yml"
-f ./docker/docker-compose-build${BUILD_POSTFIX}.yml"

DOCKER_COMPOSE_COMMAND_VARS="SCHEMA_VERSION=latest"

Expand Down
File renamed without changes.
42 changes: 42 additions & 0 deletions docker/docker-compose-build-ui-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "3.6"

services:
node-webpack:
image: node:16
volumes:
- ..:/root/project
working_dir: /root/project
command: ["sh", "-c", "export CPPFLAGS=-DPNG_ARM_NEON_OPT=0 && npm install -g npm-check-updates && ./compile-front-end-packages.sh -ui" ]

gradle-build:
depends_on:
node-webpack:
condition: service_completed_successfully
extends:
service: gradle
file: docker-compose-gradle.yml

gradle-shell:
extends:
service: gradle
file: docker-compose-gradle.yml
tty: true
stdin_open: true
command: [ "sh", "-c", "gradle && /bin/bash" ]
depends_on:
gradle-build:
condition: service_completed_successfully

tomcat:
extends:
service: tomcat
file: docker-compose-tomcat.yml
depends_on:
gradle-build:
condition: service_completed_successfully
postgres:
condition: service_started
solrcloud-0:
condition: service_started
solrcloud-1:
condition: service_started
33 changes: 33 additions & 0 deletions docker/docker-compose-build-war-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.6"

services:
gradle-build:
extends:
service: gradle
file: docker-compose-gradle.yml
command: ["sh", "-c", "gradle clean :app:war"]

gradle-shell:
extends:
service: gradle
file: docker-compose-gradle.yml
tty: true
stdin_open: true
command: [ "sh", "-c", "gradle && /bin/bash" ]
depends_on:
gradle-build:
condition: service_completed_successfully

tomcat:
extends:
service: tomcat
file: docker-compose-tomcat.yml
depends_on:
gradle-build:
condition: service_completed_successfully
postgres:
condition: service_started
solrcloud-0:
condition: service_started
solrcloud-1:
condition: service_started

0 comments on commit dfa3117

Please sign in to comment.