|
|
|
## CAPI-STIS-Web ##
|
|
|
|
|
|
|
|
*CAPI-STIS-Web is an Enketo Express application development that aims to be a Web-based CAPI client application*
|
|
|
|
|
|
|
|
### Installation ###
|
|
|
|
|
|
|
|
*To use CAPI-STIS-Web, install Enketo Express and insert a folder from respository into the application*
|
|
|
|
|
|
|
|
*Installing an Enketo Express application can be followed in the following url:* https://blog.enketo.org/install-enketo-production-ubuntu/
|
|
|
|
|
|
|
|
Complete Installation Stages As Below:
|
|
|
|
|
|
|
|
**Installation on server (ubuntu-server)**
|
|
|
|
|
|
|
|
1. Install the first batch of software packages as follows and enter Y when asked to confirm :
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo add-apt-repository -y ppa:chris-lea/redis-server
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get upgrade -y
|
|
|
|
sudo apt-get install -y git nginx htop build-essential redis-server checkinstall python
|
|
|
|
```
|
|
|
|
1. Install NodeJS and global Node packages
|
|
|
|
|
|
|
|
```
|
|
|
|
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
|
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
sudo npm install -g grunt-cli pm2
|
|
|
|
```
|
|
|
|
1. Install Enketo Express
|
|
|
|
|
|
|
|
```
|
|
|
|
cd ~
|
|
|
|
git clone https://github.com/enketo/enketo-express.git
|
|
|
|
cd enketo-express
|
|
|
|
npm install --production
|
|
|
|
```
|
|
|
|
1. Configure Redis
|
|
|
|
|
|
|
|
Configure 2 redis instances that run on different ports :
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo systemctl stop redis
|
|
|
|
sudo mv /etc/redis/redis.conf /etc/redis/redis-origin.conf
|
|
|
|
sudo cp ~/enketo-express/setup/redis/conf/redis-enketo-main.conf /etc/redis/
|
|
|
|
sudo cp ~/enketo-express/setup/redis/conf/redis-enketo-cache.conf /etc/redis/
|
|
|
|
sudo cp ~/enketo-express/setup/redis/systemd/system/* /etc/systemd/system/
|
|
|
|
```
|
|
|
|
Start the 2 redis instances :
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo systemctl disable redis
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl start redis@redis-enketo-main
|
|
|
|
sudo systemctl enable redis@redis-enketo-main
|
|
|
|
sudo systemctl start redis@redis-enketo-cache
|
|
|
|
sudo systemctl enable redis@redis-enketo-cache
|
|
|
|
```
|
|
|
|
Test: Redis database
|
|
|
|
|
|
|
|
```
|
|
|
|
redis-cli -p 6380
|
|
|
|
ping
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
redis-cli -p 6379
|
|
|
|
ping
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
The response to both tests should be: “PONG”.
|
|
|
|
1. Configure Enketo
|
|
|
|
|
|
|
|
```
|
|
|
|
cp ~/enketo-express/config/default-config.json ~/enketo-express/config/config.json
|
|
|
|
nano ~/enketo-express/config/config.json
|
|
|
|
```
|
|
|
|
The default configuration is almost functional. We just need to create a secret API key and encryption key. is easiest to just set the server url to "" for now. So the minimum configuration items to change are:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
...
|
|
|
|
"linked form and data server": {
|
|
|
|
"name": "My Aggregate",
|
|
|
|
"server url": "",
|
|
|
|
"api key": "EERTIUCJSHDGKHD234325",
|
|
|
|
...
|
|
|
|
},
|
|
|
|
"encryption key": "a34sgfj324113413y",
|
|
|
|
"less secure encryption key": "b542sdf32dabdery"
|
|
|
|
...
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Build :
|
|
|
|
|
|
|
|
```
|
|
|
|
cd ~/enketo-express
|
|
|
|
grunt
|
|
|
|
```
|
|
|
|
|
|
|
|
1. Copy file from repository
|
|
|
|
|
|
|
|
1. Copy and replace files in the app-controller folder to enketo-express/app/controller directory
|
|
|
|
|
|
|
|
in web-authentication-controller.js
|
|
|
|
|
|
|
|
```
|
|
|
|
var odkurl = 'http://192.168.165.4:3000';
|
|
|
|
var odkrealm = ':ODK Aggregate VM 1.4.12.0:';
|
|
|
|
```
|
|
|
|
change the odkurl to your [ODK API] (https://git.stis.ac.id/14.7977/odk-api) ip address and change the realm accordingly
|
|
|
|
|
|
|
|
in web-request-controller.js
|
|
|
|
|
|
|
|
```
|
|
|
|
var odk_url = 'http://192.168.165.4';
|
|
|
|
var enketo_url = 'http://192.168.165.6:8005/api/v2/';
|
|
|
|
```
|
|
|
|
|
|
|
|
change the odk_url to your [ODK API] (https://git.stis.ac.id/14.7977/odk-api) ip address and change enketo_url to the enketo-express you've just installed
|
|
|
|
|
|
|
|
1. Copy and replace files in the app-views-web folder to enketo-express/app/views/web directory
|
|
|
|
|
|
|
|
1. Copy and replace files in the public-js folder to enketo-express/public/js directory
|
|
|
|
|
|
|
|
1. Copy and replace files in the public-web folder to enketo-express/public/web directory
|
|
|
|
|
|
|
|
1. Start the application
|
|
|
|
|
|
|
|
```
|
|
|
|
npm start
|
|
|
|
```
|
|
|
|
|
|
|
|
go to http://ip_address:8005/web/home |
|
|
|
\ No newline at end of file |