From 256ac74aa8b79247152a85ae2c35524408cb2649 Mon Sep 17 00:00:00 2001 From: "dth@taiga.ai" Date: Wed, 22 Jun 2022 23:39:14 +0200 Subject: [PATCH] :boom: :construction: wip SIS make-rules --- README.md | 2 ++ makefile | 13 +++++++++++++ server-ip-sync.md | 30 ++++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 55357c1..4f265e1 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ This repo is an extension of [dannydannydanny/methodology](https://github.com/Da * [o] configure **tmux**: * [X] remote nested sessions * [X] change tmux:pane-switching bindings from arrow keys to vim bindings +* [ ] add server-sync make-rule for ip-upload python cronjob +* [ ] add server-sync make-rule for server ip fetching (and writing...) * [ ] nvim / lvim * [ ] make-rule for setting up `$HOME/.venvs/nvim/bin/python` * [ ] make-rules for getting nvim checkhealth up to speed diff --git a/makefile b/makefile index 4ebd9dc..2c49bb8 100644 --- a/makefile +++ b/makefile @@ -47,3 +47,16 @@ setup_editorconfig: setup_nerdfonts: git clone --depth 2 https://github.com/ryanoasis/nerd-fonts/ ~/nerd-fonts cd ~/nerd-fonts && ./install.sh + +setup_server_ip_sync: + echo "Visit github to generate new token:" + echo " github.com/settings/tokens/new" + @echo "Enter github token: "; \ + read token; \ + echo "Your token is ", $$(token) + +setup_server_ip_sync_python_env: + mkdir -p ~/.venvs + python3 -m venv ~/.venvs/server_ip_sync + ~/.venvs/server_ip_sync/bin/pip install python-dotenv + echo "~/.venvs/server_ip_sync/bin/python server-ip-sync.py" >> ~/deleteme-server-in-sync.txt diff --git a/server-ip-sync.md b/server-ip-sync.md index 8bb379e..af69716 100644 --- a/server-ip-sync.md +++ b/server-ip-sync.md @@ -1,13 +1,35 @@ ## Requirements - ### Env file +Make rules: +* [.] add make rules python cronjob for servers + * [.] make `.env`: `setup_server_ip_sync_dotenv_file` + * [.] make venv and install requirements: `setup_server_ip_sync_python_env` + * [ ] add oneliner to cron `/python server-ip-sync.py --upload` + +```makefile +addcron: + CRONENTRY= + { crontab -l; echo "*/2 * * * * /usr/bin/node cronapp.js >> logfile.log" } | crontab - + +add_github_token: + echo "Visit github to generate new token:" + echo " github.com/settings/tokens/new" + @echo "Enter github token: "; \ + read token; \ + echo "Your token is ", $$(token) +``` + + +* [get token](https://github.com/settings/tokens/new) +* refernce [API description](https://docs.github.com/en/rest/gists#update-a-gist) + ```python # template .env file -token='ghp_' -gist_id='abc...123' -filename='.txt' +token='ghp_' # github token +gist_id='abc...123' # gist id +filename='' # nickname for the server (i.e iot-hub-server) ``` ### python requirements