mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-08-21 18:09:29 +00:00
REPO-5711 Fix repository to Search services comms
The Search Services is now using anew default "secret" communication method. The changes also have updates to the latest Search Services version (2.0.3)
This commit is contained in:
@@ -21,6 +21,8 @@ services:
|
||||
environment:
|
||||
JAVA_TOOL_OPTIONS: "${symbol_dollar}{keystore.settings}"
|
||||
JAVA_OPTS: "
|
||||
-Dsolr.secureComms=secret
|
||||
-Dsolr.sharedSecret=secret
|
||||
-Dmessaging.broker.url=\"failover:(nio://${rootArtifactId}-activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
"
|
||||
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888"
|
||||
@@ -43,13 +45,15 @@ services:
|
||||
volumes:
|
||||
- ${rootArtifactId}-db-volume:/var/lib/postgresql/data
|
||||
${rootArtifactId}-ass:
|
||||
image: alfresco/alfresco-search-services:1.2.0
|
||||
image: alfresco/alfresco-search-services:2.0.3
|
||||
environment:
|
||||
SOLR_ALFRESCO_HOST: ${rootArtifactId}-acs
|
||||
SOLR_ALFRESCO_PORT: 8080
|
||||
SOLR_SOLR_HOST: ${rootArtifactId}-ass
|
||||
SOLR_SOLR_PORT: 8983
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
|
||||
ALFRESCO_SECURE_COMMS: "secret"
|
||||
JAVA_TOOL_OPTIONS: "-Dalfresco.secureComms.secret=secret"
|
||||
ports:
|
||||
- "8983:8983"
|
||||
volumes:
|
||||
|
@@ -17,6 +17,8 @@ services:
|
||||
environment:
|
||||
JAVA_TOOL_OPTIONS: "${symbol_dollar}{keystore.settings}"
|
||||
JAVA_OPTS: "
|
||||
-Dsolr.secureComms=secret
|
||||
-Dsolr.sharedSecret=secret
|
||||
-Dmessaging.broker.url=\"failover:(nio://${rootArtifactId}-activemq:61616)?timeout=3000&jms.useCompression=true\"
|
||||
"
|
||||
CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8888"
|
||||
@@ -39,13 +41,15 @@ services:
|
||||
volumes:
|
||||
- ${rootArtifactId}-db-volume:/var/lib/postgresql/data
|
||||
${rootArtifactId}-ass:
|
||||
image: alfresco/alfresco-search-services:1.2.0
|
||||
image: alfresco/alfresco-search-services:2.0.3
|
||||
environment:
|
||||
SOLR_ALFRESCO_HOST: ${rootArtifactId}-acs
|
||||
SOLR_ALFRESCO_PORT: 8080
|
||||
SOLR_SOLR_HOST: ${rootArtifactId}-ass
|
||||
SOLR_SOLR_PORT: 8983
|
||||
SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
|
||||
ALFRESCO_SECURE_COMMS: "secret"
|
||||
JAVA_TOOL_OPTIONS: "-Dalfresco.secureComms.secret=secret"
|
||||
ports:
|
||||
- "8983:8983"
|
||||
volumes:
|
||||
|
@@ -24,7 +24,8 @@ services:
|
||||
# -Ddb.url=jdbc:postgresql://${rootArtifactId}-postgres:5432/alfresco
|
||||
# -Dsolr.host=${rootArtifactId}-ass
|
||||
# -Dsolr.port=8983
|
||||
# -Dsolr.secureComms=none
|
||||
# -Dsolr.secureComms=secret
|
||||
# -Dsolr.sharedSecret=secret
|
||||
# -Dsolr.base.url=/solr
|
||||
# -Dindex.subsystem.name=solr6
|
||||
# -Dcsrf.filter.enabled=false
|
||||
@@ -52,13 +53,15 @@ services:
|
||||
# volumes:
|
||||
# - ${rootArtifactId}-db-volume:/var/lib/postgresql/data
|
||||
# ${rootArtifactId}-ass:
|
||||
# image: alfresco/alfresco-search-services:1.2.0
|
||||
# image: alfresco/alfresco-search-services:2.0.3
|
||||
# environment:
|
||||
# SOLR_ALFRESCO_HOST: ${rootArtifactId}-acs
|
||||
# SOLR_ALFRESCO_PORT: 8080
|
||||
# SOLR_SOLR_HOST: ${rootArtifactId}-ass
|
||||
# SOLR_SOLR_PORT: 8983
|
||||
# SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive
|
||||
# ALFRESCO_SECURE_COMMS: "secret"
|
||||
# JAVA_TOOL_OPTIONS: "-Dalfresco.secureComms.secret=secret"
|
||||
# ports:
|
||||
# - "8983:8983"
|
||||
# volumes:
|
||||
|
@@ -6,10 +6,10 @@ Last reviewed: 2021-02-09
|
||||
|
||||
# Working with an All-In-One project
|
||||
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate an All-In-One (AIO) project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-allinone-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate an All-In-One (AIO) project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-allinone-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
the AIO project was generated with the name `my-all-in-one-project`.
|
||||
|
||||
- [Introduction](#introduction)
|
||||
@@ -21,23 +21,23 @@ the AIO project was generated with the name `my-all-in-one-project`.
|
||||
- [Stopping the project](#stopping-the-project)
|
||||
|
||||
## Introduction
|
||||
An AIO SDK project is used to build extensions for both [Alfresco Content Services (ACS) Repository](https://docs.alfresco.com/6.2/concepts/dev-platform-extensions.html)
|
||||
An AIO SDK project is used to build extensions for both [Alfresco Content Services (ACS) Repository](https://docs.alfresco.com/6.2/concepts/dev-platform-extensions.html)
|
||||
and [Alfresco Share UI](https://docs.alfresco.com/6.2/concepts/dev-extensions-share.html). The runtime environment
|
||||
for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker images for the Alfresco Repository and Alfresco Share. The custom Docker images includes the
|
||||
JARs, or AMPs, with your extension code.
|
||||
for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker images for the Alfresco Repository and Alfresco Share. The custom Docker images includes the
|
||||
JARs, or AMPs, with your extension code.
|
||||
|
||||
Looking into the generated AIO parent project we can see that we got a Docker Compose file (**my-all-in-one-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project, one sub-project called `my-all-in-one-project-platform` that will be
|
||||
Looking into the generated AIO parent project we can see that we got a Docker Compose file (**my-all-in-one-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project, one sub-project called `my-all-in-one-project-platform` that will be
|
||||
used to build Repository customizations, and one sub-project called `my-all-in-one-project-share` that can be used to build Alfresco Share UI customizations.
|
||||
|
||||
There are also the `my-all-in-one-project-platform-docker` and `my-all-in-one-project-share-docker` projects that are
|
||||
used to assemble (aggregate) all the Repository and Share extensions
|
||||
(there are usually more than one of each in a bigger project) and then build the custom Docker images with the
|
||||
There are also the `my-all-in-one-project-platform-docker` and `my-all-in-one-project-share-docker` projects that are
|
||||
used to assemble (aggregate) all the Repository and Share extensions
|
||||
(there are usually more than one of each in a bigger project) and then build the custom Docker images with the
|
||||
extension(s) applied.
|
||||
|
||||
The Repository and Share extensions that are aggregated can either be extensions that you develop locally or extensions
|
||||
that are available in a Maven repository somewhere.
|
||||
The Repository and Share extensions that are aggregated can either be extensions that you develop locally or extensions
|
||||
that are available in a Maven repository somewhere.
|
||||
|
||||
## Configuration properties
|
||||
There are a number of properties that we can customise when we run the Alfresco SDK project.
|
||||
@@ -62,12 +62,12 @@ When you first start out you don't need to change any of these properties, just
|
||||
|
||||
## Building and running the project
|
||||
The first thing you need to do before you can run anything is to build the custom ACS Docker images with the custom extensions.
|
||||
We can build images and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
We can build images and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
(on Windows use the `run.bat build_start` script instead).
|
||||
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
following ports are free: 8180 (Share), 8080 (Alfresco Repo), 9898 (Share Debug), 8888 (Alfresco Repo Debug), 5555 (Postgres).
|
||||
If you want to change the ports see the properties section of **my-all-in-one-project/pom.xml**. This project file also
|
||||
If you want to change the ports see the properties section of **my-all-in-one-project/pom.xml**. This project file also
|
||||
contains the versions of Alfresco Repository and Alfresco Share that will be used.
|
||||
|
||||
```
|
||||
@@ -77,7 +77,7 @@ my-all-in-one-project mbergljung$ ./run.sh build_start
|
||||
[WARNING] The project com.example:my-all-in-one-project:pom:1.0-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Reactor Build Order:
|
||||
[INFO]
|
||||
[INFO]
|
||||
[INFO] AIO - SDK 4.4
|
||||
[INFO] Alfresco Platform/Repository JAR Module
|
||||
[INFO] Alfresco Share JAR Module
|
||||
@@ -87,7 +87,7 @@ my-all-in-one-project mbergljung$ ./run.sh build_start
|
||||
...
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Reactor Summary:
|
||||
[INFO]
|
||||
[INFO]
|
||||
[INFO] AIO - SDK 4.4 ...................................... SUCCESS [ 0.680 s]
|
||||
[INFO] Alfresco Platform/Repository JAR Module ............ SUCCESS [ 5.461 s]
|
||||
[INFO] Alfresco Share JAR Module .......................... SUCCESS [ 0.557 s]
|
||||
@@ -114,11 +114,11 @@ Successfully tagged alfresco-content-services-my-all-in-one-project:development
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 06:53:39.191 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 06:53:39.233 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 06:53:39.249 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 84022 ms
|
||||
```
|
||||
```
|
||||
|
||||
The `./run.sh build_start` script will do the following:
|
||||
|
||||
* Stop anything running already with this project's Docker Compose file: **my-all-in-one-project/docker/docker-compose.yml**
|
||||
* Stop anything running already with this project's Docker Compose file: **my-all-in-one-project/docker/docker-compose.yml**
|
||||
* Build the Repository and Share Extension JARs so we are sure to get the latest changes
|
||||
* Assemble/Aggregate all Repository extension JARs into the **my-all-in-one-project/my-all-in-one-project-platform-docker/target/extensions** directory
|
||||
* Assemble/Aggregate all Share extension JARs into the **my-all-in-one-project/my-all-in-one-project-share-docker/target/extensions** directory
|
||||
@@ -128,12 +128,12 @@ The `./run.sh build_start` script will do the following:
|
||||
|
||||
This will build the following two Docker images:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker image ls|more
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
alfresco-content-services-my-all-in-one-project development 48e61e882567 16 hours ago 2.07GB
|
||||
alfresco-share-my-all-in-one-project development d6cbb6143578 16 hours ago 749MB
|
||||
```
|
||||
```
|
||||
|
||||
The different web applications should now be accessible:
|
||||
|
||||
@@ -141,49 +141,49 @@ The different web applications should now be accessible:
|
||||
* **ACS Share**: http://localhost:8180/share/ - login with admin/admin
|
||||
|
||||
## Trying out the sample code
|
||||
The AIO project has some sample extension code that you can try out. There is a one Repository extension and one Share extension
|
||||
The AIO project has some sample extension code that you can try out. There is a one Repository extension and one Share extension
|
||||
that you can test to make sure the extension JARs have been applied properly.
|
||||
|
||||
The Repository extension is a Web Script that can be called with the following URL: `http://localhost:8080/alfresco/service/sample/helloworld`.
|
||||
The source code for the Web Script is located here: **my-all-in-one-project/my-all-in-one-project-platform/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials**
|
||||
The source code for the Web Script is located here: **my-all-in-one-project/my-all-in-one-project-platform/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials**
|
||||
and here: **my-all-in-one-project/my-all-in-one-project-platform/src/main/java/ com/example/platformsample/HelloWorldWebScript.java**.
|
||||
|
||||
The Share extension is a custom Aikau page with a custom widget, you reach it with the following URL: `http://localhost:8180/share/page/hdp/ws/simple-page`.
|
||||
The source code for the Page and Widget is located here: **my-all-in-one-project/my-all-in-one-project-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages**
|
||||
The source code for the Page and Widget is located here: **my-all-in-one-project/my-all-in-one-project-share/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages**
|
||||
and here: **my-all-in-one-project/my-all-in-one-project-share/src/main/resources/META-INF/resources/my-all-in-one-project-share/js/tutorials/widgets**.
|
||||
|
||||
|
||||
## Looking inside the containers
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Repository container and list the custom Repository extension JARs that have been deployed?
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Repository container and list the custom Repository extension JARs that have been deployed?
|
||||
|
||||
You can do that as follows:
|
||||
|
||||
First **Ctrl-C** out of the log tailing:
|
||||
```
|
||||
```
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 07:26:23.893 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 07:26:23.914 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
|
||||
my-all-in-one-project-acs_1 | 27-Mar-2019 07:26:23.940 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 83197 ms
|
||||
my-all-in-one-project-acs_1 | 2019-03-27 07:26:24,304 INFO [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-3] Starting 'Search' subsystem, ID: [Search, managed, solr6]
|
||||
my-all-in-one-project-acs_1 | 2019-03-27 07:26:25,555 INFO [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-3] Startup of 'Search' subsystem, ID: [Search, managed, solr6] complete
|
||||
^CERROR: Aborting.
|
||||
my-all-in-one-project mbergljung$
|
||||
```
|
||||
my-all-in-one-project mbergljung$
|
||||
```
|
||||
|
||||
Then check the name of the ACS Repository container:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
733867a70117 alfresco-content-services-my-all-in-one-project:development "catalina.sh run -se…" 5 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:8888->8888/tcp docker_my-all-in-one-project-acs_1
|
||||
1f197e52b4f2 alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 5 minutes ago Up 5 minutes 0.0.0.0:8983->8983/tcp docker_my-all-in-one-project-ass_1
|
||||
1f197e52b4f2 alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 5 minutes ago Up 5 minutes 0.0.0.0:8983->8983/tcp docker_my-all-in-one-project-ass_1
|
||||
4eff0cc9cc25 alfresco-share-my-all-in-one-project:development "/usr/local/tomcat/s…" 5 minutes ago Up 5 minutes 8000/tcp, 0.0.0.0:8180->8080/tcp, 0.0.0.0:9898->8888/tcp docker_my-all-in-one-project-share_1
|
||||
a7854ff16d72 postgres:9.6 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:5555->5432/tcp docker_my-all-in-one-project-postgres_1
|
||||
```
|
||||
```
|
||||
|
||||
Then open up a shell into the ACS Repository container:
|
||||
|
||||
```
|
||||
```
|
||||
my-all-in-one-project mbergljung$ docker exec -it docker_my-all-in-one-project-acs_1 /bin/bash
|
||||
[root@733867a70117 tomcat]# pwd
|
||||
/usr/local/tomcat
|
||||
@@ -191,55 +191,55 @@ my-all-in-one-project mbergljung$ docker exec -it docker_my-all-in-one-project-a
|
||||
-rw-r--r-- 1 root root 17220 Mar 27 07:24 my-all-in-one-project-platform-1.0-SNAPSHOT.jar
|
||||
[root@733867a70117 tomcat]# exit
|
||||
exit
|
||||
```
|
||||
```
|
||||
|
||||
## Updating extension code
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Repository Web Script
|
||||
to return a different message. Open up the **my-all-in-one-project/my-all-in-one-project-platform/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials/helloworld.get.html.ftl**
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Repository Web Script
|
||||
to return a different message. Open up the **my-all-in-one-project/my-all-in-one-project-platform/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials/helloworld.get.html.ftl**
|
||||
file and change it to look as follows:
|
||||
|
||||
```
|
||||
```
|
||||
Message: '${fromJS}' '${fromJava}' UPDATED!
|
||||
```
|
||||
```
|
||||
|
||||
To get this code update deployed we just have to run the following command in another console then where we are tailing the logs,
|
||||
and stand in the directory where the `run.sh` script is located:
|
||||
|
||||
```
|
||||
```
|
||||
my-all-in-one-project mbergljung$ ./run.sh reload_acs
|
||||
```
|
||||
```
|
||||
|
||||
What this will do is the following:
|
||||
|
||||
* Kill the `my-all-in-one-project-acs` container
|
||||
* Kill the `my-all-in-one-project-acs` container
|
||||
* Remove the killed (stopped) `my-all-in-one-project-acs` container, so a new Docker image can be created with `development` tag
|
||||
* Build the Repository extension JAR: **my-all-in-one-project/my-all-in-one-project-platform**
|
||||
* Build the Repository extension JAR: **my-all-in-one-project/my-all-in-one-project-platform**
|
||||
* Copy the newly built Repository extension JAR over to the **my-all-in-one-project/my-all-in-one-project-platform-docker/target/extensions** where it will be picked up when the new Docker image is built.
|
||||
* Build a new `alfresco-content-services-my-all-in-one-project:development` image
|
||||
* Start up the `my-all-in-one-project-acs` container based on new image
|
||||
|
||||
You will be left with the console tailing the logs, but you can **Ctrl-C** out of this as you are already tailing the logs
|
||||
You will be left with the console tailing the logs, but you can **Ctrl-C** out of this as you are already tailing the logs
|
||||
in the initial console where we started things up.
|
||||
|
||||
You can now check if the change took effect by accessing the `http://localhost:8080/alfresco/service/sample/helloworld` Web Script.
|
||||
|
||||
|
||||
## Stopping the project
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
as they run in daemon mode in the background. Check this by executing the following command that lists running containers:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
49015432f1b2 alfresco-content-services-my-all-in-one-project:development "catalina.sh run -se…" 20 minutes ago Up 20 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:8888->8888/tcp docker_my-all-in-one-project-acs_1
|
||||
edb9ea129a5d postgres:9.6 "docker-entrypoint.s…" 20 minutes ago Up 20 minutes 0.0.0.0:5555->5432/tcp docker_my-all-in-one-project-postgres_1
|
||||
6992d183986f alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 20 minutes ago Up 20 minutes 0.0.0.0:8983->8983/tcp docker_my-all-in-one-project-ass_1
|
||||
6992d183986f alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 20 minutes ago Up 20 minutes 0.0.0.0:8983->8983/tcp docker_my-all-in-one-project-ass_1
|
||||
107d00733efd alfresco-share-my-all-in-one-project:development "/usr/local/tomcat/s…" 20 minutes ago Up 20 minutes 8000/tcp, 0.0.0.0:8180->8080/tcp, 0.0.0.0:9898->8888/tcp docker_my-all-in-one-project-share_1
|
||||
```
|
||||
```
|
||||
|
||||
Now, standing in the directory where the `run.sh` script is located execute the following command to stop and remove the containers:
|
||||
|
||||
```
|
||||
```
|
||||
my-all-in-one-project mbergljung$ ./run.sh stop
|
||||
Stopping docker_my-all-in-one-project-acs_1 ... done
|
||||
Stopping docker_my-all-in-one-project-postgres_1 ... done
|
||||
@@ -250,7 +250,4 @@ Removing docker_my-all-in-one-project-postgres_1 ... done
|
||||
Removing docker_my-all-in-one-project-ass_1 ... done
|
||||
Removing docker_my-all-in-one-project-share_1 ... done
|
||||
Removing network docker_default
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
@@ -6,10 +6,10 @@ Last reviewed: 2021-02-09
|
||||
|
||||
# Working with a Platform (Repository) project
|
||||
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate a Platform project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-platform-jar-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate a Platform project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-platform-jar-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
the Platform project was generated with the name `my-platform-project`.
|
||||
|
||||
- [Introduction](#introduction)
|
||||
@@ -21,13 +21,13 @@ the Platform project was generated with the name `my-platform-project`.
|
||||
- [Stopping the project](#stopping-the-project)
|
||||
|
||||
## Introduction
|
||||
A Platform project is used to build extensions for the [Alfresco Content Services (ACS) Repository](https://docs.alfresco.com/6.2/concepts/dev-platform-extensions.html).
|
||||
The runtime environment for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker image for the Alfresco Repository. The custom Docker images includes the JARs, or AMPs, with your extension code.
|
||||
A Platform project is used to build extensions for the [Alfresco Content Services (ACS) Repository](https://docs.alfresco.com/6.2/concepts/dev-platform-extensions.html).
|
||||
The runtime environment for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker image for the Alfresco Repository. The custom Docker images includes the JARs, or AMPs, with your extension code.
|
||||
|
||||
Looking into the generated Platform project we can see that we got a Docker Compose file (**my-platform-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project. We also got a directory for our extension source code:
|
||||
**my-platform-project/src/main/java** and one directory with the Docker related stuff, such as the **Dockerfile** used to
|
||||
Looking into the generated Platform project we can see that we got a Docker Compose file (**my-platform-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project. We also got a directory for our extension source code:
|
||||
**my-platform-project/src/main/java** and one directory with the Docker related stuff, such as the **Dockerfile** used to
|
||||
build the custom ACS Repository Docker image: **my-platform-project/src/main/docker**.
|
||||
|
||||
## Configuration properties
|
||||
@@ -49,27 +49,27 @@ The following table explains some of these properties:
|
||||
| acs.debug.port | `number` | 8888 | The external port (i.e. outside container) for ACS Repository remote debugging.|
|
||||
| postgres.port | `number` | 5555 | The external port (i.e. outside container) for PostgreSQL database.|
|
||||
|
||||
There are some Alfresco Share related properties listed here, but they are not used unless you uncomment some code in the
|
||||
There are some Alfresco Share related properties listed here, but they are not used unless you uncomment some code in the
|
||||
Docker Compose file (**my-platform-project/docker/docker-compose.yml**) to run the Alfresco Share container.
|
||||
|
||||
When you first start out you don't need to change any of these properties, just use the defaults and try it out.
|
||||
|
||||
## Building and running the project
|
||||
The first thing you need to do before you can run anything is to build the custom ACS Repository Docker image with the custom extensions.
|
||||
We can build the image and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
We can build the image and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
(on Windows use the `run.bat build_start` script instead).
|
||||
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
following ports are free: 8180 (Share - if enabled in Docker Compose), 8080 (Alfresco Repo), 9898 (Share Debug - if enabled in Docker Compose),
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
following ports are free: 8180 (Share - if enabled in Docker Compose), 8080 (Alfresco Repo), 9898 (Share Debug - if enabled in Docker Compose),
|
||||
8888 (Alfresco Repo Debug), 5555 (Postgres).
|
||||
If you want to change the ports see the properties section of **my-platform-project/pom.xml**. This project file also
|
||||
If you want to change the ports see the properties section of **my-platform-project/pom.xml**. This project file also
|
||||
contains the versions of Alfresco Repository and Alfresco Share (if enabled) that will be used.
|
||||
|
||||
```
|
||||
$ cd my-platform-project/
|
||||
MBP512-MBERGLJUNG-0917:my-platform-project mbergljung$ ./run.sh build_start
|
||||
[INFO] Scanning for projects...
|
||||
[INFO]
|
||||
[INFO]
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Building my-platform-project Platform/Repository JAR Module 1.0-SNAPSHOT
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
@@ -95,12 +95,12 @@ Attaching to docker_my-platform-project-acs_1, docker_my-platform-project-ass_1,
|
||||
...
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.923 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.947 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.955 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 91144 ms```
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.955 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 91144 ms```
|
||||
```
|
||||
|
||||
The `./run.sh build_start` script will do the following:
|
||||
|
||||
* Stop anything running already with this project's Docker Compose file: **my-platform-project/docker/docker-compose.yml**
|
||||
* Stop anything running already with this project's Docker Compose file: **my-platform-project/docker/docker-compose.yml**
|
||||
* Build the Repository Extension JARs so we are sure to get the latest changes
|
||||
* Assemble/Aggregate all Repository extension JARs into the **my-platform-project/target/extensions** directory
|
||||
* Create Docker Volumes for Repository (alf_data), Search index, and Database so data is persisted outside the containers
|
||||
@@ -109,11 +109,11 @@ The `./run.sh build_start` script will do the following:
|
||||
|
||||
This will build the following Docker image:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker image ls|more
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
alfresco-content-services-my-platform-project development b2b9a7b730f5 5 minutes ago 2.07GB
|
||||
```
|
||||
```
|
||||
|
||||
The different web applications should now be accessible:
|
||||
|
||||
@@ -121,20 +121,20 @@ The different web applications should now be accessible:
|
||||
* And optionally (if enabled in Docker Compose file) **ACS Share**: http://localhost:8180/share/ - login with admin/admin
|
||||
|
||||
## Trying out the sample code
|
||||
The Platform project has some sample extension code that you can try out.
|
||||
The Platform project has some sample extension code that you can try out.
|
||||
|
||||
The Repository extension is a Web Script that can be called with the following URL: `http://localhost:8080/alfresco/service/sample/helloworld`.
|
||||
The source code for the Web Script is located here: **my-platform-project/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials**
|
||||
The source code for the Web Script is located here: **my-platform-project/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials**
|
||||
and here: **my-platform-project/src/main/java/ com/example/platformsample/HelloWorldWebScript.java**.
|
||||
|
||||
## Looking inside the containers
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Repository container and list the custom Repository extension JARs that have been deployed?
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Repository container and list the custom Repository extension JARs that have been deployed?
|
||||
|
||||
You can do that as follows:
|
||||
|
||||
First **Ctrl-C** out of the log tailing:
|
||||
```
|
||||
```
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.923 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.947 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
|
||||
my-platform-project-acs_1 | 27-Mar-2019 09:25:12.955 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 91144 ms
|
||||
@@ -142,21 +142,21 @@ my-platform-project-acs_1 | 2019-03-27 09:25:40,406 INFO [management.su
|
||||
my-platform-project-acs_1 | 2019-03-27 09:25:40,948 INFO [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-6] Startup of 'Transformers' subsystem, ID: [Transformers, default] complete
|
||||
^[[B^CERROR: Aborting.
|
||||
my-platform-project mbergljung$
|
||||
```
|
||||
```
|
||||
|
||||
Then check the name of the ACS Repository container:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
ba90b1648470 alfresco-content-services-my-platform-project:development "catalina.sh run -se…" 8 minutes ago Up 8 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:8888->8888/tcp docker_my-platform-project-acs_1
|
||||
0435b09e687c alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 8 minutes ago Up 8 minutes 0.0.0.0:8983->8983/tcp docker_my-platform-project-ass_1
|
||||
0435b09e687c alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 8 minutes ago Up 8 minutes 0.0.0.0:8983->8983/tcp docker_my-platform-project-ass_1
|
||||
c9145e7cdb20 postgres:9.6 "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 0.0.0.0:5555->5432/tcp docker_my-platform-project-postgres_1
|
||||
```
|
||||
```
|
||||
|
||||
Then open up a shell into the ACS Repository container:
|
||||
|
||||
```
|
||||
```
|
||||
my-platform-project mbergljung$ docker exec -it docker_my-platform-project-acs_1 /bin/bash
|
||||
[root@ba90b1648470 tomcat]# pwd
|
||||
/usr/local/tomcat
|
||||
@@ -165,17 +165,17 @@ my-platform-project mbergljung$ docker exec -it docker_my-platform-project-acs_1
|
||||
-rw-r--r-- 1 root root 13692 Mar 27 09:23 my-platform-project-1.0-SNAPSHOT-tests.jar
|
||||
[root@ba90b1648470 tomcat]# exit
|
||||
exit
|
||||
```
|
||||
```
|
||||
|
||||
## Updating extension code
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Repository Web Script
|
||||
to return a different message. Open up the **my-platform-project/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials/helloworld.get.html.ftl**
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Repository Web Script
|
||||
to return a different message. Open up the **my-platform-project/src/main/resources/alfresco/extension/templates/webscripts/alfresco/tutorials/helloworld.get.html.ftl**
|
||||
file and change it to look as follows:
|
||||
|
||||
```
|
||||
```
|
||||
Message: '${fromJS}' '${fromJava}' UPDATED!
|
||||
```
|
||||
```
|
||||
|
||||
To get this code update deployed we have to run the following commands:
|
||||
|
||||
@@ -183,7 +183,7 @@ First `Ctrl-C` out of the log tailing.
|
||||
|
||||
Then stop the project:
|
||||
|
||||
```
|
||||
```
|
||||
my-platform-project mbergljung$ ./run.sh stop
|
||||
Stopping docker_my-platform-project-acs_1 ... done
|
||||
Stopping docker_my-platform-project-ass_1 ... done
|
||||
@@ -192,18 +192,18 @@ Removing docker_my-platform-project-acs_1 ... done
|
||||
Removing docker_my-platform-project-ass_1 ... done
|
||||
Removing docker_my-platform-project-postgres_1 ... done
|
||||
Removing network docker_default
|
||||
```
|
||||
```
|
||||
|
||||
Now build and start again:
|
||||
|
||||
```
|
||||
```
|
||||
my-platform-project mbergljung$ ./run.sh build_start
|
||||
...
|
||||
```
|
||||
```
|
||||
|
||||
What this will do is the following:
|
||||
|
||||
* Kill the `my-platform-project-acs` container
|
||||
* Kill the `my-platform-project-acs` container
|
||||
* Removed the killed (stopped) `my-platform-project-acs` container, so a new Docker image can be created with `development` tag
|
||||
* Build the Repository extension JAR
|
||||
* Copy the newly built Repository extension JAR over to the **my-platform-project/target/extensions** where it will be picked up when the new Docker image is built.
|
||||
@@ -211,22 +211,22 @@ What this will do is the following:
|
||||
* Start up the `my-platform-project-acs` container based on new image
|
||||
|
||||
You can now check if the change took effect by accessing the `http://localhost:8080/alfresco/service/sample/helloworld` Web Script.
|
||||
|
||||
|
||||
## Stopping the project
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
as they run in daemon mode in the background. Check this by executing the following command that lists running containers:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
61de829092f3 alfresco-content-services-my-platform-project:development "catalina.sh run -se…" 3 minutes ago Up 3 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:8888->8888/tcp docker_my-platform-project-acs_1
|
||||
07300ddb6714 alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 3 minutes ago Up 3 minutes 0.0.0.0:8983->8983/tcp docker_my-platform-project-ass_1
|
||||
07300ddb6714 alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 3 minutes ago Up 3 minutes 0.0.0.0:8983->8983/tcp docker_my-platform-project-ass_1
|
||||
09922ce36d90 postgres:9.6 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:5555->5432/tcp docker_my-platform-project-postgres_1
|
||||
```
|
||||
```
|
||||
|
||||
Now, standing in the directory where the `run.sh` script is located execute the following command to stop and remove the containers:
|
||||
|
||||
```
|
||||
```
|
||||
my-platform-project mbergljung$ ./run.sh stop
|
||||
Stopping docker_my-platform-project-acs_1 ... done
|
||||
Stopping docker_my-platform-project-ass_1 ... done
|
||||
@@ -235,7 +235,4 @@ Removing docker_my-platform-project-acs_1 ... done
|
||||
Removing docker_my-platform-project-ass_1 ... done
|
||||
Removing docker_my-platform-project-postgres_1 ... done
|
||||
Removing network docker_default
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
@@ -6,10 +6,10 @@ Last reviewed: 2021-02-09
|
||||
|
||||
# Working with a Share project
|
||||
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate an Alfresco Share project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-share-jar-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
Before you continue make sure that you have read and completed the tasks in the
|
||||
[Getting started](../getting-started.md) tutorial to generate an Alfresco Share project,
|
||||
which means selecting the `org.alfresco.maven.archetype:alfresco-share-jar-archetype`
|
||||
Maven archetype when generating the project. The following information assumes that
|
||||
the Share project was generated with the name `my-share-project`.
|
||||
|
||||
- [Introduction](#introduction)
|
||||
@@ -21,14 +21,14 @@ the Share project was generated with the name `my-share-project`.
|
||||
- [Stopping the project](#stopping-the-project)
|
||||
|
||||
## Introduction
|
||||
An Alfresco Sharte project is used to build extensions for [Alfresco Share UI](https://docs.alfresco.com/6.2/concepts/dev-extensions-share.html).
|
||||
The runtime environment for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker image for Alfresco Share. The custom Docker images includes the
|
||||
JARs, or AMPs, with your extension code.
|
||||
An Alfresco Sharte project is used to build extensions for [Alfresco Share UI](https://docs.alfresco.com/6.2/concepts/dev-extensions-share.html).
|
||||
The runtime environment for ACS is Docker so not only is this project building the source code for your extensions but also the
|
||||
custom Docker image for Alfresco Share. The custom Docker images includes the
|
||||
JARs, or AMPs, with your extension code.
|
||||
|
||||
Looking into the generated Share project we can see that we got a Docker Compose file (**my-share-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project. We also got a directory for our extension source code:
|
||||
**my-share-project/src/main/java** and one directory with the Docker related stuff, such as the **Dockerfile** used to
|
||||
Looking into the generated Share project we can see that we got a Docker Compose file (**my-share-project/docker/docker-compose.yml**)
|
||||
that will be used to build custom Docker images and run the project. We also got a directory for our extension source code:
|
||||
**my-share-project/src/main/java** and one directory with the Docker related stuff, such as the **Dockerfile** used to
|
||||
build the custom Alfresco Share Docker image: **my-share-project/src/main/docker**.
|
||||
|
||||
## Configuration properties
|
||||
@@ -52,23 +52,23 @@ The following table explains some of these properties:
|
||||
|
||||
There are some ACS Repository related properties listed here, such as `acs.host` and `acs.port`. Alfresco Share will use those
|
||||
to connect to the Alfresco Repository. This is however a bit tricky when we are running in a container environment. You cannot
|
||||
just start the Repository and make it available on `localhost:8080`. It would not be accessible like that from inside the
|
||||
Share container. For Share to be able to connect to the Repository both containers need to be attached to the same
|
||||
just start the Repository and make it available on `localhost:8080`. It would not be accessible like that from inside the
|
||||
Share container. For Share to be able to connect to the Repository both containers need to be attached to the same
|
||||
Docker Network. This way you can just use the Docker Compose service name for the Repository, such as `my-share-project-acs`.
|
||||
So the best way to test your Share extension is to uncomment the code in the Docker Compose file
|
||||
So the best way to test your Share extension is to uncomment the code in the Docker Compose file
|
||||
(**my-share-project/docker/docker-compose.yml**) to also run the ACS Repository container, Search, and Postgres.
|
||||
|
||||
## Building and running the project
|
||||
The first thing you need to do before you can run anything is to build the custom Share Docker image with the custom extensions.
|
||||
We can build the image and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
We can build the image and extensions at the same time as we start (run) the project by using the `./run.sh build_start` script
|
||||
(on Windows use the `run.bat build_start` script instead).
|
||||
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
Note that if you have another Alfresco SDK project running, then you need to stop it first. Also, make sure that the
|
||||
following ports are free: 8180 (Share), 8080 (Alfresco Repo - if enabled in Docker Compose), 9898 (Share Debug), 8888 (Alfresco Repo Debug - if enabled), 5555 (Postgres).
|
||||
If you want to change the ports see the properties section of **my-share-project/pom.xml**. This project file also
|
||||
If you want to change the ports see the properties section of **my-share-project/pom.xml**. This project file also
|
||||
contains the versions of Alfresco Repository (if enabled) and Alfresco Share that will be used.
|
||||
|
||||
When I run the project I have uncommented the code (make sure to also remove the "# Optional" line) that starts
|
||||
When I run the project I have uncommented the code (make sure to also remove the "# Optional" line) that starts
|
||||
the Repository, Search, and PostgresSQL in the (**my-share-project/docker/docker-compose.yml**) file, so I can test the Share extension:
|
||||
|
||||
```
|
||||
@@ -97,11 +97,11 @@ Successfully tagged alfresco-share-my-share-project:development...
|
||||
my-share-project-acs_1 | 27-Mar-2019 10:09:01.158 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
|
||||
my-share-project-acs_1 | 27-Mar-2019 10:09:01.175 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
|
||||
my-share-project-acs_1 | 27-Mar-2019 10:09:01.213 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 95189 ms
|
||||
```
|
||||
```
|
||||
|
||||
The `./run.sh build_start` script will do the following:
|
||||
|
||||
* Stop anything running already with this project's Docker Compose file: **my-share-project/docker/docker-compose.yml**
|
||||
* Stop anything running already with this project's Docker Compose file: **my-share-project/docker/docker-compose.yml**
|
||||
* Build the Share Extension JARs so we are sure to get the latest changes
|
||||
* Assemble/Aggregate all Share extension JARs into the **my-share-project/target/extensions** directory
|
||||
* Create Docker Volumes for Repository (alf_data), Search index, and Database so data is persisted outside the containers
|
||||
@@ -110,11 +110,11 @@ The `./run.sh build_start` script will do the following:
|
||||
|
||||
This will build the following Docker image:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker image ls
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
alfresco-share-my-share-project development b8b9acdb3425 About a minute ago 749MB
|
||||
```
|
||||
```
|
||||
|
||||
The different web applications should now be accessible:
|
||||
|
||||
@@ -122,43 +122,43 @@ The different web applications should now be accessible:
|
||||
* **ACS Share**: http://localhost:8180/share/ - login with admin/admin
|
||||
|
||||
## Trying out the sample code
|
||||
The Share project has some sample extension code that you can try out.
|
||||
The Share project has some sample extension code that you can try out.
|
||||
|
||||
The Share extension is a custom Aikau page with a custom widget, you reach it with the following URL: `http://localhost:8180/share/page/hdp/ws/simple-page`.
|
||||
The source code for the Page and Widget is located here: **my-share-project/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages**
|
||||
The source code for the Page and Widget is located here: **my-share-project/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages**
|
||||
and here: **my-share-project/src/main/resources/META-INF/resources/my-share-project-share/js/tutorials/widgets**.
|
||||
|
||||
## Looking inside the containers
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Share container and list the custom Share extension JARs that have been deployed?
|
||||
Sometimes it's good to be able to look at what has actually been deployed in the containers. For example, how do I
|
||||
access the Share container and list the custom Share extension JARs that have been deployed?
|
||||
|
||||
You can do that as follows:
|
||||
|
||||
First **Ctrl-C** out of the log tailing:
|
||||
```
|
||||
```
|
||||
my-share-project-acs_1 | 27-Mar-2019 10:09:01.213 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 95189 ms
|
||||
my-share-project-acs_1 | 2019-03-27 10:09:30,278 INFO [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-5] Starting 'Transformers' subsystem, ID: [Transformers, default]
|
||||
my-share-project-acs_1 | 2019-03-27 10:09:30,618 INFO [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-5] Startup of 'Transformers' subsystem, ID: [Transformers, default] complete
|
||||
my-share-project-share_1 | 2019-03-27 10:11:50,150 INFO [web.site.EditionInterceptor] [http-nio-8080-exec-1] Successfully retrieved license information from Alfresco.
|
||||
my-share-project-share_1 | 2019-03-27 10:12:11,652 INFO [web.scripts.ImapServerStatus] [http-nio-8080-exec-7] Successfully retrieved IMAP server status from Alfresco: disabled
|
||||
^CERROR: Aborting.
|
||||
my-share-project mbergljung$
|
||||
```
|
||||
my-share-project mbergljung$
|
||||
```
|
||||
|
||||
Then check the name of the Alfresco Share container:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
dda89172506c alfresco/alfresco-content-repository-community:6.1.2-ga "catalina.sh run -se…" 6 minutes ago Up 6 minutes 0.0.0.0:8080->8080/tcp docker_my-share-project-acs_1
|
||||
2b4fa4b4a3f6 alfresco-share-my-share-project:development "/usr/local/tomcat/s…" 6 minutes ago Up 6 minutes 8000/tcp, 0.0.0.0:8180->8080/tcp, 0.0.0.0:9898->8888/tcp docker_my-share-project-share_1
|
||||
ad8857f3574b postgres:9.6 "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 0.0.0.0:5555->5432/tcp docker_my-share-project-postgres_1
|
||||
92902d7ae624 alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 6 minutes ago Up 6 minutes 0.0.0.0:8983->8983/tcp docker_my-share-project-ass_1
|
||||
```
|
||||
92902d7ae624 alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 6 minutes ago Up 6 minutes 0.0.0.0:8983->8983/tcp docker_my-share-project-ass_1
|
||||
```
|
||||
|
||||
Then open up a shell into the Alfresco Share container:
|
||||
|
||||
```
|
||||
```
|
||||
my-share-project mbergljung$ docker exec -it docker_my-share-project-share_1 /bin/bash
|
||||
[root@2b4fa4b4a3f6 tomcat]# pwd
|
||||
/usr/local/tomcat
|
||||
@@ -166,15 +166,15 @@ my-share-project mbergljung$ docker exec -it docker_my-share-project-share_1 /bi
|
||||
-rw-r--r-- 1 root root 18920 Mar 27 10:07 my-share-project-1.0-SNAPSHOT.jar
|
||||
[root@2b4fa4b4a3f6 tomcat]# exit
|
||||
exit
|
||||
```
|
||||
```
|
||||
|
||||
## Updating extension code
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Share Page title.
|
||||
Open up the **my-share-project/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js**
|
||||
So now you probably want to write some new code, or update the existing code, and see how that works with the containers running.
|
||||
What do you need to do, restart etc. First just update the code. For example, let's update the Share Page title.
|
||||
Open up the **my-share-project/src/main/resources/alfresco/web-extension/site-webscripts/com/example/pages/simple-page.get.js**
|
||||
file and change it to look as follows:
|
||||
|
||||
```
|
||||
```
|
||||
model.jsonModel = {
|
||||
widgets: [{
|
||||
id: "SET_PAGE_TITLE",
|
||||
@@ -204,45 +204,45 @@ model.jsonModel = {
|
||||
}
|
||||
}]
|
||||
};
|
||||
```
|
||||
```
|
||||
|
||||
To get this code update deployed we just have to run the following command in another console then where we are tailing the logs,
|
||||
and stand in the directory where the `run.sh` script is located:
|
||||
|
||||
```
|
||||
```
|
||||
my-share-project mbergljung$ ./run.sh reload_share
|
||||
```
|
||||
```
|
||||
|
||||
What this will do is the following:
|
||||
|
||||
* Kill the `my-share-project-acs` container
|
||||
* Kill the `my-share-project-acs` container
|
||||
* Remove the killed (stopped) `my-share-project-acs` container, so a new Docker image can be created with `development` tag
|
||||
* Build the Share extension JAR
|
||||
* Copy the newly built Share extension JAR over to the **my-share-project/target/extensions** where it will be picked up when the new Docker image is built.
|
||||
* Build a new `alfresco-share-my-share-project:development` image
|
||||
* Start up the `my-share-project-acs` container based on new image
|
||||
|
||||
You will be left with the console tailing the logs, but you can **Ctrl-C** out of this as you are already tailing the logs
|
||||
You will be left with the console tailing the logs, but you can **Ctrl-C** out of this as you are already tailing the logs
|
||||
in the initial console where we started things up.
|
||||
|
||||
You can now check if the change took effect by accessing the `http://localhost:8180/share/page/hdp/ws/simple-page` Web Script.
|
||||
|
||||
|
||||
## Stopping the project
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
To stop the solution you need to first `Ctrl-C` out of the log tailing. This does not stop the containers
|
||||
as they run in daemon mode in the background. Check this by executing the following command that lists running containers:
|
||||
|
||||
```
|
||||
```
|
||||
$ docker container ls
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
59f02060955a alfresco-share-my-share-project:development "/usr/local/tomcat/s…" 4 minutes ago Up 4 minutes 8000/tcp, 0.0.0.0:8180->8080/tcp, 0.0.0.0:9898->8888/tcp docker_my-share-project-share_1
|
||||
dda89172506c alfresco/alfresco-content-repository-community:6.1.2-ga "catalina.sh run -se…" 16 minutes ago Up 16 minutes 0.0.0.0:8080->8080/tcp docker_my-share-project-acs_1
|
||||
ad8857f3574b postgres:9.6 "docker-entrypoint.s…" 16 minutes ago Up 16 minutes 0.0.0.0:5555->5432/tcp docker_my-share-project-postgres_1
|
||||
92902d7ae624 alfresco/alfresco-search-services:1.2.0 "/bin/sh -c '$DIST_D…" 16 minutes ago Up 16 minutes 0.0.0.0:8983->8983/tcp docker_my-share-project-ass_1
|
||||
```
|
||||
92902d7ae624 alfresco/alfresco-search-services:2.0.3 "/bin/sh -c '$DIST_D…" 16 minutes ago Up 16 minutes 0.0.0.0:8983->8983/tcp docker_my-share-project-ass_1
|
||||
```
|
||||
|
||||
Now, standing in the directory where the `run.sh` script is located execute the following command to stop and remove the containers:
|
||||
|
||||
```
|
||||
```
|
||||
my-share-project mbergljung$ ./run.sh stop
|
||||
Stopping docker_my-share-project-share_1 ... done
|
||||
Stopping docker_my-share-project-acs_1 ... done
|
||||
@@ -253,7 +253,4 @@ Removing docker_my-share-project-acs_1 ... done
|
||||
Removing docker_my-share-project-postgres_1 ... done
|
||||
Removing docker_my-share-project-ass_1 ... done
|
||||
Removing network docker_default
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user