Coder Social home page Coder Social logo

shoppingbot's Introduction

A ShoppingBot on Line Platform

How To Run Service

進入工作資料夾

cd shoppingbot

建立 Bot Server 的 Image

sudo docker build -t="bot" .

開啟 Service(背景執行)

sudo docker-compose up -d

How to Get SSL Certificate

必須要有 Domain Name 才能申請,因為 Line 需要第三方認證的SSL,若不需要可以考慮使用 openssl 就沒有 Domain Name 的限制

Step 1 - Download certbot

Reference : https://certbot.eff.org/

Step 2 - Create Configuration

example.com 是 Domain Name

sudo mkdir /etc/letsencrypt/configs
sudo vim /etc/letsencrypt/configs/example.com.conf

example.com.conf

Reference : https://certbot.eff.org/docs/using.html#certbot-command-line-options

domains = example.com
email = [email protected]
rsa-key-size = 2048
text = True


authenticator = standalone //有其他模式可以選,standalone mode 是在我們沒有用 nginx, apache 等架站軟體時使用的模式

Step3 - Create Certificate

記得先將防火牆 80 port 開啟,因為certbot需要透過 80 port 自己開啟連結來確認 Domain Name 是否屬於這台機器,因此要在真正使用這個 Domain Name 的機器上註冊

sudo certbot -c /etc/letsencrypt/configs/example.com.conf certonly

完成後即可在 /etc/letsencrypt/live/example.com/ 下看到證書 若不能進入資料夾,要先將資料夾權限更改

sudo chmod 755 /etc/letsencrypt/live/

Step4 - Copy Certificate

cp /etc/letsencrypt/live/example.com/fullchain.pem shoppingbot/app/cert.pem
cp /etc/letsencrypt/live/example.com/privatekey.pem shoppingbot/app/key.pem

完成後記得將 /etc/letsencrypt/live/example.com/ 權限設定回去

sudo chmod 700 /etc/letsencrypt/live/

Step5 - Auto Renew Certificate

因為 Certbot 的證書只有 3個月 因此要設定自動更新

sudo crontab -e

輸入

* * * * */2 /bin/sh route/shoppingbot/app/update_certificate.sh (route 替換為放 shopping 的路徑)

shoppingbot's People

Contributors

apie0419 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.