Skip to content
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

Write ansible role for ooni-collector #164

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions ansible/roles/ooni-collector/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: reload nginx
service: name=nginx state=reloaded
33 changes: 33 additions & 0 deletions ansible/roles/ooni-collector/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

# FIXME: do we _really_ need nginx in front of the collector?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question 1: do we really need nginx in front of the collector?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove it for the time being as we haven't tried the deployment this way and stuff may break.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

- template: src=ngx-ooni-backend-web dest=/etc/nginx/sites-enabled/ooni-backend-web
notify: reload nginx

# FIXME what is this? Do we need this for the collector?!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question 2 What is this? Is this the configuration of the container network? Is this something we need for deploying the ooni collector role or is that something we can skip in this context?

- name: docker network for backend
docker_network:
name: msm
driver_options:
com.docker.network.bridge.name: brmsm
ipam_options:
subnet: 172.25.232.0/24
gateway: 172.25.232.1

# FIXME this is not the correct procedure to start it up
# at the moment this is copied from ooni-measurements
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Figure out the correct procedure to start up oonib

- name: ooni-backend webservice
docker_container:
image: openobservatory/ooni-measurements:{{ ooni_backend_tag }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is actually not the correct docker container in here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is copied and pasted from the other file you gave me and needs updating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(So, now we use docker images for services? I guess this would make things simpler a great deal, but it was not the case when I looked into proteus deployment, so I didn't understood this bit.)

name: ooni_backend-web
hostname: ooni_backend-web
networks: [{name: msm, ipv4_address: '{{ ooni_backend_backend_ipv4 }}'}]
purge_networks: true
env:
APP_ENV: production
PRODUCTION: 'TRUE' # FIXME: is it ever used?
DATABASE_URL: 'postgresql://ooni_backend-beta:{{ ooni_backend_beta_postgres_password }}@hkgmetadb.infra.ooni.io/metadb' # FIXME: ?sslmode=require
AUTOCLAVED_BASE_URL: 'http://datacollector.infra.ooni.io/ooni-public/autoclaved/' # FIXME: use dataproxy when API moves to AMS
command: gunicorn --bind 0.0.0.0:{{ ooni_backend_backend_port }} --workers 4 --timeout 30 measurements.wsgi
user: "{{ passwd.ooni_backendweb.id }}:{{ passwd.ooni_backendweb.id }}"
restart_policy: unless-stopped
34 changes: 34 additions & 0 deletions ansible/roles/ooni-collector/templates/ngx-ooni-backend-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ansible-managed in ooni-sysadmin.git
# FIXME: copied from ooni-measurements... wondering whether we need it...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If we need nginx, figure out what to put inside here


server {
listen 80;
listen 443 ssl spdy;

keepalive_timeout 120 120; # http://kb.mozillazine.org/Network.http.keep-alive.timeout
ssl_certificate /etc/letsencrypt/live/{{ ooni_backend_domain }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ ooni_backend_domain }}/privkey.pem;
# FIXME: add ssl_dhparam /etc/nginx/ssl/dhparam.pem;

ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers kEECDH+AESGCM+AES128:kEECDH+AES128:kRSA+AESGCM+AES128:kRSA+AES128:DES-CBC3-SHA:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;

ssl_session_cache shared:SSL:8m;
ssl_session_timeout 28h;

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/{{ ooni_backend_domain }}/chain.pem;

# FIXME: nginx/1.4.6 knows nothing about ssl_session_tickets

server_name {{ ooni_backend_domain }};
access_log /var/log/nginx/{{ ooni_backend_domain }}.access.log; # FIXME: log_format
error_log /var/log/nginx/{{ ooni_backend_domain }}.error.log;

location / {
proxy_pass http://{{ ooni_backend_backend_ipv4 }}:{{ ooni_backend_backend_port }};
include proxy_params;
}
}
2 changes: 2 additions & 0 deletions ansible/roles/ooni-collector/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ooni_backend_tag: "v1.3.4"