Skip to content

Commit

Permalink
Feat: add packetbeat ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlaine committed Jan 12, 2021
1 parent 61459c5 commit b6d9cb1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
ansible-vault decrypt --vault-password-file ~/fabrique-chatbot-back/ansible/fabrique/password_file ${{ steps.env_file.outputs.value }}
mv ${{ steps.env_file.outputs.value }} ~/fabrique-chatbot-back/ansible/fabrique/.env
ansible-playbook ~/fabrique-chatbot-back/ansible/fabrique/backserver.yml --vault-password-file ~/fabrique-chatbot-back/ansible/fabrique/password_file --extra-vars 'DB_PASSWORD='"${{ steps.db_password.outputs.value }}"' USER_PASSWORD='"${{ steps.user_password.outputs.value }}"' DOMAIN='${{ steps.domain.outputs.value }}''
ansible-playbook ~/fabrique-chatbot-back/ansible/logs/elastic.yml --vault-password-file ~/fabrique-chatbot-back/ansible/fabrique/password_file --extra-vars 'USER_PASSWORD='"${{ steps.user_password.outputs.value }}"' ELASTIC_HOST='${{ secrets.ELASTIC_HOST }}' ELASTIC_USERNAME='${{ secrets.ELASTIC_USERNAME }}' ELASTIC_PASSWORD='"${{ secrets.ELASTIC_PASSWORD }}"' ELASTIC_METRICBEAT_INDEX='${{ secrets.ELASTIC_METRICBEAT_INDEX }}''
ansible-playbook ~/fabrique-chatbot-back/ansible/logs/elastic.yml --vault-password-file ~/fabrique-chatbot-back/ansible/fabrique/password_file --extra-vars 'USER_PASSWORD='"${{ steps.user_password.outputs.value }}"' ELASTIC_HOST='${{ secrets.ELASTIC_HOST }}' ELASTIC_USERNAME='${{ secrets.ELASTIC_USERNAME }}' ELASTIC_PASSWORD='"${{ secrets.ELASTIC_PASSWORD }}"' ELASTIC_METRICBEAT_INDEX='${{ secrets.ELASTIC_METRICBEAT_INDEX }}' ELASTIC_PACKETBEAT_INDEX='${{ secrets.ELASTIC_PACKETBEAT_INDEX }}''
- name: delete tmp dir
uses: appleboy/ssh-action@master
Expand Down
16 changes: 9 additions & 7 deletions ansible/logs/elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
remote_user: fab_user

vars:
# - ansible_user: "fab_user"
# - ansible_password: "{{ USER_PASSWORD }}"
- ansible_become_pass: "{{ USER_PASSWORD }}"

- name: install metricbeat
Expand All @@ -19,11 +17,15 @@
ELASTIC_USERNAME: "{{ ELASTIC_USERNAME }}"
ELASTIC_PASSWORD: "{{ ELASTIC_PASSWORD }}"
ELASTIC_METRICBEAT_INDEX: "{{ ELASTIC_METRICBEAT_INDEX }}"
#
#- name: install packetbeat
# import_playbook: packetbeat.yml
# vars:
# USER_PASSWORD: "{{ USER_PASSWORD }}"

- name: install packetbeat
import_playbook: packetbeat.yml
vars:
USER_PASSWORD: "{{ USER_PASSWORD }}"
ELASTIC_HOST: "{{ ELASTIC_HOST }}"
ELASTIC_USERNAME: "{{ ELASTIC_USERNAME }}"
ELASTIC_PASSWORD: "{{ ELASTIC_PASSWORD }}"
ELASTIC_PACKETBEAT_INDEX: "{{ ELASTIC_PACKETBEAT_INDEX }}"
#
#- name: install filebeat
# import_playbook: filebeat.yml
Expand Down
1 change: 0 additions & 1 deletion ansible/logs/metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

vars:
- ansible_user: "fab_user"
# - ansible_password: "{{ USER_PASSWORD }}"
- ansible_become_pass: "{{ USER_PASSWORD }}"
# BEATS
- beats_version: 6.8.13
Expand Down
34 changes: 14 additions & 20 deletions ansible/logs/packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

# Prerequisites: SSH access for user with password

- hosts: all
- hosts: localhost

remote_user: log_user
remote_user: fab_user

vars:
- ansible_user: "log_user"
- ansible_password: "{{ USER_PASSWORD }}"
- ansible_user: "fab_user"
- ansible_become_pass: "{{ USER_PASSWORD }}"
# BEATS
- beats_version: 7.10.1
- beats_version: 6.8.13
- beat: packetbeat
- oss_version: true
- beat_conf:
logging.to_files: true
setup.template.enabled: false
packetbeat:
interfaces.device: any
interfaces.internal_networks:
Expand All @@ -24,12 +25,6 @@
period: 30s
protocols:
- type: icmp
# - type: amqp
# ports: [ 5672 ]
# - type: cassandra
# ports: [ 9042 ]
# - type: dhcpv4
# ports: [ 67, 68 ]
- type: dns
ports: [ 53 ]
include_authorities: true
Expand All @@ -38,18 +33,10 @@
ports: [ 80, 8080, 8000, 5000, 8002, 5601 ]
- type: memcache
ports: [ 11211 ]
# - type: mysql
# ports: [ 3306,3307 ]
- type: pgsql
ports: [ 5432 ]
- type: redis
ports: [ 6379 ]
# - type: thrift
# ports: [ 9090 ]
# - type: mongodb
# ports: [ 27017 ]
# - type: nfs
# ports: [ 2049 ]
- type: tls
ports:
- 443 # HTTPS
Expand All @@ -66,7 +53,14 @@
keep_original: true
procs.enabled: false
ignore_outgoing: false
- output_conf: {"logstash":{"hosts":["127.0.0.1:5044"]}}
- output_conf: {"elasticsearch":{
"hosts":["{{ ELASTIC_HOST }}"],
"protocol": "https",
"username":"{{ ELASTIC_USERNAME }}",
"password":"{{ ELASTIC_PASSWORD }}",
"index":"{{ ELASTIC_PACKETBEAT_INDEX }}",
"ssl.enabled": true
}}

roles:
- role: elastic.beats
2 changes: 1 addition & 1 deletion back/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabrique-chatbot-back",
"version": "1.1.3",
"version": "1.1.6",
"description": "",
"author": "",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion front/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabrique-chatbot-front",
"version": "1.1.5",
"version": "1.1.6",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down

0 comments on commit b6d9cb1

Please sign in to comment.