npm install -g '52North/ckan-proxy'
ckan-proxy
uses bunyan
as the logging component. The JSON output of bunyan
can be best viewed using the bunyan
CLI tool:
npm install -g bunyan
Add a node
user:
useradd -rUmd /var/lib/node -s /bin/bash node
Create a unit file:
cat > /etc/systemd/system/ckan-proxy.service <<EOF
[Unit]
Description=CKAN Proxy Server
After=network.target
Requires=network.target
[Service]
ExecStart=/usr/bin/ckan-proxy /etc/ckan-proxy.json
User=node
Group=node
Restart=always
[Install]
WantedBy=multi-user.target
EOF
Create a minimal configuration in /etc/ckan-proxy.json
:
echo '{}' > /etc/ckan-proxy.json
Start and enable the ckan-proxy
service:
systemctl daemon-reload
systemctl enable ckan-proxy.service
systemctl start ckan-proxy.service
To view the log files (requires bunyan
):
journalctl -f -u ckan-proxy.service -o cat | bunyan
Call ckan-proxy
with the path to a JSON configuration file as the first argument. E.g. ckan-proxy /etc/ckan-proxy.json
.
{
"logging": {
"level": "info"
},
"proxy": {
"port": 9090,
"cors": {
"allowedHeaders": [
"accept",
"accept-charset",
"accept-encoding",
"accept-language",
"authorization",
"content-length",
"content-type",
"host",
"origin",
"proxy-connection",
"referer",
"user-agent",
"x-requested-with"
],
"allowedMethods": [
"HEAD",
"POST",
"GET",
"PUT",
"PATCH",
"DELETE"
]
}
},
"whitelist": {
"ckan": {
"enabled": false,
"url": "http://demo.ckan.org",
"updateInterval": 0,
"rowsPerRequest": 500
},
"domains": []
}
}
You can use bunyan
configuration options in the settings:
{
"logging": {
"level": "info",
"path": "/var/log/ckan-proxy.log",
}
}
Be aware that this module uses the cluster
module and rolling file streams are not compatible.