From b192c5f6bbc49a9d6306a239f8da403659d69000 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 11 Jul 2023 12:25:55 +0100 Subject: [PATCH] [ACA-4715] cleanup Docker and update documentation (#3328) * move ADF linking to the dev docs * add basic Docker docs * reduce docker params * update docker docs --- Dockerfile | 8 ++- README.md | 38 -------------- docker/build.sh | 7 --- docker/run-content-ce.sh | 11 ---- docker/run.sh | 22 +++----- docs/getting-started/README.md | 2 + docs/getting-started/docker.md | 48 ++++++++++++++++++ docs/getting-started/using-local-adf.md | 40 +++++++++++++++ .../images}/link-adf-travis-console.png | Bin .../images}/link-adf-travis-stage.png | Bin docs/toc.md | 2 + 11 files changed, 101 insertions(+), 77 deletions(-) delete mode 100755 docker/build.sh delete mode 100755 docker/run-content-ce.sh create mode 100644 docs/getting-started/docker.md create mode 100644 docs/getting-started/using-local-adf.md rename {assets => docs/images}/link-adf-travis-console.png (100%) rename {assets => docs/images}/link-adf-travis-stage.png (100%) diff --git a/Dockerfile b/Dockerfile index 63d033de38..5445f2746d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,13 +16,11 @@ USER root RUN apk update && apk upgrade USER 101 -ARG PROJECT_NAME - COPY docker/default.conf.template /etc/nginx/templates/ -COPY dist/$PROJECT_NAME /usr/share/nginx/html/ -COPY dist/$PROJECT_NAME/app.config.json /etc/nginx/templates/app.config.json.template -COPY dist/$PROJECT_NAME/assets/app.extensions.json /etc/nginx/templates/app.extensions.json.template +COPY dist/content-ce /usr/share/nginx/html/ +COPY dist/content-ce/app.config.json /etc/nginx/templates/app.config.json.template +COPY dist/content-ce/assets/app.extensions.json /etc/nginx/templates/app.extensions.json.template COPY --from=builder /usr/src/alfresco/licenses /usr/share/nginx/html/ USER root diff --git a/README.md b/README.md index 92ffaeab0f..83cf43640a 100644 --- a/README.md +++ b/README.md @@ -37,16 +37,6 @@ npm install npm start ``` -### Using Local ADF - -Clone the `alfresco-ng2-components` and `alfresco-content-app` repositories in the same folder, and run the following command: - -```sh -npm start -- --configuration=adf -``` - -Changing the ADF code results in the recompilation and hot-reloading of the ACA application. - ## Unit Tests Use following command to test the projects: @@ -69,31 +59,3 @@ nx test -- --watch Upon changing unit tests code, you can track the coverage results either in the console output, or by reloading the HTML report in the browser. -## Triggering the build to use specific branch of ADF with CI flags - -You can create commits with the intention of running the build pipeline using a specific branch of ADF. To achieve this, you need to add a specific CI flag in your commit message: - -```text -[link-adf:my-custom-branch-in-adf-repo] -``` - -So for example a commit message can be like: - -```text -[link-adf:my-custom-branch-in-adf-repo] Adding XYZ features for the navigation header -``` - -When having this CI flag present in the commit message, the CI attempts to check out the given branch of ADF and use it when building / testing the applications. - -### Important things to consider - -- **This flag can only be used for PRs, not for any other type of builds** -- At the end of a PR build, there is a check which will make the build fail if you used this CI flag. This is there to make sure, only those PRs can be merged, which are using already merged in ADF features, **since this flag's only purpose is to be able to test whether the applications could be built with an experimental ADF feature or not**. - - This step is rendered in the `Finalize` stage - - ![travis stage](./assets/link-adf-travis-stage.png) - - with an error message - - ![travis stage](./assets/link-adf-travis-console.png) diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100755 index ee225e8239..0000000000 --- a/docker/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo building $1 -npm clean-install -npm run build.release $* diff --git a/docker/run-content-ce.sh b/docker/run-content-ce.sh deleted file mode 100755 index 8498486cd8..0000000000 --- a/docker/run-content-ce.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e - -[[ "$BUILD_ENABLED" == "true" ]] && $(dirname $0)/build.sh - -env \ - PROJECT_NAME=content-ce \ - BASE_PATH=${BASE_PATH:-/workspace} \ - DOCKER_IMAGE_REPO=alfresco/alfresco-content-app \ - $(dirname $0)/run.sh diff --git a/docker/run.sh b/docker/run.sh index 0f4de1c542..49429bfdc4 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -1,21 +1,11 @@ #!/usr/bin/env bash -set -e - -eval ALL_ARGUMENTS=("BASE_PATH" -) -ALL_ARGUMENTS_LENGTH=${#ALL_ARGUMENTS[@]} -DOCKER_ARGS="" -for (( j=0; j<${ALL_ARGUMENTS_LENGTH}; j++ )); do - ARG="${ALL_ARGUMENTS[$j]}" - if [ -v "${ARG}" ]; then - DOCKER_ARGS="$DOCKER_ARGS --env $ARG=${!ARG}" - fi -done - +DOCKER_IMAGE_REPO=alfresco/alfresco-content-app HOST_PORT=8081 CONTAINER_PORT=8080 + docker rmi -f $DOCKER_IMAGE_REPO -docker build --build-arg PROJECT_NAME=$PROJECT_NAME -t $DOCKER_IMAGE_REPO . -echo "http://localhost:${HOST_PORT}${BASE_PATH}" -docker run --rm -it $DOCKER_ARGS --user 1000:1000 --publish $HOST_PORT:$CONTAINER_PORT $DOCKER_IMAGE_REPO +docker build -t $DOCKER_IMAGE_REPO . + +echo "http://localhost:${HOST_PORT}" +docker run --rm -it --user 1000:1000 --publish $HOST_PORT:$CONTAINER_PORT $DOCKER_IMAGE_REPO diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md index 0abb837299..52cab59115 100644 --- a/docs/getting-started/README.md +++ b/docs/getting-started/README.md @@ -16,3 +16,5 @@ Learn how to start developing with the Alfresco Content Application. - [CORS](/getting-started/cors) - [Single Sign-On](/getting-started/sso) - [Navigation](/getting-started/navigation) +- [Using local ADF](/getting-started/using-local-adf) +- [Docker Support](/getting-started/docker) diff --git a/docs/getting-started/docker.md b/docs/getting-started/docker.md new file mode 100644 index 0000000000..2fc42643c6 --- /dev/null +++ b/docs/getting-started/docker.md @@ -0,0 +1,48 @@ +# Docker Support + +Running local build with Docker + +```shell +npm run build +``` + +The application is already preconfigured to run alongside backend containers within the Docker Compose. + +If you need to provide custom settings, update `dist/content-ce/app.config.json` file. +See [Configuration](/configuration/) section for more details + +Build and run the container: + +```shell +./docker/run.sh +``` + +The application is configured to run at `http://localhost:8081`. + +## Containerized Deployment + +Typically, you do not need changing application configuration when running ACA in the containerized deployment scenario. +All defaults are already preconfigured and pointing to the locally running Nginx proxy. + +Please refer to [ACS Deployment](https://github.com/Alfresco/acs-deployment) +and [ACS Docker Compose](https://github.com/Alfresco/acs-deployment/tree/master/docs/docker-compose) for more details. + +## Building manually + +Update `dist/content-ce/app.config.json` if needed. + +```shell +# cleanup previous +docker rmi -f alfresco/alfresco-content-app + +# build +docker build -t alfresco/alfresco-content-app . +``` + +You can now run this locally: + +```shell +docker run --rm -it --user 1000:1000 --publish 8081:8080 alfresco/alfresco-content-app +``` + +Navigate to `http://localhost:8081`. diff --git a/docs/getting-started/using-local-adf.md b/docs/getting-started/using-local-adf.md new file mode 100644 index 0000000000..4f244e3d41 --- /dev/null +++ b/docs/getting-started/using-local-adf.md @@ -0,0 +1,40 @@ +# Using Local ADF + +If you are working with ADF source code and want to use the modified version with the ACA. + +Clone the `alfresco-ng2-components` and `alfresco-content-app` repositories in the same folder, and run the following command: + +```sh +npm start -- --configuration=adf +``` + +Changing the ADF code results in the recompilation and hot-reloading of the ACA application. + +## Triggering the build to use specific branch of ADF with CI flags + +You can create commits with the intention of running the build pipeline using a specific branch of ADF. To achieve this, you need to add a specific CI flag in your commit message: + +```text +[link-adf:my-custom-branch-in-adf-repo] +``` + +So for example a commit message can be like: + +```text +[link-adf:my-custom-branch-in-adf-repo] Adding XYZ features for the navigation header +``` + +When having this CI flag present in the commit message, the CI attempts to check out the given branch of ADF and use it when building / testing the applications. + +### Important things to consider + +- **This flag can only be used for PRs, not for any other type of builds** +- At the end of a PR build, there is a check which will make the build fail if you used this CI flag. This is there to make sure, only those PRs can be merged, which are using already merged in ADF features, **since this flag's only purpose is to be able to test whether the applications could be built with an experimental ADF feature or not**. + + This step is rendered in the `Finalize` stage + + ![travis stage](../images/link-adf-travis-stage.png) + + with an error message + + ![travis stage](../images/link-adf-travis-console.png) diff --git a/assets/link-adf-travis-console.png b/docs/images/link-adf-travis-console.png similarity index 100% rename from assets/link-adf-travis-console.png rename to docs/images/link-adf-travis-console.png diff --git a/assets/link-adf-travis-stage.png b/docs/images/link-adf-travis-stage.png similarity index 100% rename from assets/link-adf-travis-stage.png rename to docs/images/link-adf-travis-stage.png diff --git a/docs/toc.md b/docs/toc.md index 013afb6c6b..826b5dc509 100644 --- a/docs/toc.md +++ b/docs/toc.md @@ -17,6 +17,8 @@ - [CORS](/getting-started/cors) - [Configuration](/configuration/) - [Navigation](/getting-started/navigation) + - [Local ADF](/getting-started/using-local-adf) + - [Docker Support](/getting-started/docker) - [Extending](/extending/) - [Extensibility features](/extending/extensibility-features) - [Extension format](/extending/extension-format)