adding startup role and moving the service template to the normal one

This commit is contained in:
Geoff Jacobs
2022-08-31 11:22:19 +10:00
parent bb92b68bf2
commit 73de6b7f61
3 changed files with 45 additions and 39 deletions

View File

@@ -5,12 +5,25 @@
vars: vars:
# See group_vars/aws_node_local.yml, which pull vars from the environment. # See group_vars/aws_node_local.yml, which pull vars from the environment.
atl_product_family: "stash" atl_product_family: "stash"
atl_product_edition: "bitbucket" atl_product_edition: "mesh"
atl_product_user: "bitbucket" atl_product_user: "bitbucket"
atl_systemd_service_name: "mesh.service"
atl_startup_systemd_params:
- 'UMask=0027'
- 'Environment=MESH_HOME={{ atl_home_base }}/{{ atl_product_edition }}'
- 'Environment=JAVA_HOME=/usr/lib/jvm/java'
- 'Environment=JRE_HOME=/usr/lib/jvm/java'
- 'Environment=JMX_REMOTE_AUTH=password'
- 'Environment=JMX_PASSWORD_FILE=/var/atlassian/application-data/jmx/jmx.access'
- 'Environment="JVM_SUPPORT_RECOMMENDED_ARGS=-Dmesh.enabled=true -Dplugin.bitbucket-git.mesh.sidecar.child-process=false -Dcom.sun.management.jmxremote.port=4444 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{ atl_home_base }}/{{ atl_product_edition }}/log"'
- 'Environment=JVM_MAXIMUM_MEMORY={{ atl_jvm_heap }}'
atl_startup_exec_path: "{{ mesh_install_dir }}/current/bin/start-mesh.sh"
atl_stop_exec_path: "{{ mesh_install_dir }}/current/bin/stop-mesh.sh"
atl_systemd_service_target: "multi-user.target"
roles: roles:
- role: linux_common - role: linux_common
- role: aws_common - role: aws_common
- role: product_common - role: product_common
- role: bitbucket_mesh - role: bitbucket_mesh
- role: product_startup

View File

@@ -11,14 +11,6 @@
- "{{ atl_home_base }}/{{ atl_product_edition }}" - "{{ atl_home_base }}/{{ atl_product_edition }}"
- "{{ mesh_install_dir }}" - "{{ mesh_install_dir }}"
- name: Template out the mesh service file
ansible.builtin.template:
src: mesh.service.j2
dest: "/usr/lib/systemd/system/mesh.service"
owner: "root"
group: "root"
mode: 0740
- name: download the mesh distribution using maven - name: download the mesh distribution using maven
community.general.maven_artifact: community.general.maven_artifact:
group_id: "com.atlassian.bitbucket.mesh" group_id: "com.atlassian.bitbucket.mesh"
@@ -27,11 +19,38 @@
version: "{{ atl_product_version }}" version: "{{ atl_product_version }}"
repository_url: "{{ bitbucket_mesh_maven_repo }}" repository_url: "{{ bitbucket_mesh_maven_repo }}"
dest: "{{ mesh_install_dir }}" dest: "{{ mesh_install_dir }}"
keep_name: yes
mode: "0644" mode: "0644"
owner: "{{ atl_product_user_uid }}" owner: "{{ atl_product_user_uid }}"
group: "{{ atl_product_user_uid }}" group: "{{ atl_product_user_uid }}"
register: maven_download register: maven_download
- name: debug - name: extract the downloaded artifact
debug: ansible.builtin.unarchive:
var: maven_download src: "{{ maven_download.dest }}"
dest: "/opt/atlassian/mesh/"
creates: "/opt/atlassian/mesh/atlassian-bitbucket-mesh-{{ atl_product_version }}"
mode: 0755
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
register: mesh_extract
when:
- maven_download.changed | bool
- not maven_download.failed
# the owner/group on the unarchive above isn't thorough
- name: adjust permissions on the extracted directory
ansible.builtin.file:
state: directory
path: "/opt/atlassian/mesh/atlassian-bitbucket-mesh-{{ atl_product_version }}"
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
recurse: yes
- name: symlink to the current version
ansible.builtin.file:
src: "/opt/atlassian/mesh/atlassian-bitbucket-mesh-{{ atl_product_version }}"
dest: "/opt/atlassian/mesh/current"
state: link
when:
- mesh_extract.changed | bool

View File

@@ -1,26 +0,0 @@
[Unit]
Description=Atlassian bitbucket-mesh
After=syslog.target network-online.target
[Service]
Type=forking
UMask=0027
User={{ atl_product_user }}
Group={{ atl_product_user }}
StandardOutput=journal+console
StandardError=journal+console
LimitNOFILE=65336
Environment=MESH_HOME={{ atl_home_base }}/{{ atl_product_edition }}
Environment=JAVA_HOME=/usr/lib/jvm/java
Environment=JRE_HOME=/usr/lib/jvm/java
Environment=JMX_REMOTE_AUTH=password
Environment=JMX_PASSWORD_FILE=/var/atlassian/application-data/jmx/jmx.access
Environment="JVM_SUPPORT_RECOMMENDED_ARGS=-Dmesh.enabled=true -Dplugin.bitbucket-git.mesh.sidecar.child-process=false -Dcom.sun.management.jmxremote.port=4444 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{ atl_home_base }}/{{ atl_product_edition }}/log"
Environment=JVM_MAXIMUM_MEMORY={{ atl_jvm_heap }}
PIDFile={{ atl_home_base }}/{{ atl_product_edition }}/log/mesh.pid
PassEnvironment=JMX_REMOTE_AUTH JMX_PASSWORD_FILE JAVA_HOME
ExecStart={{ mesh_install_dir }}/current/bin/start-mesh.sh
ExecStop={{ mesh_install_dir }}/current/bin/stop-mesh.sh
[Install]
WantedBy=multi-user.target