GithubHelp home page GithubHelp logo

mikeyhodl / corona_cases Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bost/corona_cases

0.0 1.0 0.0 59.15 MB

🦠 Coronavirus Information on Telegram Chatbot

Home Page: https://t.me/corona_cases_bot

Shell 3.14% Clojure 96.43% HTML 0.34% Emacs Lisp 0.10%

corona_cases's Introduction

Coronavirus disease 2019 (COVID-19) information on Telegram Messenger @corona_cases_bot

Raison d´être

The Internet interprets censorship as damage and routes around it.

  • John Gilmore

Screenshot Screenshot

Setup environment

Install

sudo apt install postgresql postgresql-contrib
sudo systemctl status postgresql.service
sudo systemctl stop postgresql.service
# set --export PATH /usr/lib/postgresql/*/bin $PATH
initdb pg
sudo chown --recursive postgres:postgres pg/
sudo chmod --recursive u=rwx,g=---,o=--- pg/
sudo -su postgres
fish # start he fish-shell for the postgres user
set --export PATH /usr/lib/postgresql/*/bin $PATH
postgres -D pg &   # this doesn't work: pg_ctl -D pg -l logfile start

Open new console and log in

psql --dbname=postgres
\conninfo
-- list databases:
\l
\l+
SELECT datname FROM pg_database;

Create

Configure

  • Local environment variables. Create .env file in your project root directory:
$ touch .env

containing:

# Value must be lower-cased, without the "" chars
CORONA_ENV_TYPE=devel
#
# https://clojure.org/guides/getting_started#_installation_on_linux
# See also `.heroku-local.env` and the output of `clojure --help | grep Version`
CLOJURE_CLI_VERSION=1.10.1.763
#
# HEROKU tokens for:
PAPERTRAIL_API_TOKEN=<...>
TELEGRAM_TOKEN="<...>"
$ heroku config --app <YOUR-HEROKU-APP-NAME>
CLOJURE_CLI_VERSION:  1.10.1.763
COMMIT:               ...
CORONA_ENV_TYPE:      HOKUSPOKUS
PAPERTRAIL_API_TOKEN: ...
REPL_PASSWORD:        ...
REPL_USER:            ...
TELEGRAM_TOKEN:       ...

Develop

  1. Start the coronavirus-tracker-api:
$ pipenv run start
  1. In Emacs Cider M-x cider-jack-in-clj, or start the nREPL from the command line:
$ clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"} cider/cider-nrepl {:mvn/version "0.25.5"}}}' -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"]'

and connect to it from the editor of your choice.

  1. Start the telegram chatbot long-polling:
user> (require '[corona.telegram])
user> (corona.telegram/start)
  1. Start the web server:
user> (require '[corona.web])
user> (alter-var-root #'system component/start)

and check the http://localhost:5050/ if it's running.

Run locally

$ bin/build; and heroku local --env=.heroku-local.env
# or:
# bin/build; and heroku local --env=.heroku-local.env --set COMMIT=...

Deploy to Heroku

$ bb heroku.clj deploy --heroku-env <YOUR-HEROKU-APP-NAME>

MySQL -> PostgreSQL script conversion

psql --dbname=postgres -a -f dbase/postgres.sql
psql --dbname=postgres -q -a -f dbase/postgres.sql | rg "ERROR\|NOTICE|WARN"
# psql --dbname=postgres -q -a -f dbase/drop-everything.sql
psql --dbname=postgres
\dt  -- list tables
\ds  -- list sequences
\di  -- list indices

Others

heroku pt ":type -'ssl-client-cert' -'$MY_TELEGRAM_ID'" --app <YOUR-HEROKU-APP-NAME> | grep -v -e '^[[:space:]]*$

corona_cases's People

Contributors

bost avatar bostx avatar daveliepmann avatar jkutner avatar jonmountjoy avatar mikeyhodl avatar technomancy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.