Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hiromaily/go-book-teacher
booking teacher for English lesson
https://github.com/hiromaily/go-book-teacher
docker golang homebrew redis slack travis-ci
Last synced: 14 days ago
JSON representation
booking teacher for English lesson
- Host: GitHub
- URL: https://github.com/hiromaily/go-book-teacher
- Owner: hiromaily
- License: mit
- Created: 2015-10-12T11:29:10.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T01:23:24.000Z (over 1 year ago)
- Last Synced: 2024-10-04T21:43:59.748Z (about 1 month ago)
- Topics: docker, golang, homebrew, redis, slack, travis-ci
- Language: Go
- Homepage:
- Size: 630 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-book-teacher
[![Build Status](https://travis-ci.org/hiromaily/go-book-teacher.svg?branch=master)](https://travis-ci.org/hiromaily/go-book-teacher)
[![Coverage Status](https://coveralls.io/repos/github/hiromaily/go-book-teacher/badge.svg)](https://coveralls.io/github/hiromaily/go-book-teacher)
[![Go Report Card](https://goreportcard.com/badge/github.com/hiromaily/go-book-teacher)](https://goreportcard.com/report/github.com/hiromaily/go-book-teacher)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/hiromaily/go-book-teacher/master/LICENSE)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hiromaily/go-book-teacher)Go-book-teacher is notifier for that specific teachers are available on English lesson service.
For now, only [DMM eikaiwa](https://eikaiwa.dmm.com/) is expected.This project has started since 2016 to study Golang and code is quite messy. Now it's under refactoring.
#### Console
```
----------- Rita M / Portugal / 7093 -----------
----------- Gagga / Serbia / 5252 -----------
----------- Kaytee / Serbia / 7646 -----------
----------- Milica J / Serbia / 6294 -----------
----------- Marine / France / 8519 -----------
----------- Lavinija / Serbia / 5656 -----------
2017-07-06 20:30:00
2017-07-07 16:00:00
2017-07-07 18:00:00
2017-07-07 18:30:00
----------- Aleksandra S / Serbia / 6214 -----------
----------- Jekica / Serbia / 4806 -----------
----------- Yovana / Serbia / 6550 -----------
2017-07-07 03:30:00
2017-07-07 04:00:00
2017-07-07 04:30:00
----------- Olivera V / Serbia / 5380 -----------
----------- Emilia / Serbia / 2464 -----------
----------- Indre / Lithuania / 3486 -----------
----------- Joxyly / Serbia / 4808 -----------
----------- Milica Ml / Serbia / 4107 -----------
```#### Slack
![slack](https://raw.githubusercontent.com/hiromaily/go-book-teacher/master/images/slack_image.png)## Requirements
- Golang 1.15+
- Docker compose
- Redis
- [direnv](https://github.com/direnv/direnv) for MacOS user## Installation
### for MacOS user
```
$ brew install hiromaily/tap/go-book-teacher#
# config file is installed in /usr/local/etc/book-teacher/book-teacher.toml
# modify `book-teacher.toml` if settings wanna be changed
#
# json file is installed in /usr/local/etc/book-teacher/book-teacher.json
# add your teacher's ID/Name/Nationality to `book-teacher.json`# run
$ book-teacher
```### for development
```
# clone
$ git clone https://github.com/hiromaily/go-book-teacher.git# setup config file
$ cp configs/default.example.toml configs/default.toml
# and modify `configs/default.toml` as you want# setup your favorite teacher's information
$ cp configs/teacher/default.example.json configs/teacher/default.json
# and modify `configs/teacher/default.json` as you want# setup .envrc
$ cp example.envrc .envrc
# and modify `.envrc` as you want# build
$ make build# run
book
```## Usage
```
Usage: book [options...]Options:
-json Json file path for teacher information
-toml Toml file path for config
-day range of schedule to get teacher's availability: 0: all day, 1:today, 2: tomorrow
-v show versione.g.
$ book -day 1
$ book -h # show help
```## Environment valuables
- envrc is used for MacOS user, please install direnv](https://github.com/direnv/direnv)
- encryption is used for secret value in config files.
- secret value can be encrypted/decrypted by tools (see Makefile)```Makefile
.PHONY: tool-encode
tool-encode:
go run ./tools/encryption/ -encode important-password.PHONY: tool-decode
tool-decode:
go run ./tools/encryption/ -decode o5PDC2aLqoYxhY9+mL0W/IdG+rTTH0FWPUT4u1XBzko=
```| NAME | Value |
|:------------------|:----------------------------------------------|
| GO_BOOK_CONF | default config file path |
| GO_BOOK_JSON | default teacher info json file path |
| ENC_KEY | 16byte_string_xx |
| ENC_IV | 16byte_string_xx |## deploy on heroku
### modification in go.mod
add +heroku goVersion go1.x
```
// +heroku goVersion go1.15
go 1.15
```### install
[Heroku Buildpack for Go](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-go)```
#
$ heroku create book-teacher --buildpack https://github.com/heroku/heroku-buildpack-go.git
$ heroku addons:create heroku-redis:hobby-dev
$ heroku addons:create scheduler:standard## Environment variable
$ heroku config:add 'ENC_KEY=xxxxxxxxxxxxxxxx'
$ heroku config:add 'ENC_IV=xxxxxxxxxxxxxxxx'
$ heroku config:add GO_BOOK_CONF=/app/configs/heroku.toml
$ heroku config:add GO_BOOK_JSON=/app/configs/teacher/default.example.json
```### deploy
```
$ git push heroku master
```### get information
1. access to dashboard `https://dashboard.heroku.com/apps`
2. click app `book-teacher`
3. redis status
```
$ heroku addons | grep heroku-redis
$ heroku redis:cli --confirm book-teacher
```
3. show config info
```
$ heroku config
```
4. execute
```
$ heroku run book -toml /app/configs/heroku.toml
```
5. show logs
```
heroku logs -t
```
6. instance info
```
heroku ps
```