Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #291 from Open-MBEE/release/3.3.0
Browse files Browse the repository at this point in the history
Release/3.3.0
  • Loading branch information
HuiJun authored Jun 28, 2018
2 parents 0628989 + 0bd13b4 commit d5d103b
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 145 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@

<!--- [ ![Download](https://api.bintray.com/packages/openmbee/maven/mms-share-amp/images/download.svg) ](https://bintray.com/openmbee/maven/mms-share-amp/_latestVersion) mms-share-amp --->

[![CircleCI](https://circleci.com/gh/Open-MBEE/mms.svg?style=svg)](https://circleci.com/gh/Open-MBEE/mms)

**AMP for Alfresco (5.1.g)**
[ ![Download](https://api.bintray.com/packages/openmbee/maven/mms-amp/images/download.svg) ](https://bintray.com/openmbee/maven/mms-amp/_latestVersion) [![Language Grade: Java](https://img.shields.io/lgtm/grade/java/g/Open-MBEE/mms.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Open-MBEE/mms/context:java) [![CircleCI](https://circleci.com/gh/Open-MBEE/mms.svg?style=svg)](https://circleci.com/gh/Open-MBEE/mms)

Use this table to check what version of the mms - mdk - ve triple you should be using: https://github.com/Open-MBEE/mdk/blob/support/2.5/manual/MDK%20-%20MMS%20-%20VE%20Compatibility%20Matrix.pdf
**AMP for Alfresco (5.1.g AKA 201605-GA)**

Use this table to check what version of the mms - mdk - ve triple you should be using: [Compatibility Matrix](https://github.com/Open-MBEE/open-mbee.github.io/blob/master/compat%20matrix.pdf)
## Developer Setup

### Dependencies
* ElasticSearch 5.x
* PostgreSQL 9.x
* ElasticSearch 5.x (Up to 5.5)
* PostgreSQL 9.x (Up to 9.4 is using PostgreSQL for Alfresco)

### Optional Dependencies
* ActiveMQ 5.X

### 1a. Using Intellij
* Open Project with root of 'mms-ent'
* Open Project with root of 'mms'
* Import Maven Project
* Open Project Structure and Import Module "mms-ent" and set to find projects recursively

### 1b. Import Project from git repo to Eclipse
* **Eclipse** > **File** > **Import** > **General** > **Existing Projects into Workspace**
Expand Down
110 changes: 83 additions & 27 deletions mms-ent/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
FROM openjdk:8-jdk-alpine

ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
ENV BUILD_DEPS \
alpine-sdk \
cabextract \
coreutils \
curl \
ghc \
gmp \
libffi \
linux-headers \
musl-dev \
wget \
zlib-dev

ENV PERSIST_DEPS \
fontconfig \
graphviz \
imagemagick \
msttcorefonts-installer \
python \
py2-pip \
sed \
ttf-droid \
ttf-droid-nonlatin \
unzip

ENV EDGE_DEPS \
cabal

ENV TOMCAT_MAJOR 7
ENV TOMCAT_VERSION 7.0.88
ENV TOMCAT_TGZ_URL "http://mirrors.sonic.net/apache/tomcat/tomcat-7/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz"
ENV POSTGRES_HOST localhost
ENV TOMCAT_HOME /usr/local/tomcat

ENV PLANTUML_VERSION 1.2017.18
ENV PLANTUML_DOWNLOAD_URL https://sourceforge.net/projects/plantuml/files/plantuml.$PLANTUML_VERSION.jar/download

ENV PANDOC_VERSION 1.19.2.4
ENV PANDOC_DOWNLOAD_URL https://hackage.haskell.org/package/pandoc-$PANDOC_VERSION/pandoc-$PANDOC_VERSION.tar.gz
ENV PANDOC_HOME /usr/local/pandoc

ENV ALF_DATA_DIR /mnt/alf_data
ENV CONFIG_DIR /usr/local/config
ENV FILES_DIR /usr/local/files
ENV TOMCAT_DIR /usr/local/tomcat

RUN apk add --update curl wget unzip
ENV PATH $TOMCAT_HOME/bin:$PANDOC_HOME/bin:$PATH

# ---- Install Dependencies ----
RUN apk upgrade --update \
&& apk add --no-cache --virtual .build-deps $BUILD_DEPS \
&& apk add --no-cache --virtual .persistent-deps $PERSIST_DEPS \
&& update-ms-fonts \
&& fc-cache -f \
&& curl -fsSL "$PLANTUML_DOWNLOAD_URL" -o /usr/local/plantuml.jar \
&& apk add --no-cache --virtual .edge-deps $EDGE_DEPS -X http://dl-cdn.alpinelinux.org/alpine/edge/community \
&& curl -fsSL "$PANDOC_DOWNLOAD_URL" | tar -xzf - \
&& ( cd pandoc-$PANDOC_VERSION && cabal update && cabal install --only-dependencies \
&& cabal configure --prefix=$PANDOC_HOME \
&& cabal build \
&& cabal copy \
&& cd .. ) \
&& rm -Rf pandoc-$PANDOC_VERSION/ \
&& rm -Rf /root/.cabal/ /root/.ghc/ \
&& rm -Rf /pandoc-build \
&& mkdir -p /var/docs


# ---- Tomcat ----
RUN curl -fSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
Expand All @@ -21,59 +73,63 @@ RUN curl -fSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
&& tar -xzf tomcat.tar.gz \
&& rm tomcat.tar.gz* \
&& echo "mv apache-tomcat-${TOMCAT_VERSION} tomcat" \
&& mv apache-tomcat-${TOMCAT_VERSION} ${TOMCAT_DIR}
&& mv apache-tomcat-${TOMCAT_VERSION} ${TOMCAT_HOME}


# ---- Alfresco ----
WORKDIR /usr/local
COPY config /usr/local/config
COPY config ${CONFIG_DIR}
COPY config/config_alfresco.sh .
COPY config/run.sh tomcat/bin/run.sh
COPY config/set_properties.sh tomcat/bin/set_properties.sh
COPY config/run.sh ${TOMCAT_HOME}/bin/run.sh
COPY config/set_properties.sh ${TOMCAT_HOME}/bin/set_properties.sh


# Download the community zip files
RUN wget --no-check-certificate "https://download.alfresco.com/release/community/201605-build-00010/alfresco-community-distribution-201605.zip" \
RUN wget --no-check-certificate -S "https://download.alfresco.com/release/community/201605-build-00010/alfresco-community-distribution-201605.zip" \
&& chmod +x config_alfresco.sh \
&& chmod +x tomcat/bin/run.sh \
&& chmod +x tomcat/bin/set_properties.sh \
&& chmod +x ${TOMCAT_HOME}/bin/run.sh \
&& chmod +x ${TOMCAT_HOME}/bin/set_properties.sh \
&& ./config_alfresco.sh

RUN cp ${CONFIG_DIR}/alfresco-global.properties tomcat/shared/classes/alfresco-global.properties \
&& cp ${CONFIG_DIR}/catalina.properties tomcat/conf/catalina.properties \
&& cp ${CONFIG_DIR}/solr4-context.xml tomcat/conf/Catalina/localhost/solr4.xml \
&& cp ${CONFIG_DIR}/solr4-context.xml tomcat/solr4/context.xml \
&& cp ${CONFIG_DIR}/tomcat-server.xml tomcat/conf/server.xml \
&& cp ${CONFIG_DIR}/archive-solrcore.properties tomcat/solr4/archive-SpacesStore/conf/solrcore.properties \
&& cp ${CONFIG_DIR}/workspace-solrcore.properties tomcat/solr4/workspace-SpacesStore/conf/solrcore.properties
RUN cp ${CONFIG_DIR}/alfresco-global.properties ${TOMCAT_HOME}/shared/classes/alfresco-global.properties \
&& cp ${CONFIG_DIR}/catalina.properties ${TOMCAT_HOME}/conf/catalina.properties \
&& cp ${CONFIG_DIR}/solr4-context.xml ${TOMCAT_HOME}/conf/Catalina/localhost/solr4.xml \
&& cp ${CONFIG_DIR}/tomcat-server.xml ${TOMCAT_HOME}/conf/server.xml \
&& cp ${CONFIG_DIR}/tomcat-users.xml ${TOMCAT_HOME}/conf/tomcat-users.xml \
&& cp ${CONFIG_DIR}/archive-solrcore.properties ${TOMCAT_HOME}/solr4/archive-SpacesStore/conf/solrcore.properties \
&& cp ${CONFIG_DIR}/workspace-solrcore.properties ${TOMCAT_HOME}/solr4/workspace-SpacesStore/conf/solrcore.properties


# ---- MMS -----
COPY files ${FILES_DIR}
RUN java -jar ${TOMCAT_DIR}/bin/alfresco-mmt.jar install ${FILES_DIR}/mms-amp*.amp ${TOMCAT_DIR}/webapps/alfresco.war -force \
&& java -jar ${TOMCAT_DIR}/bin/alfresco-mmt.jar install ${FILES_DIR}/mms-share-amp*.amp ${TOMCAT_DIR}/webapps/share.war -force \
&& cd ${TOMCAT_DIR}/webapps \
RUN java -jar ${TOMCAT_HOME}/bin/alfresco-mmt.jar install ${FILES_DIR}/mms-amp*.amp ${TOMCAT_HOME}/webapps/alfresco.war -force \
&& java -jar ${TOMCAT_HOME}/bin/alfresco-mmt.jar install ${FILES_DIR}/mms-share-amp*.amp ${TOMCAT_HOME}/webapps/share.war -force \
&& cd ${TOMCAT_HOME}/webapps \
&& rm -rf alfresco share \
&& mkdir alfresco share \
&& cd alfresco \
&& jar xf ../alfresco.war \
&& cd ../share \
&& jar xf ../share.war \
&& mv ${FILES_DIR}/mms.properties.example ${TOMCAT_DIR}/shared/classes/mms.properties \
&& cp ${FILES_DIR}/web.xml ${TOMCAT_DIR}/webapps/alfresco/WEB-INF/web.xml \
&& mv ${FILES_DIR}/mms.properties.example ${TOMCAT_HOME}/shared/classes/mms.properties \
&& cp ${FILES_DIR}/web.xml ${TOMCAT_HOME}/webapps/alfresco/WEB-INF/web.xml \
&& rm -rf ${FILES_DIR} \
&& cd ${TOMCAT_DIR}/webapps \
&& cd ${TOMCAT_HOME}/webapps \
&& rm *.bak


# Add tomcat user and config
RUN addgroup -S tomcat \
&& adduser -G tomcat -g "Tomcat User" -s /bin/ash -D tomcat \
&& mkdir -p ${ALF_DATA_DIR}/solr4 \
&& chown -R tomcat:tomcat ${TOMCAT_DIR} \
&& chown -R tomcat:tomcat ${TOMCAT_HOME} \
&& chown -R tomcat:tomcat ${ALF_DATA_DIR}

RUN apk del .build-deps


# Alfresco
#EXPOSE 8080:8080
EXPOSE 8080:8080
# Postgres
#EXPOSE 5432:5432
# ElasticSearch
Expand Down
24 changes: 20 additions & 4 deletions mms-ent/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Docker MMS README

Build container
Build docker image
```
docker build . -t mms-container
docker build . -t mms-image
```

To run the container:
- we need to specify the mount directory
- For persistence, we need to specify the mount directory
```
--mount source=mmsvol,target=/mnt/alf_data
```
Expand Down Expand Up @@ -40,5 +40,21 @@ Set the PostgreSQL info:

Example running the container
```
docker run --mount source=mmsvol,target=/mnt/alf_data -p 8080:8080 -e PG_HOST={PG_ID_ADDR} -e PG_DB_NAME=mms -e PG_DB_USER=${PG_USER} -e PG_DB_PASS={PG_PASS} -e ES_HOST={PG_ID_ADDR} -d mms-container
docker run --mount source=mmsvol,target=/mnt/alf_data -p 8080:8080 -e PG_HOST={PG_ID_ADDR} -e PG_DB_NAME=mms -e PG_DB_USER=${PG_USER} -e PG_DB_PASS={PG_PASS} -e ES_HOST={PG_ID_ADDR} -d mms-image
```

Example for initializing Postgres in docker

```
docker run -d --name postgres-docker --publish=5432:5432 -e POSTGRES_USER=${PG_USER} -e POSTGRES_PASSWORD=${PG_PASS} postgres:9.4-alpine
docker exec -it postgres-docker psql -h localhost -U postgres -c "ALTER ROLE ${PG_USER} CREATEDB"
docker exec -it postgres-docker createdb -h localhost -U ${PG_USER} alfresco
docker exec -it postgres-docker createdb -h localhost -U ${PG_USER} mms
docker exec -it postgres-docker psql -h localhost -U ${PG_USER} -d mms -c "create table if not exists organizations ( id bigserial primary key, orgId text not null, orgName text not null, constraint unique_organizations unique(orgId, orgName) ); create index orgId on organizations(orgId); create table projects ( id bigserial primary key, projectId text not null, orgId integer references organizations(id), name text not null, location text not null, constraint unique_projects unique(orgId, projectId) ); create index projectIdIndex on projects(projectid);"
```

Example for initializing Elasticsearch in docker
```
docker run -d --name elasticsearch-docker --publish=9200:9200 elasticsearch:5.5-alpine
curl -XPUT http://localhost:9200/_template/template -d @repo-amp/src/main/resources/mapping_template.json
```
14 changes: 14 additions & 0 deletions mms-ent/docker/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

count=`ls -1 ./files/*.amp 2>/dev/null | wc -l`
if [[ ${count} < 2 ]];then
(cd ../; ./mvnw clean -Ppurge && ./mvnw install -Pbuild)
cp ../repo-amp/target/*.amp ./files/
cp ../share-amp/target/*.amp ./files/
fi

if [ ! -f ./files/mms.properties.example ];then
cp ../mms.properties.example ./files/
fi

docker build . -t mms-image
30 changes: 11 additions & 19 deletions mms-ent/docker/config/alfresco-global.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ system.content.caching.maxFileSizeMB=0

alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
alfresco.port=8443
alfresco.protocol=https

share.context=share
share.host=localhost
share.port=8080
share.protocol=http
share.port=8443
share.protocol=https

### database connection properties ###
db.driver=org.postgresql.Driver
db.name=alfresco
db.username=
db.password=
db.host=
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=5432
# probably can up this to same as max connections in db configuration (currently 225)
db.pool.max=225
Expand Down Expand Up @@ -64,7 +64,6 @@ img.root=/usr
img.dyn=${img.root}/lib
img.exe=/usr/bin/convert
swf.exe=/usr/local/bin/pdf2swf
#swf.languagedir=/opt/local/alfresco-4.2.e/common/japanese

jodconverter.enabled=false
jodconverter.officeHome=/usr/lib64/libreoffice/
Expand All @@ -74,14 +73,15 @@ jodconverter.portNumbers=8100
alfresco_user_store.adminusername=admin
alfresco_user_store.adminpassword=209c6174da490caeb422f3fa5a7ae634


### E-mail site invitation setting ###
notification.email.siteinvite=false

encryption.ssl.keystore.location=/usr/local/tomcat/keystore/ssl.keystore
encryption.ssl.truststore.location=/usr/local/tomcat/keystore/ssl.truststore

### Solr indexing ###
index.subsystem.name=solr4
dir.keystore=${dir.root}/keystore
dir.keystore=/usr/local/tomcat/keystore
solr.host=localhost
solr.port=8080
solr.port.ssl=8443
Expand All @@ -90,7 +90,6 @@ solr.port.ssl=8443
### BPM Engine ###
system.workflow.engine.jbpm.enabled=false

# disable services - only enable if necessary
# disable google
googledocs.enabled=false
googledocs.googleeditable.enabled=false
Expand All @@ -108,17 +107,14 @@ alfresco.jmx.connector.enabled=false
mail.host =
mail.testmessage.send = true
mail.testmessage.to =
#mail.testmessage.to = [email protected]
mail.username =
mail.from.default =
mail.smtp.timeout=10000
activities.feed.notifier.enabled = false



#replication.enabled=true
#replication.transfer.readonly=true
transferservice.receiver.enabled=true
#transferservice.receiver.enabled=true

###############################################################################
# The default authentication chain
Expand All @@ -131,8 +127,6 @@ transferservice.receiver.enabled=true
#authentication.chain=ldap1:ldap,partners1:ldap,alfrescoNtlm1:alfrescoNtlm
authentication.chain=alfrescoNtlm1:alfrescoNtlm



# turn off timestamp propagation to parent folders (slows down loading)
system.enableTimestampPropagation=false
###### SYNCHRONISATION SETTINGS ####
Expand All @@ -158,5 +152,3 @@ synchronization.allowDeletions=false
### synchronisation starts every 60 minutes!
#synchronization.import.cron=0 0/60 * * * ?
synchronization.import.cron=0 0 0/2 * * ?

solr.secureComms=none
2 changes: 1 addition & 1 deletion mms-ent/docker/config/archive-solrcore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# data is in ${data.dir.root}/${data.dir.store}

data.dir.root=/mnt/alf_data/solr4
data.dir.root=/mnt/alf_data/solr4/index
data.dir.store=archive/SpacesStore
enable.alfresco.tracking=true

Expand Down
23 changes: 6 additions & 17 deletions mms-ent/docker/config/config_alfresco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ ROOT_DIR=/usr/local/alfresco-community-distribution-201605
TOMCAT_DIR=/usr/local/tomcat
unzip -q alfresco-community-distribution-201605.zip

#ls -la
#ls -la ${CUR_DIR}
#ls -la ${TOMCAT_DIR}
#echo "cp -r ${ROOT_DIR}/alf_data /mnt/"
#cp -r ${ROOT_DIR}/alf_data /mnt/

echo "cp -r ${ROOT_DIR}/alf_data /mnt/"
cp -r ${ROOT_DIR}/alf_data /mnt/
mkdir /mnt/alf_data

echo "cp -r ${ROOT_DIR}/alf_data/keystore ${TOMCAT_DIR}/keystore"
cp -r ${ROOT_DIR}/alf_data/keystore ${TOMCAT_DIR}/keystore

echo "cp ${ROOT_DIR}/web-server/webapps/alfresco.war ${TOMCAT_DIR}/webapps"
mv ${ROOT_DIR}/web-server/webapps/alfresco.war ${TOMCAT_DIR}/webapps/alfresco.war
Expand All @@ -32,7 +33,6 @@ cp ${ROOT_DIR}/web-server/lib/postgresql-9.4-1201-jdbc41.jar ${TOMCAT_DIR}/lib/p
echo "cp -r ${ROOT_DIR}/web-server/shared tomcat/shared"
cp -r ${ROOT_DIR}/web-server/shared ${TOMCAT_DIR}/
mkdir ${TOMCAT_DIR}/shared/lib
mv ${ROOT_DIR}/web-server/lib/postgresql-9.4-1201-jdbc41.jar ${TOMCAT_DIR}/shared/lib/

echo "cp -r ${ROOT_DIR}/amps tomcat/"
cp -r ${ROOT_DIR}/amps ${TOMCAT_DIR}/
Expand All @@ -56,17 +56,6 @@ cp -r ${ROOT_DIR}/bin ${TOMCAT_DIR}/
echo "java -jar ${TOMCAT_DIR}/bin/alfresco-mmt.jar install ${TOMCAT_DIR}/amps/alfresco-share-services.amp ${TOMCAT_DIR}/webapps/repo.war -force"
java -jar ${TOMCAT_DIR}/bin/alfresco-mmt.jar install ${TOMCAT_DIR}/amps/alfresco-share-services.amp ${TOMCAT_DIR}/webapps/alfresco.war -force

# Explode wars into directories
cd ${TOMCAT_DIR}/webapps
rm -rf alfresco share solr4
mkdir alfresco share solr4
cd alfresco
jar xf ../alfresco.war
cd ../share
jar xf ../share.war
cd ../solr4
jar xf ../solr4.war

# Remove extra backup files
cd ${TOMCAT_DIR}/webapps
rm -rf *.bak
Expand Down
Loading

0 comments on commit d5d103b

Please sign in to comment.