Skip to content
Bites project is the open source for GIS with AI image recognition for providing residents with information of snake and rabies-infected animals.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings
cicd
configure
controllers
public
routes
test
views
.gitignore
.jshintrc
.project
.tern-project
.travis.yml
LICENSE.txt
README.md
app.js
changlog.md
package-lock.json
package.json

README.md

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
You can’t perform that action at this time.