Starting Out With Alfresco Process Services—Getting a Docker Container up and Running
By Jeff Rosler
Recently, I started a project where I needed to do development work on a new Alfresco Process Services (APS) application and wanted to bring up an environment quickly on my Mac. My first thought was just to use Docker to spin up an environment. I knew that a Docker image was available (see the Alfresco docs), so it seemed like the quickest way forward.
I really like using Docker as opposed to VirtualBox, VMWare, etc. to quickly spin up Linux environments. It’s lightweight and you can emulate more complex environments with high availability, clustering, and disaster recovery that you might see in production. Whether you’re on macOS, Microsoft Windows, or Linux, you can download Docker and run containers in your local environment. I’ll leave how to download Docker and Docker Compose for your environment as an exercise for you and continue on about how to install and configure your APS environment using Docker once you’ve got it installed.
Download Your Licenses
After installing Docker, the first step is to get a license for APS. I already had a license, but you can get a 30-day trial license by filling out a simple form and downloading from the email you receive. If you do this, follow the steps below:
- Step 1: Select Option 2 and the “Deployable main webapp (activiti-app.war)” from the “Start Your Alfresco Trial Now” email you received.
- Step 2: Download the”30-Day Trial License” under Step 2
The reason you need to download the activti-app-1.8.1.zip is that there is another license in the zip file for the OEMd Aspose library which is used to perform Microsoft Office document transforms and manipulation. If, like me, you already own a license but don’t have it, you can download it from the Alfresco Support site. Don’t forget to get the activiti-app-1.8.1.zip file as well.
Create a folder on a local machine where you’ll run your Docker APS environment and copy your APS license file (activiti.lic) and the Aspose license file (transform.lic from the activiti-app-1.8.1.zip).
Create Your Docker Compose File
We’ll use docker-compose to run our Docker containers so you’ll want to create a yaml file named docker-compose.yml for that. The yaml file specifies images, containers, and container parameters. Copy the contents below and paste them in your new docker-compose.yml file. I copied the original docker-compose.yml file from the Alfresco aps-docker-library github repository and modified it for my local environment.
The first thing I did was to change the version of the process-services image to the latest which is 1.8.1. I could also just have specified “latest” (without the quotes) instead of a specific version. You can see all of the tags in the Alfresco Process Services Docker page.
The second change I made was to setup my volumes. I needed to map my license files into the APS container and I also wanted to specify local host folders for the APS content store and the database. Additionally, I set up a volume mapping for overriding the activiti-app.properties file, so that I can specify email integration.
Finally, I changed the port number I’m using to expose APS and made it 8081 as I frequently run Alfresco Content Services locally on port 8080 and didn’t want the port conflict.
Setting up Email
Since email notifications are an important part of my APS application, I also wanted to make sure that I configured my APS environment to send emails. For my purposes, I’ll use Gmail. I copied the activiti-app.properties file from the Activiti container the first time I ran it and added email information at the end. I then specified in my docker-compose.yml file that my activiti-app.properties should override the one in the running container. That’s done through the “- ./activiti-app.properties:/usr/share/tomcat/lib/activiti-app.properties” line in under “volumes:” as can be seen in the docker-compose.yml file.
Create your activiti-app.properties file in the Docker folder that contains the docker-compose.yml and license files and copy the contents below into it. After copying the contents, you’ll need to update the values for yourgmailtestaccount and yourgmailtestaccountpassword everywhere you see them to the Gmail account information that you’re going to use.
You also need to set your yourgmailtestaccount to let less secure apps access it (see https://support.google.com/accounts/answer/6010255?hl=en), so you might want to use something other than your primary Gmail account for this.
# Activiti General server settings.
# http://docs.alfresco.com/activiti/docs/admin-guide/1.5.0/#_general_server_settings for reference
# Datasource Information.
# http://docs.alfresco.com/activiti/docs/admin-guide/1.5.0/#databaseConfiguration for reference.
# Database username and password
# Driver to be used
# Database url. H2 by default, for standalone runs
# THis should point to your database ( external possibly )
# Hibernate dialect of choice
# ElasticSearch configuration.
# http://docs.alfresco.com/activiti/docs/admin-guide/1.5.0/#elasticSearchConfig for reference
# Admin user informations
# user: email@example.com , password: admin.
# http://docs.alfresco.com/activiti/docs/admin-guide/1.5.0/#contentStorageConfig for reference
# Security settings
#password min length
# USER TOKEN TTL
# after how long the cookie should expire
# how often the cookie get controlled
security.cookie.database-removal.cronExpression=0 0/10 * * * ?
# SIGN UP TO THE APP
# DISABLE SCRIPTING
# Beans whitelisting
# EL whitelisting
# CORS settings
# Email template settings
Start Alfresco Process Services
Now you’re ready to start your APS Docker containers. Bring up a command prompt/terminal window and change directory to the folder you created. Run “docker-compose up” without the quotes and it’ll start. The first time it starts, it’ll need to download images and build and may take awhile. Depending on your machine and internet connection, after a few minutes you should see a line in your output that says something like this:
process_1 | 31-May-2018 17:47:53.127 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 45051 ms
You can now launch a browser and go to http://localhost:8081/activiti-app. Log on with with username firstname.lastname@example.org and password admin.
Stopping Alfresco Process Services
You can break from within your command prompt or just bring up another command prompt/terminal window and change directory to the folder you created and run “docker-compose down” without the quotes and it’ll gracefully stop APS. The next time you start, it’ll use the data that’s stored in the psdata and pgdata folders. If you wanted to start it “clean” without saving any of this previous data, you can always rename or delete these folders.
If you’d like to learn more or discuss with our team, contact us here.