Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

jiankaiwang/bites

Repository files navigation

bites

Build Status

Bites project is the open source for GIS with AI image recognition for providing residents with information of snake and rabies-infected animals.

View

Desktop View

Mobile View

Start the service.

Clone the Reposiroty

cd ~
git clone https://github.com/jiankaiwang/bites.git
cd ./bites

Preparation

Add and edit the configuration file (named sysconfig.js) under path configure.

/*
 * secret information
 */
exports.sysconf = {
    "umap_version" : "0.0.1"
    , "availableLang" : "en zh_TW"
    , "defaultLang" : "zh_TW"
    , "site_description" : "Bites project is the open source for GIS with AI image recognition for providing residents with information of snake and rabies-infected animals. "
    , "error_emails_to" : "null"
    , "api_allow_host" : "localhost 127.0.0.1"
    , "use-redis": false
    , "redisServer": {
        "host": "",
        "port": 6379,
        "password": "",
        "ttl": 260
    }
};

exports.recaptcah = {
    sitekey: "(recaptcah-sitekey)",
    secretkey: "(recaptcah-secretkey)"
}

exports.googleapikey = {
    "geocoding": "(google geocoding api)"
}

// you can change between develop and operation mode
exports.env = {
    "mode": "dev"
    , "url": {
        "dev": "http://localhost:8080",
        "ops": "https://xxx.example.com"
    }
}

exports.params = {
    "rabies_history_peroid_year": 3
    , "snake_history_peroid_year": 3
    , "grid_meter": 250
}

Deployment

npm install --save
sudo npm start

Service

  • Establish the service by adding the script to /etc/systemd/system/bites.service
[Unit]
Description=bites project
After=network.target

[Service]
User=root
Group=root
ExecStart=/usr/bin/node /home/cdc/bites/app.js
Restart=always
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/cdc/bites

[Install]
WantedBy=multi-user.target

Check service status: sudo systemctl status bites.service, automatically start the service after rebooting sudo systemctl enable bites.service and start/stop the service sudo systemctl start|stop bites.service.

  • Allow nopasswd commands running the service to build in CI/CD tools (using Jenkins as ci/cd tool). Edit the file /etc/sudoers.d/90-cloud-init-users.
# jenkins example
Cmnd_Alias MYAPP_CMNDS = /bin/systemctl start bites.service, /bin/systemctl stop bites.service, /bin/systemctl restart bites.service, /usr/bin/node /home/cdc/bites/app.js
jenkins ALL=(ALL) NOPASSWD:MYAPP_CMNDS
  • shell script example to activate ci/cd
#!/bin/bash

# start the CD
cd /home/cdc/bites/cicd/
/bin/bash cd.sh jiankaiwang bites "travis-token" /home/cdc/bites

About

Bites project is the open source for GIS with AI image recognition for providing residents with information of snake and rabies-infected animals.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published