diff --git a/README.md b/README.md index 6b8f6636..91f7075b 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ Busy Beaver is an open source project where all artificats (code, Docker image, - [Docker](https://hub.docker.com/search/?type=edition&offering=community) - [Docker-Compose](https://docs.docker.com/compose/) is how we deploy to production - [watchtower](https://github.com/v2tec/watchtower) (monitors DockerHub, downloads and deploys latest image) -- [Ansible](https://www.ansible.com/) - [DigitalOcean](https://www.digitalocean.com) ### Services @@ -87,7 +86,7 @@ We are grateful to the following organizations for providing free services to op ### API Docs -Can make requests to REST endpoints to kick off processes. Currently we are using CRON to run repetitive tasks; [this is managed by Ansible](https://github.com/alysivji/busy-beaver/blob/master/ansible/roles/cron/tasks/main.yml) to avoid manual configuration. +Can make requests to REST endpoints to kick off processes. #### GitHub Summary Endpoint diff --git a/ansible/README.md b/ansible/README.md deleted file mode 100644 index c6001701..00000000 --- a/ansible/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Busy Beaver Ansible Playbooks - -This folder contains Ansible configuration settings to deploy Busy Beaver on a VPS. - -## `~/.bash_profile` - -```bash -export POSTGRES_USER=[do-console] -export POSTGRES_PASSWORD=[do-console] -export POSTGRES_HOST=[do-console--public] -export POSTGRES_PORT=[do-console] -export POSTGRES_DATABASE=[do-console] -export DATABASE_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}?sslmode=require -export REDIS_URI=redis://redis:6379 - -export SECRET_KEY=[secret-key] - -# clients -export BUSY_BEAVER_API_TOKEN=[bb-api-token] - -export GITHUB_APP_CLIENT_ID=[client-id] -export GITHUB_APP_CLIENT_SECRET=[client-secret] -export GITHUB_OAUTH_TOKEN=[token-here] -export GITHUB_SIGNING_SECRET=[signing-secret] - -export MEETUP_API_KEY=[meetup-api-key] - -export SLACK_CLIENT_ID=[client-id] -export SLACK_CLIENT_SECRET=[client-secret] -export SLACK_BOTUSER_OAUTH_TOKEN=[token-here] -export SLACK_SIGNING_SECRET=[signing-secret] - -export TWITTER_CONSUMER_KEY=[] -export TWITTER_CONSUMER_SECRET=[] -export TWITTER_ACCESS_TOKEN=[] -export TWITTER_ACCESS_TOKEN_SECRET=[] - -export YOUTUBE_API_KEY=[] -export YOUTUBE_CHANNEL=[] - -export BUSYBEAVER_SENTRY_DSN=[sentry-dsn] -export BUSYBEAVER_LOGGLY_TOKEN=[api-key] -``` - -## Deployment Workflow - -1. Set environment variables in Ansible control environment: `HEALTHCHECK_GITHUB_SUMMARY_CHIPY`, `HEALTHCHECK_GITHUB_SUMMARY_BELGRADE`, `HEALTHCHECK_TWITTER_POLLER`, `HEALTHCHECK_SYNC_EVENTS_DATABASE`, `HEALTHCHECK_POST_UPCOMING_EVENTS`; grab uuid values from healthchecks.io -1. `pip install ansible` installed the machine you will be deploying from -1. Check to see what the ansible playbook would do, we can run `ansible-playbook -i ./hosts site.yml --ask-sudo-pass -C` -1. Remove `-C` option to run playbook to deploy app diff --git a/ansible/group_vars/all b/ansible/group_vars/all deleted file mode 100644 index 433e5ea2..00000000 --- a/ansible/group_vars/all +++ /dev/null @@ -1,5 +0,0 @@ -group: alysivji -user: alysivji - -app_name: busy-beaver -app_dir: "/home/{{ user }}/{{ app_name }}" diff --git a/ansible/hosts b/ansible/hosts deleted file mode 100644 index 5eb7ca48..00000000 --- a/ansible/hosts +++ /dev/null @@ -1,2 +0,0 @@ -[deploy] -sivji.com ansible_python_interpreter=/usr/bin/python3 diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml deleted file mode 100644 index 3b54dc07..00000000 --- a/ansible/roles/common/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: ensure Git is installed - apt: - name: git - state: present - update_cache: yes - become: yes - -- name: clone or pull latest code - git: - repo: "{{ code_repository }}" - dest: "{{ app_dir }}" - -# TODO: create and start systemd service diff --git a/ansible/roles/common/vars/main.yml b/ansible/roles/common/vars/main.yml deleted file mode 100644 index fc7ac019..00000000 --- a/ansible/roles/common/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -code_repository: https://github.com/busy-beaver-dev/busy-beaver.git diff --git a/ansible/roles/cron/tasks/main.yml b/ansible/roles/cron/tasks/main.yml deleted file mode 100644 index 899142a3..00000000 --- a/ansible/roles/cron/tasks/main.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- cron: - name: Post GitHub summary - user: "{{ user }}" - state: absent - minute: 0 - hour: 19 - job: "/bin/bash {{ run_summary_chipy }} && curl -fsS --retry 3 https://hc-ping.com/{{ lookup('env', 'HEALTHCHECK_GITHUB_SUMMARY_CHIPY') }} > /dev/null" - -- cron: - name: Post GitHub summary for Python Belgrade - user: "{{ user }}" - state: absent - minute: 0 - hour: 8 - job: "/bin/bash {{ run_summary_belgrade }} && curl -fsS --retry 3 https://hc-ping.com/{{ lookup('env', 'HEALTHCHECK_GITHUB_SUMMARY_BELGRADE') }} > /dev/null" - -- cron: - name: Run Twitter poller to retweet new posts to Slack - user: "{{ user }}" - state: absent - minute: "*/13" - job: "/bin/bash {{ twitter_poller }} && curl -fsS --retry 3 https://hc-ping.com/{{ lookup('env', 'HEALTHCHECK_TWITTER_POLLER') }} > /dev/null" - -- cron: - name: Backup database and upload to S3 - user: "{{ user }}" - state: absent - minute: 30 - hour: "*/6" - job: "/bin/bash {{ db_backup }}" - -- cron: - name: Run Update Events poller to add new events to database - user: "{{ user }}" - state: absent - minute: 0 - hour: 0 - job: "/bin/bash {{ events_poller }} && curl -fsS --retry 3 https://hc-ping.com/{{ lookup('env', 'HEALTHCHECK_SYNC_EVENTS_DATABASE') }} > /dev/null" - -- cron: - name: Post Upcoming Events in announcements channel - user: "{{ user }}" - state: absent - minute: 0 - hour: 14 - weekday: 1 - job: "/bin/bash {{ upcoming_events }} && curl -fsS --retry 3 https://hc-ping.com/{{ lookup('env', 'HEALTHCHECK_POST_UPCOMING_EVENTS') }} > /dev/null" diff --git a/ansible/roles/cron/vars/main.yml b/ansible/roles/cron/vars/main.yml deleted file mode 100644 index e293ddc3..00000000 --- a/ansible/roles/cron/vars/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -run_summary_chipy: "{{ app_dir }}/scripts/prod/run_github_summary_chipy.sh" -run_summary_belgrade: "{{ app_dir }}/scripts/prod/run_github_summary_belgrade.sh" -twitter_poller: "{{ app_dir }}/scripts/prod/twitter_poller.sh" -db_backup: "{{ app_dir }}/scripts/database/backup_db_to_s3.sh" -events_poller: "{{ app_dir }}/scripts/prod/events_poller.sh" -upcoming_events: "{{ app_dir }}/scripts/prod/post_upcoming_events.sh" diff --git a/ansible/site.yml b/ansible/site.yml deleted file mode 100644 index c6f99f11..00000000 --- a/ansible/site.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: deploy app to server and setup daily cron job to post summary - hosts: all - user: "{{ user }}" - roles: - - common - - cron diff --git a/scripts/prod/README.md b/scripts/prod/README.md deleted file mode 100644 index dc08e792..00000000 --- a/scripts/prod/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Busy Beaver Production Scripts - -## Contents - -### `run_github_summary_report.sh` - -Script that posts daily Summary Reports on Slack. This script is configured to run via a CRON job at 19:00 UTC everyday. CRON job has been documented in ansible configuration. - -### `twitter_poller.sh` - -Script that polls `@ChicagoPython` on Twitter to find tweets to publish to Slack. Posts tweets one at a time. - -### `events_poller.sh` - -Script that polls `_ChiPy_` on Meetup to find new events that can be added to the database. Runs once a day. diff --git a/scripts/prod/events_poller.sh b/scripts/prod/events_poller.sh deleted file mode 100755 index da29e862..00000000 --- a/scripts/prod/events_poller.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -source $HOME/.bash_profile - -curl https://busybeaver.sivji.com/poll/sync-event-database \ - -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${BUSY_BEAVER_API_TOKEN}" diff --git a/scripts/prod/post_upcoming_events.sh b/scripts/prod/post_upcoming_events.sh deleted file mode 100755 index 6617d716..00000000 --- a/scripts/prod/post_upcoming_events.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -source $HOME/.bash_profile - -curl https://busybeaver.sivji.com/poll/upcoming-events \ - -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${BUSY_BEAVER_API_TOKEN}" \ - -d '{"channel": "announcements"}' diff --git a/scripts/prod/run_github_summary_belgrade.sh b/scripts/prod/run_github_summary_belgrade.sh deleted file mode 100644 index 3d4fefdd..00000000 --- a/scripts/prod/run_github_summary_belgrade.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -source $HOME/.bash_profile - -curl https://busybeaver.sivji.com/poll/github-summary \ - -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${BUSY_BEAVER_API_TOKEN}" \ - -d '{"workspace_id": "T0GDKACHE"}' diff --git a/scripts/prod/run_github_summary_chipy.sh b/scripts/prod/run_github_summary_chipy.sh deleted file mode 100755 index 5ecea49d..00000000 --- a/scripts/prod/run_github_summary_chipy.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -source $HOME/.bash_profile - -curl https://busybeaver.sivji.com/poll/github-summary \ - -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${BUSY_BEAVER_API_TOKEN}" \ - -d '{"workspace_id": "T093FC1RC"}' diff --git a/scripts/prod/twitter_poller.sh b/scripts/prod/twitter_poller.sh deleted file mode 100755 index 782b5d40..00000000 --- a/scripts/prod/twitter_poller.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -source $HOME/.bash_profile - -curl https://busybeaver.sivji.com/poll/twitter \ - -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${BUSY_BEAVER_API_TOKEN}" \ - -d '{"channel": "at-chicagopython"}'