Skip to content

52North/ckan-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CKAN CORS Proxy

Installation

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

systemd

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

Configuration

Call ckan-proxy with the path to a JSON configuration file as the first argument. E.g. ckan-proxy /etc/ckan-proxy.json.

Default Configuration Options

{
  "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": []
  }
}

Logging

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published