Skip to content

Commit

Permalink
Adding some local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
clone1018 committed Feb 27, 2021
1 parent b3f8971 commit 582ae37
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 20 deletions.
61 changes: 46 additions & 15 deletions ansible/roles/glimesh-web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,38 @@
hostname:
name: "{{ inventory_hostname }}"

- name: install elixir
apt:
deb: https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb

- name: install required packages
apt:
pkg:
- esl-erlang
- elixir
- npm
- git
- openssl
- imagemagick
state: present
update_cache: yes
- name: Ensure .ssh directory exists.
file:
dest: "/root/.ssh"
mode: 0700
owner: root
state: directory

- name: Install ssh key
copy:
src: "glimesh-deploy"
dest: "/root/.ssh/id_rsa"
mode: 0600
owner: root

- name: Trust GitHub
shell: ssh-keyscan github.com >> ~/.ssh/known_hosts

# - name: install elixir
# apt:
# deb: https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb

# - name: install required packages
# apt:
# pkg:
# - esl-erlang
# - elixir
# - npm
# - git
# - openssl
# - imagemagick
# state: present
# update_cache: yes

- name: install hex
command: mix local.hex --force
Expand Down Expand Up @@ -93,6 +110,11 @@
systemd:
daemon_reload: yes

- name: gracefully shut down old glimesh app
systemd:
name: glimesh
state: stopped

# Copying the file will automatically restart the daemon.
- name: copy built glimesh.tv
command: cp -Rf /tmp/glimesh.tv/_build/prod /opt/glimesh.tv
Expand All @@ -103,7 +125,16 @@
owner: nobody
recurse: yes

- name: start new glimesh app
systemd:
name: glimesh
state: started

- name: wait for service to be online
wait_for:
port: 8080
delay: 5

- name: pause to make sure the other node can take over
pause:
seconds: 15
6 changes: 6 additions & 0 deletions ansible/roles/glimesh-web/templates/glimesh.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ Restart=on-abnormal
RestartSec=5
LimitNOFILE=65536
ExecStart=/opt/glimesh.tv/prod/rel/glimesh/bin/glimesh start
ExecStop=/opt/glimesh.tv/prod/rel/glimesh/bin/glimesh stop

Environment="HOME={{ glimesh_home }}"

Environment="RELEASE_COOKIE={{ glimesh_release_cookie }}"
Environment="RELEASE_NODE={{ glimesh_release_node }}"
Environment="RELEASE_DISTRIBUTION={{ glimesh_release_distribution }}"

Environment="ENABLE_LIBCLUSTER=true"

Environment="DATABASE_URL={{ glimesh_database_url }}"
Environment="SECRET_KEY_BASE={{ glimesh_secret_key_base }}"
Environment="LIVE_VIEW_SIGNING_SALT={{ glimesh_live_view_signing_salt }}"
Expand Down Expand Up @@ -53,5 +56,8 @@ Environment="APP_REVISION={{ glimesh_git_hash.stdout }}"
Environment="APPSIGNAL_NAME={{ appsignal_name }}"
Environment="APPSIGNAL_API_KEY={{ appsignal_api_key }}"

Environment="TAXIDPRO_API_KEY={{ glimesh_taxidpro_api_key }}"
Environment="TAXIDPRO_WEBHOOK_SECRET={{ glimesh_taxidpro_webhook_secret }}"

[Install]
WantedBy=multi-user.target
8 changes: 6 additions & 2 deletions ansible/roles/janus-ftl-plugin/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

# --buildtype=release
- name: meson janus-ftl-plugin
shell: CC=gcc-10 CXX=g++-10 meson build/
shell: CC=gcc-10 CXX=g++-10 meson build/ --buildtype=debugoptimized
args:
chdir: /tmp/janus-ftl-plugin
# when: janus_ftl_plugin.changed
Expand All @@ -175,13 +175,17 @@
command: ninja install
args:
chdir: /tmp/janus-ftl-plugin/build
notify:
- restart janus
# when: janus_ftl_plugin.changed

# Janus Service
- name: Create Unit file for janus
template: src=janus.service.j2 dest=/etc/systemd/system/janus.service mode=644
notify:
- reload systemctl
tags:
- config

- name: Start janus
service: name=janus.service state=started enabled=yes
Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/janus-ftl-plugin/templates/janus.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Environment="FTL_NODE_KIND={{ ftl_node_kind }}"
Environment="FTL_ORCHESTRATOR_HOSTNAME={{ ftl_orchestrator_hostname }}"
Environment="FTL_ORCHESTRATOR_PORT=8085"
Environment="FTL_ORCHESTRATOR_PSK={{ ftl_orchestrator_psk }}"
Environment="FTL_ORCHESTRATOR_REGION_CODE=us-east"
Environment="FTL_ORCHESTRATOR_REGION_CODE={{ region }}"

Environment="FTL_SERVICE_CONNECTION=GLIMESH"
Environment="FTL_SERVICE_METADATAREPORTINTERVALMS=10000"
Expand All @@ -25,6 +25,7 @@ Environment="FTL_SERVICE_GLIMESH_PORT=443"
Environment="FTL_SERVICE_GLIMESH_HTTPS=1"
Environment="FTL_SERVICE_GLIMESH_CLIENTID={{ glimesh_client_id }}"
Environment="FTL_SERVICE_GLIMESH_CLIENTSECRET={{ glimesh_client_secret }}"
Environment="FTL_MAX_ALLOWED_BITS_PER_SECOND=6500000"

[Install]
WantedBy=multi-user.target
6 changes: 4 additions & 2 deletions ansible/roles/monitor/templates/prometheus.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ scrape_configs:
- job_name: 'node_exporter'
scrape_interval: 5s
static_configs:
- targets:
{% for host in groups['node_exporter'] %}
{% if inventory_hostname != host %}
- '{{ host }}:9100'
- targets: ['{{ host }}:9100']
labels:
region: {{ hostvars[host].region }}
ftl_node_kind: {{ hostvars[host].ftl_node_kind }}
{% endif %}
{% endfor %}

0 comments on commit 582ae37

Please sign in to comment.