Skip to content

drop wrapping script in sync service #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion roles/sync/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ sync_environment:
JAVA_OPTS:
- -Xms512m
- -Xmx2g
- $JAVA_OPTS
sync_jmx_config_remote_enabled: false
sync_jmx_config_remote_port: 50800
sync_jmx_config_remote_rmi_port: 50801
Expand All @@ -29,3 +28,8 @@ sync_db_url: ""
sync_db_driver: org.postgresql.Driver
sync_db_name: "alfresco-sync"
sync_db_username: "alfresco-sync"

sync_java_home: "{{ java_home }}"
sync_activemq_host: "{{ activemq_host }}"

sync_repo_config_url: '${repo.scheme}://${repo.hostname}:${repo.port}/alfresco/service/devicesync/config'
33 changes: 2 additions & 31 deletions roles/sync/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,10 @@
vars:
molecule_nexus_username: "{{ lookup('env', 'NEXUS_USERNAME') }}"
molecule_nexus_password: "{{ lookup('env', 'NEXUS_PASSWORD') }}"
sync_amp_device_sync_version: 5.1.0
sync_amp_device_sync_artifact_name: alfresco-device-sync-repo
sync_amp_device_sync_repository: https://artifacts.alfresco.com/nexus/content/groups/private/org/alfresco/services/sync
sync_amp_device_sync_archive_url: "{{ sync_amp_device_sync_repository }}/{{ sync_amp_device_sync_artifact_name }}/{{ sync_amp_device_sync_version }}/{{ sync_amp_device_sync_artifact_name }}-{{ sync_amp_device_sync_version }}.amp"
roles:
- role: activemq
- role: nginx
- role: postgres
tasks:
- name: Install PostgreSQL
ansible.builtin.include_role:
name: postgres
- name: Setup repository database
ansible.builtin.include_role:
name: postgres
tasks_from: setup_db
vars:
postgres_db_name: "{{ repository_db_name }}"
postgres_db_username: "{{ repository_db_username }}"
postgres_db_password: "{{ repo_db_password }}"
postgres_db_clients: "{{ groups.repository }}"
- name: Setup sync database
ansible.builtin.include_role:
name: postgres
Expand All @@ -33,27 +17,14 @@
postgres_db_username: "{{ sync_db_username }}"
postgres_db_password: "{{ sync_db_password }}"
postgres_db_clients: "{{ groups.syncservice }}"
- name: Install Alfresco repository
ansible.builtin.include_role:
name: repository
vars:
repository_properties: "{{ global_properties }}"
repository_nexus_username: "{{ molecule_nexus_username }}"
repository_nexus_password: "{{ molecule_nexus_password }}"
repository_amp_downloads:
- url: "{{ sync_amp_device_sync_archive_url }}"
checksum: "sha1:{{ sync_amp_device_sync_archive_url }}.sha1"
dest: "{{ repository_content_folder }}/amps_repo/{{ sync_amp_device_sync_artifact_name }}.amp"
url_username: "{{ molecule_nexus_username }}"
url_password: "{{ molecule_nexus_password }}"
- name: Install Alfresco sync service
ansible.builtin.include_role:
name: sync
vars:
sync_repo_config_url: "https://run.mocky.io/v3/a62ce156-37c8-47b3-8cd1-08628b3aa130"
sync_zip_username: "{{ molecule_nexus_username }}"
sync_zip_password: "{{ molecule_nexus_password }}"
sync_environment:
JAVA_OPTS:
- -Xms512m
- -Xmx900m
- $JAVA_OPTS
5 changes: 5 additions & 0 deletions roles/sync/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
repo:
hostname: "{{ nginx_host }}"
port: "{{ ports_cfg.nginx.http }}"
syncconfig:
url: "{{ sync_repo_config_url }}"
sync:
cluster:
enabled: false
logging:
appenders:
- type: console
Expand Down
21 changes: 8 additions & 13 deletions roles/sync/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,18 @@
export SYNC_HOME={{ sync_home }}
insertafter: EOF

- name: Add sync service startup script
ansible.builtin.template:
src: syncservice.sh.j2
dest: "{{ binaries_folder }}/syncservice.sh"
owner: "{{ username }}"
group: "{{ group_name }}"
mode: 'u=rwx,g=rwx'
notify:
- Restart-sync
- name: Remove deprecated startup script
ansible.builtin.file:
path: "{{ binaries_folder }}/syncservice.sh"
state: absent

- name: Add alfresco-sync.service service
ansible.builtin.template:
src: alfresco-sync.service
src: alfresco-sync.service.j2
dest: "/etc/systemd/system/alfresco-sync.service"
owner: "{{ username }}"
group: "{{ group_name }}"
mode: 'u=rwx,g=rwx'
owner: "root"
group: "root"
mode: "0640"
notify:
- Enable-sync
- Restart-sync
Expand Down
14 changes: 0 additions & 14 deletions roles/sync/templates/alfresco-sync.service

This file was deleted.

18 changes: 18 additions & 0 deletions roles/sync/templates/alfresco-sync.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=Alfresco Sync Service
After=syslog.socket network.target local-fs.target remote-fs.target

[Service]
Type=simple
WorkingDirectory={{ sync_home }}/service-sync
User={{ username }}
ExecStart={{ sync_java_home }}/bin/java $JAVA_OPTS -cp '{{ sync_home }}/service-sync/connectors/*:service-sync-{{ sync_version }}.jar' org.alfresco.service.sync.dropwizard.SyncService server {{ config_folder }}/sync-service/config.yml
Restart=on-failure
RestartSec=60
TimeoutStopSec=5
{% for key, value in sync_environment.items() %}
Environment="{{ key }}={{ value | join(' ') | replace('%', '%%') }}"
{% endfor %}

[Install]
WantedBy=multi-user.target
236 changes: 0 additions & 236 deletions roles/sync/templates/syncservice.sh.j2

This file was deleted.