Skip to content

Instantly share code, notes, and snippets.

@rodrickbrown
Created June 23, 2016 12:32
Show Gist options
  • Select an option

  • Save rodrickbrown/bc9df96039f5b4364658680b54085bd1 to your computer and use it in GitHub Desktop.

Select an option

Save rodrickbrown/bc9df96039f5b4364658680b54085bd1 to your computer and use it in GitHub Desktop.
$ $ egrep run_jar roles/microservice/tasks/main.yml
template: src=run_jar.sh.j2 dest={{ orch_svc_base_dir }}/bin/run_jar.sh owner={{ orchard_service_user }} group={{ orchard_service_group }} mode=0755
$ cat roles/microservice/templates/run_jar.sh.j2
#!/bin/env bash
# {{ ansible_managed }}
{% if orch_svc_main_class == 'com.orchard.noteserver.NoteServer' %}
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
{% endif %}
echo
echo "$(date +'[%F %T%z]') Starting {{ orch_svc_type | upper }} SHA: {{ prod_sha }} server ENV: {{ svc_environment | default('production') | upper }} mode on {{ microservice_port }} HAPROXY_SERVICE_PORT: {{ haproxy_service_port }}"
echo
exec java \
-server \
-Xmx{{ jvm_memory | default(ansible_memtotal_mb // 2)}}M \
-XX:+UseConcMarkSweepGC \
-XX:+CMSClassUnloadingEnabled \
-XX:+CMSParallelRemarkEnabled \
-XX:+PrintCommandLineFlags \
-XX:+UseTLAB \
-XX:+UseParNewGC \
-Xss16M \
-Dsun.net.inetaddr.ttl=5 \
-Duser.timezone={{ ns_tz | default('GMT') }} \
-Dscala.concurrent.context.numThreads={{ [ansible_processor_vcpus*4, 64] | max }} \
-Dscala.concurrent.context.maxThreads={{ ansible_processor_vcpus*64 }} \
-Dcom.sun.management.jmxremote.port={{ jmx_port | default('7199') }} \
-Dcom.sun.management.jmxremote.rmi.port={{ jmx_port | default('7199') }} \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.local.only=false \
-Djava.net.preferIPv4Stack=true \
-Djavax.net.ssl.trustStore={{ keystore_path }}/{{ keystore_file1 }} \
-Djavax.net.ssl.trustStorePassword={{ keystore_password }} \
-Djavax.net.ssl.keyStore={{ keystore_path }}/{{ keystore_file2 }} \
-Djavax.net.ssl.keyStorePassword={{ keystore_password }} \
-Dcom.orchard.scaffold.library.trustStore={{ keystore_path }}/{{ keystore_file1 }} \
-Dcom.orchard.scaffold.library.trustStorePassword={{ keystore_password }} \
-Dcom.orchard.scaffold.library.keyStore={{ keystore_path }}/{{ keystore_file2 }} \
-Dcom.orchard.scaffold.library.keyStorePassword={{ keystore_password }} \
{% if orch_svc_type == 'listings-server' and orch_svc_type_name is defined %}
-Dlogback.configurationFile={{ orch_svc_base_dir }}/{{ orch_svc_logging }}/{{ orch_svc_type }}-{{ orch_svc_type_name }}-logback.xml \
{% else %}
-Dlogback.configurationFile={{ orch_svc_base_dir }}/{{ orch_svc_logging }}/logback.xml \
{% endif %}
{% if orch_svc_type == 'note-server' %}
-Dnotes.server.host={{ inventory_hostname }} \
-Dnotes.ec2InstanceId={{ facter_ec2_instance_id }} \
-Dnotes.ec2AvailabilityZone={{ facter_ec2_placement_availability_zone }} \
-Dnotes.ec2Region={{ ansible_ec2_placement_region }} \
-Dnotes.serverName={{ facter_hostname }} \
{% endif %}
{% if orch_svc_type_name is defined %}
-cp {{ orch_svc_base_dir }}/{{ orch_svc_type }}/{{ orch_svc_type }}.jar:{{ orch_svc_base_dir }}/etc/{{ orch_svc_type_name }} \
{% else %}
-cp {{ orch_svc_base_dir }}/{{ orch_svc_type }}/{{ orch_svc_type }}.jar:{{ orch_svc_base_dir }}/etc/ \
{% endif %}
{% if override_svc_main_class == 'true' %} ${@} {% else %} {{ orch_svc_main_class | mandatory }}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment