Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 5.73 KB

proxy.md

File metadata and controls

76 lines (58 loc) · 5.73 KB

Deploy Foulkon Proxy

You have to specify configuration file using flag -proxy-file. Using binary file command is proxy -proxy-file=/path/proxy_config.toml

Deploy with docker

Then, you can run the docker image, mounting (-v) a proxy_config.toml inside the container (you could also make a custom Dockerfile with "ADD my-custom-proxy-config.toml /proxy.toml"). E.g.

docker run -v /home/myuser/foulkon/proxy_config.toml:/proxy.toml tecsisa/foulkon proxy

Proxy configuration file

This config file is a TOML file that has several parts:

[server]

Server Server config properties Values Default Optional
host Proxy's hostname. localhost No
port Proxy's port. 8001 No
certfile Absolute path for public certificate. /etc/secrets/public.pem Yes
keyfile Absolute path for private key. /etc/secrets/private.pem Yes
worker-host Full host where worker is. http://localhost:8000 No
proxy_flush_interval Reverse proxy time to flush data to clients in remote calls (useful in data streaming) 1s 500ms yes

Note: Don't use Foulkon proxy without certificate in production.

[logger]

Logger Logger configuration properties. Values Default Optional
type Type of logger to use. file, default default Yes
level Log level. debug, info, warning, error, fatal, panic info Yes
dir Full path where log file is. It won't be autogenerated. /tmp/foulkon.log No if logger type is file

[database]

Database Database configuration Values Default Optional
type Database backend type postgres No

[database.postgres]

PostgreSQL PostgreSQL configuration properties Values Default Optional
datasourcename Connection datasource including user, password and database. postgres://foulkon:password@localhost:5432/foulkondb?sslmode=disable No
idleconns Idle connection number. 10 5 Yes
maxopenconns Max open connection number. 20 20 Yes
connttl Timeout for conenctions 200 300 Yes

[resources]

Resource Resource configuration Values Default Optional
refresh Resources refresh time. 1s,1m,1h,1ms 10s Yes

Note: All parameters except refresh time are mandatory.

Resources

The proxy reads resources from database according to refresh time assigned.

If you want to add resources you have to use the Proxy Resource API

Resources Resources managed by proxy Values
id Unique identifier for this resource. my-resource-id
host Scheme + registered name (hostname) or IP address. https://my-resource-server/
path Relative path for destination host. /get
method HTTP verb. GET
urn URN representation for this resource. urn:ews:example:instance1:resource/get
action Action related to this resource. example:get

If proxy has read correctly the resources, we should see this:

{"level":"info","msg":"Server running in localhost:8001","time":"2017-01-12T09:41:53+01:00"}
{"level":"info","msg":"Updating resources ...","time":"2017-01-12T09:42:53+01:00"}