I am deploying symmetricds on google container engine, so i have build symmetricds war file and create docker tomcat image like below :-
FROM tomcat
ENV JAVA_OPTS="-Dcom.sun.management.jmxremote.port=1109 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
ENV CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=1109 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
ADD ./symmetric-ds.war /usr/local/tomcat/webapps/
ADD ./mysql-connector-java-5.1.30.jar /usr/local/tomcat/lib/
COPY ./context.xml /usr/local/tomcat/conf/context.xml
COPY ./server.xml /usr/local/tomcat/conf/server.xml
COPY ./tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml
RUN sh -c 'touch /usr/local/tomcat/webapps/symmetric-ds.war'
VOLUME /usr/local/tomcat/webapps/
EXPOSE 8080 1109and after that i have push it to repository and i am using kubernetes to deploy it. my kubernetes yml file is below :-
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: symserver
spec:
replicas: 1
template:
metadata:
labels:
app: symserver
spec:
containers:
- name: symserver
image: symserver:v1
ports:
- containerPort: 8080
- containerPort: 1109
---
apiVersion: v1
kind: Service
metadata:
name: symserver
spec:
selector:
app: symserver
type: LoadBalancer
ports:
- port: 8080
- port: 1109I have two problems for which i am looking for solution :-
As docker images are read only whatever properties i have defined in symmetricds.properties (which will be part of war file and war file be inside tomcat and i named tomcat image as symserver for docker ) file are fixed and read only. like
sync.url=http://$(hostName):8080/symmtric-ds/sync/$(engineName)
when i deploy it to google cloud i get different ip for pods and service external link. so how to solve this problem ? as i have to set this ip in symmetricds.properties file so my other store node can connect to it. and when i restart the server then it 'symmetricds' will again pickup new ip or same ip again from file.
JMX in case of docker and kubernetes, i have added JMX option in build file but somehow i am not able to connect it using jconsole. I have exposed port 1109 to local machine using port forward command.symmetricds.properties file has either to be packed outside of the war file and then manipulated before starting the server so the placeholders could be replaced with concrete values or use the notation ${env.variable.value} and try seeing if Spring replaces them with environment variables
To externalize the file symmetricds.properties add this section to the file WEB-INF\web.xml
<context-param>
<param-name>multiServerMode</param-name>
<param-value>true</param-value>
</context-param>store the file on the file system in a directory, let's say /opt/symm/ and set the java system property symmetric.engines.dir to the value of the directory path