Skip to content

Commit 8d01baf

Browse files
committed
WIP
1 parent 086fd2c commit 8d01baf

File tree

5 files changed

+68
-81
lines changed

5 files changed

+68
-81
lines changed

ansible/playbooks/deploy_vm.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
mode: '0755'
246246
tags: [docker, setup]
247247

248-
- name: Download arinax Docker image from WebDAV
248+
- name: Download arinax Docker image
249249
ansible.builtin.get_url:
250250
url: "{{ arinax_docker_image_url }}"
251251
dest: "{{ install_base_path }}/docker-images/arinax.tar"
@@ -255,7 +255,7 @@
255255
when: arinax_docker_image_url is defined
256256
tags: [docker, images]
257257

258-
- name: Download flex Docker image from WebDAV
258+
- name: Download flex Docker image
259259
ansible.builtin.get_url:
260260
url: "{{ flex_docker_image_url }}"
261261
dest: "{{ install_base_path }}/docker-images/flex.tar"
@@ -303,34 +303,34 @@
303303
daemon_reload: true
304304
tags: [service, systemd]
305305

306-
# Bliss REST API services
307-
- name: Create bliss demo servers systemd service
306+
# Bliss services
307+
- name: Create bliss server systemd service
308308
ansible.builtin.template:
309-
src: templates/bliss-demo-servers.service.j2
310-
dest: "/etc/systemd/system/bliss-demo-servers-{{ vm_context }}.service"
309+
src: templates/bliss-server.service.j2
310+
dest: "/etc/systemd/system/bliss-server-{{ vm_context }}.service"
311311
mode: '0644'
312312
notify: Reload systemd
313313
tags: [service, systemd, bliss]
314314

315-
- name: Create bliss REST API systemd service
315+
- name: Create bliss session systemd service
316316
ansible.builtin.template:
317-
src: templates/bliss-rest.service.j2
318-
dest: "/etc/systemd/system/bliss-rest-{{ vm_context }}.service"
317+
src: templates/bliss-session.service.j2
318+
dest: "/etc/systemd/system/bliss-session-{{ vm_context }}.service"
319319
mode: '0644'
320320
notify: Reload systemd
321321
tags: [service, systemd, bliss]
322322

323-
- name: Enable and start Bliss demo servers service
323+
- name: Enable and start Bliss server service
324324
ansible.builtin.systemd:
325-
name: "bliss-demo-servers-{{ vm_context }}"
325+
name: "bliss-server-{{ vm_context }}"
326326
enabled: true
327327
state: started
328328
daemon_reload: true
329329
tags: [service, systemd, bliss]
330330

331-
- name: Enable and start Bliss REST API service
331+
- name: Enable and start Bliss session service
332332
ansible.builtin.systemd:
333-
name: "bliss-rest-{{ vm_context }}"
333+
name: "bliss-session-{{ vm_context }}"
334334
enabled: true
335335
state: started
336336
daemon_reload: true
@@ -342,8 +342,8 @@
342342
- " Deployment complete for {{ vm_context }}"
343343
- " Installation path: {{ install_base_path }}"
344344
- " MXCubeWeb service: mxcubeweb-{{ vm_context }}"
345-
- " Bliss demo servers: bliss-demo-servers-{{ vm_context }}"
346-
- " Bliss REST API: bliss-rest-{{ vm_context }}"
345+
- " Bliss server: bliss-server-{{ vm_context }}"
346+
- " Bliss session: bliss-session-{{ vm_context }}"
347347
- " Check status: systemctl status mxcubeweb-{{ vm_context }}"
348348
- " View logs: journalctl -u mxcubeweb-{{ vm_context }} -f"
349349
- " Bliss REST API: http://{{ ansible_hostname }}:5000/api"

ansible/playbooks/templates/bliss-demo-servers.service.j2

Lines changed: 0 additions & 33 deletions
This file was deleted.

ansible/playbooks/templates/bliss-rest.service.j2

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[Unit]
2+
Description=Bliss Demo Servers ({{ vm_context }})
3+
After=network.target
4+
Before=bliss-session-{{ vm_context }}.service
5+
6+
[Service]
7+
Type=simple
8+
User={{ service_user }}
9+
Group=esrfusers
10+
WorkingDirectory={{ install_base_path }}/bliss
11+
12+
# Start command - activate conda environment and run demo servers
13+
ExecStart=/bin/bash -c 'HOSTNAME=$(hostname) && export BEACON_HOST=$HOSTNAME:10001 && export TANGO_HOST=$HOSTNAME:10000 && source {{ install_base_path }}/miniconda/bin/activate bliss_dev && python -m blissdemo.apps.demo_servers --no-detectors'
14+
15+
# Restart policy
16+
Restart=on-failure
17+
RestartSec=10
18+
19+
# Logging
20+
StandardOutput=journal
21+
StandardError=journal
22+
SyslogIdentifier=bliss-server-{{ vm_context }}
23+
24+
[Install]
25+
WantedBy=multi-user.target
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[Unit]
2+
Description=Bliss Demo Session ({{ vm_context }})
3+
After=network.target bliss-server-{{ vm_context }}.service
4+
Wants=bliss-server-{{ vm_context }}.service
5+
6+
[Service]
7+
Type=simple
8+
User={{ service_user }}
9+
Group=esrfusers
10+
WorkingDirectory={{ install_base_path }}/bliss
11+
12+
# Start command - activate conda environment and run bliss demo session
13+
ExecStart=/bin/bash -c 'HOSTNAME=$(hostname) && export BEACON_HOST=$HOSTNAME:10001 && export TANGO_HOST=$HOSTNAME:10000 && source {{ install_base_path }}/miniconda/bin/activate bliss_dev && bliss-demo-session'
14+
15+
# Give demo servers time to start
16+
ExecStartPre=/bin/sleep 10
17+
18+
# Restart policy
19+
Restart=on-failure
20+
RestartSec=15
21+
22+
# Logging
23+
StandardOutput=journal
24+
StandardError=journal
25+
SyslogIdentifier=bliss-session-{{ vm_context }}
26+
27+
[Install]
28+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)