Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-4715] cleanup Docker and update documentation #3328

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -69,31 +59,3 @@ nx test <project> -- --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)
7 changes: 0 additions & 7 deletions docker/build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions docker/run-content-ce.sh

This file was deleted.

22 changes: 6 additions & 16 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions docs/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
48 changes: 48 additions & 0 deletions docs/getting-started/docker.md
Original file line number Diff line number Diff line change
@@ -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`.
40 changes: 40 additions & 0 deletions docs/getting-started/using-local-adf.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions docs/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down