mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
---
|
|
- name: Start node docker containers
|
|
become: yes
|
|
docker_container:
|
|
name: "{{ item.container_name }}"
|
|
image: newsblur/newsblur_node
|
|
state: started
|
|
command: "{{ item.command }}"
|
|
pull: true
|
|
ports:
|
|
- "{{ item.ports }}"
|
|
env:
|
|
NODE_ENV: "docker"
|
|
restart_policy: unless-stopped
|
|
volumes:
|
|
- /srv/newsblur/node:/usr/src/app
|
|
with_items:
|
|
- container_name: node_websocket
|
|
ports: 8888:8888
|
|
command: node unread_counts.js
|
|
target_host: 'node-socket'
|
|
- container_name: 'original_pages'
|
|
ports: '3060:3060'
|
|
command: 'node original_page.js'
|
|
target_host: 'node_page'
|
|
- container_name: 'original_text'
|
|
ports: '4040:4040'
|
|
command: 'node original_text.js'
|
|
target_host: 'node_text'
|
|
- container_name: 'favicons'
|
|
ports: '3030:3030'
|
|
command: 'node favicons.js'
|
|
target_host: 'node-favicons'
|
|
when: "'{{item.target_host}}' in ansible_hostname"
|
|
|
|
|
|
- name: Register nodes in consul
|
|
become: yes
|
|
template:
|
|
src: consul_service.json
|
|
dest: /etc/consul.d/{{item.target_host}}.json
|
|
|
|
with_items:
|
|
- port: 8888
|
|
target_host: 'node-socket'
|
|
- port: 3060
|
|
target_host: 'node-page'
|
|
- port: 4040
|
|
target_host: 'node-text'
|
|
- port: 3030
|
|
target_host: 'node-favicons'
|
|
notify:
|
|
- reload consul
|
|
when: "'{{item.target_host}}' in ansible_hostname"
|