mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fn-prefix everything (#545)
* Fn-prefix everything Closes: #492 * Global replacement * missed one fn_
This commit is contained in:
committed by
Chad Arimura
parent
64997ed0fe
commit
5c68a88599
4
Makefile
4
Makefile
@@ -39,7 +39,7 @@ docker-build:
|
|||||||
docker build --build-arg HTTPS_PROXY --build-arg HTTP_PROXY -t fnproject/fnserver:latest .
|
docker build --build-arg HTTPS_PROXY --build-arg HTTP_PROXY -t fnproject/fnserver:latest .
|
||||||
|
|
||||||
docker-run: docker-build
|
docker-run: docker-build
|
||||||
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 fnproject/fnserver
|
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e FN_LOG_LEVEL=debug -e "FN_DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 fnproject/fnserver
|
||||||
|
|
||||||
docker-test-run-with-sqlite3:
|
docker-test-run-with-sqlite3:
|
||||||
./api_test.sh sqlite3 4
|
./api_test.sh sqlite3 4
|
||||||
@@ -51,7 +51,7 @@ docker-test-run-with-postgres:
|
|||||||
./api_test.sh postgres 4
|
./api_test.sh postgres 4
|
||||||
|
|
||||||
docker-test:
|
docker-test:
|
||||||
docker run -ti --privileged --rm -e LOG_LEVEL=debug \
|
docker run -ti --privileged --rm -e FN_LOG_LEVEL=debug \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v ${CURDIR}:/go/src/github.com/fnproject/fn \
|
-v ${CURDIR}:/go/src/github.com/fnproject/fn \
|
||||||
-w /go/src/github.com/fnproject/fn \
|
-w /go/src/github.com/fnproject/fn \
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ you can update your code and run `fn deploy myapp` again.
|
|||||||
We also have an open source graphical user interface for Fn. It's very easy to use, simply run the command below:
|
We also have an open source graphical user interface for Fn. It's very easy to use, simply run the command below:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" fnproject/ui
|
docker run --rm -it --link functions:api -p 4000:4000 -e "FN_API_URL=http://api:8080" fnproject/ui
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, see: [https://github.com/fnproject/ui](https://github.com/fnproject/ui)
|
For more information, see: [https://github.com/fnproject/ui](https://github.com/fnproject/ui)
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
EnvLogLevel = "LOG_LEVEL"
|
EnvLogLevel = "FN_LOG_LEVEL"
|
||||||
EnvMQURL = "MQ_URL"
|
EnvMQURL = "FN_MQ_URL"
|
||||||
EnvDBURL = "DB_URL"
|
EnvDBURL = "FN_DB_URL"
|
||||||
EnvLOGDBURL = "LOGSTORE_URL"
|
EnvLOGDBURL = "FN_LOGSTORE_URL"
|
||||||
EnvPort = "PORT" // be careful, Gin expects this variable to be "port"
|
EnvPort = "FN_PORT" // be careful, Gin expects this variable to be "port"
|
||||||
EnvAPICORS = "API_CORS"
|
EnvAPICORS = "FN_API_CORS"
|
||||||
EnvZipkinURL = "ZIPKIN_URL"
|
EnvZipkinURL = "FN_ZIPKIN_URL"
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
DefaultLogLevel = "info"
|
DefaultLogLevel = "info"
|
||||||
@@ -298,7 +298,7 @@ func (s *Server) Start(ctx context.Context) {
|
|||||||
|
|
||||||
func (s *Server) startGears(ctx context.Context, cancel context.CancelFunc) {
|
func (s *Server) startGears(ctx context.Context, cancel context.CancelFunc) {
|
||||||
// By default it serves on :8080 unless a
|
// By default it serves on :8080 unless a
|
||||||
// PORT environment variable was defined.
|
// FN_PORT environment variable was defined.
|
||||||
listen := fmt.Sprintf(":%d", getEnvInt(EnvPort, DefaultPort))
|
listen := fmt.Sprintf(":%d", getEnvInt(EnvPort, DefaultPort))
|
||||||
|
|
||||||
const runHeader = `
|
const runHeader = `
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ case "$1" in
|
|||||||
"sqlite3" )
|
"sqlite3" )
|
||||||
rm -fr /tmp/fn_integration_tests.db
|
rm -fr /tmp/fn_integration_tests.db
|
||||||
touch /tmp/fn_integration_tests.db
|
touch /tmp/fn_integration_tests.db
|
||||||
DB_URL="sqlite3:///tmp/fn_integration_tests.db"
|
FN_DB_URL="sqlite3:///tmp/fn_integration_tests.db"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"mysql" )
|
"mysql" )
|
||||||
@@ -33,7 +33,7 @@ case "$1" in
|
|||||||
sleep 15
|
sleep 15
|
||||||
MYSQL_HOST=`host ${DB_CONTAINER}`
|
MYSQL_HOST=`host ${DB_CONTAINER}`
|
||||||
MYSQL_PORT=3306
|
MYSQL_PORT=3306
|
||||||
DB_URL="mysql://root:root@tcp(${MYSQL_HOST}:${MYSQL_PORT})/funcs"
|
FN_DB_URL="mysql://root:root@tcp(${MYSQL_HOST}:${MYSQL_PORT})/funcs"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -44,9 +44,9 @@ case "$1" in
|
|||||||
sleep 15
|
sleep 15
|
||||||
POSTGRES_HOST=`host ${DB_CONTAINER}`
|
POSTGRES_HOST=`host ${DB_CONTAINER}`
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
DB_URL="postgres://postgres:root@${POSTGRES_HOST}:${POSTGRES_PORT}/funcs?sslmode=disable"
|
FN_DB_URL="postgres://postgres:root@${POSTGRES_HOST}:${POSTGRES_PORT}/funcs?sslmode=disable"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cd test/fn-api-tests && API_URL="http://localhost:8080" DB_URL=${DB_URL} go test -v -parallel ${2:-1} ./...; cd ../../
|
cd test/fn-api-tests && FN_API_URL="http://localhost:8080" FN_DB_URL=${FN_DB_URL} go test -v -parallel ${2:-1} ./...; cd ../../
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function build () {
|
|||||||
docker build -t fnproject/fnserver:latest .
|
docker build -t fnproject/fnserver:latest .
|
||||||
|
|
||||||
function run () {
|
function run () {
|
||||||
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v $PWD/data:/app/data -p 8080:8080 fnproject/fnserver
|
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -e FN_LOG_LEVEL=debug -e "FN_DB_URL=sqlite3:///app/data/fn.db" -v $PWD/data:/app/data -p 8080:8080 fnproject/fnserver
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($cmd)
|
switch ($cmd)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ that can be used to track call status using following command:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
||||||
curl -v -X GET ${API_URL}/v1/calls/f5621e8b-725a-4ba9-8323-b8cdc02ce37
|
curl -v -X GET ${FN_API_URL}/v1/calls/f5621e8b-725a-4ba9-8323-b8cdc02ce37
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ Corresponding HTTP header is `Fn_call_id`.
|
|||||||
In order get list of per-route calls please use following command:
|
In order get list of per-route calls please use following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -X GET ${API_URL}/v1/app/{app}/calls/{route}
|
curl -X GET ${FN_API_URL}/v1/app/{app}/calls/{route}
|
||||||
|
|
||||||
```
|
```
|
||||||
Server will replay with following JSON response:
|
Server will replay with following JSON response:
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
# Databases
|
# Databases
|
||||||
|
|
||||||
We currently support the following databases and they are passed in via the `DB_URL` environment variable. For example:
|
We currently support the following databases and they are passed in via the `FN_DB_URL` environment variable. For example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -e "DB_URL=postgres://user:pass@localhost:6212/mydb" ...
|
docker run -e "FN_DB_URL=postgres://user:pass@localhost:6212/mydb" ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## sqlite3 (default)
|
## sqlite3 (default)
|
||||||
@@ -12,7 +12,7 @@ docker run -e "DB_URL=postgres://user:pass@localhost:6212/mydb" ...
|
|||||||
URL: `sqlite3:///functions/data/functions.db`
|
URL: `sqlite3:///functions/data/functions.db`
|
||||||
|
|
||||||
SQLite3 is an embedded database which stores to disk. If you want to use this, be sure you don't lose the data directory by mounting
|
SQLite3 is an embedded database which stores to disk. If you want to use this, be sure you don't lose the data directory by mounting
|
||||||
the directory on your host. eg: `docker run -v $PWD/data:/functions/data -e DB_URL=sqlite3:///functions/data/fn.db ...`
|
the directory on your host. eg: `docker run -v $PWD/data:/functions/data -e FN_DB_URL=sqlite3:///functions/data/fn.db ...`
|
||||||
|
|
||||||
## [PostgreSQL](http://www.postgresql.org/)
|
## [PostgreSQL](http://www.postgresql.org/)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ For more configuration options, see [docker mysql docs](https://hub.docker.com/_
|
|||||||
|
|
||||||
```
|
```
|
||||||
docker run --rm --privileged --link "func-mysql:mysql" \
|
docker run --rm --privileged --link "func-mysql:mysql" \
|
||||||
-e "DB_URL=mysql://func:funcpass@tcp(mysql:3306)/funcs" \
|
-e "FN_DB_URL=mysql://func:funcpass@tcp(mysql:3306)/funcs" \
|
||||||
-it -p 8080:8080 fnproject/fn
|
-it -p 8080:8080 fnproject/fn
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ docker run -it --rm --link func-postgres:postgres postgres \
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm --privileged --link "func-postgres:postgres" \
|
docker run --rm --privileged --link "func-postgres:postgres" \
|
||||||
-e "DB_URL=postgres://postgres:funcpass@postgres/funcs?sslmode=disable" \
|
-e "FN_DB_URL=postgres://postgres:funcpass@postgres/funcs?sslmode=disable" \
|
||||||
-it -p 8080:8080 fnproject/fnserver
|
-it -p 8080:8080 fnproject/fnserver
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -31,31 +31,32 @@ Note that `fn-service` is initially pending on allocating an external IP. The `k
|
|||||||
If you are using a Kubernetes setup that can expose a public load balancer, run:
|
If you are using a Kubernetes setup that can expose a public load balancer, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ export API_URL=http://$(kubectl -n fn get service/fn-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}:{.spec.ports[?(@.name=="fn-service")].port}')
|
$ export FN_API_URL=http://$(kubectl -n fn get service/fn-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}:{.spec.ports[?(@.name=="fn-service")].port}')
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using a Kubernetes setup like minikube, run
|
If you are using a Kubernetes setup like minikube, run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ export API_URL=$(minikube -n fn service fn-service --url)
|
$ export FN_API_URL=$(minikube -n fn service fn-service --url)
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, test by creating a function via curl:
|
Now, test by creating a function via curl:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' $API_URL/v1/apps
|
$ curl -H "Content-Type: application/json" -X POST -d '{ "app": { "name":"myapp" } }' $FN_API_URL/v1/apps
|
||||||
{"message":"App successfully created","app":{"name":"myapp","config":null}}
|
{"message":"App successfully created","app":{"name":"myapp","config":null}}
|
||||||
|
|
||||||
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"fnproject/hello" } }' $API_URL/v1/apps/myapp/routes
|
$ curl -H "Content-Type: application/json" -X POST -d '{ "route": { "type": "sync", "path":"/hello-sync", "image":"fnproject/hello" } }' $FN_API_URL/v1/apps/myapp/routes
|
||||||
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"fnproject/hello","memory":128,"headers":{},"type":"sync","format":"default","timeout":30,"idle_timeout":30,"config":{}}}
|
{"message":"Route successfully created","route":{"app_name":"myapp","path":"/hello-sync","image":"fnproject/hello","memory":128,"headers":{},"type":"sync","format":"default","timeout":30,"idle_timeout":30,"config":{}}}
|
||||||
|
|
||||||
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' $API_URL/r/myapp/hello-sync
|
$ curl -H "Content-Type: application/json" -X POST -d '{ "name":"Johnny" }' $FN_API_URL/r/myapp/hello-sync
|
||||||
Hello Johnny!
|
Hello Johnny!
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use the [Fn CLI](https://github.com/fnproject/cli):
|
You can also use the [Fn CLI](https://github.com/fnproject/cli):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
$ export FN_API_URL=http://192.168.99.100:30966
|
||||||
$ fn apps list
|
$ fn apps list
|
||||||
myapp
|
myapp
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ metadata:
|
|||||||
name: fn-service-config
|
name: fn-service-config
|
||||||
namespace: fn
|
namespace: fn
|
||||||
data:
|
data:
|
||||||
MQ_URL: redis://fn-redis-master.fn
|
FN_MQ_URL: redis://fn-redis-master.fn
|
||||||
DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
|
FN_DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
|
||||||
API_URL: http://fn-service.fn:8080
|
FN_API_URL: http://fn-service.fn:8080
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@@ -56,16 +56,16 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
env:
|
env:
|
||||||
- name: MQ_URL
|
- name: FN_MQ_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: fn-service-config
|
name: fn-service-config
|
||||||
key: MQ_URL
|
key: FN_MQ_URL
|
||||||
- name: DB_URL
|
- name: FN_DB_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: fn-service-config
|
name: fn-service-config
|
||||||
key: DB_URL
|
key: FN_DB_URL
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@@ -108,11 +108,11 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: "80"
|
value: "80"
|
||||||
- name: API_URL
|
- name: FN_API_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: fn-service-config
|
name: fn-service-config
|
||||||
key: API_URL
|
key: FN_API_URL
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
# Function logs
|
# Function logs
|
||||||
|
|
||||||
We currently support the following function logs stores and they are passed in
|
We currently support the following function logs stores and they are passed in
|
||||||
via the `LOGSTORE_URL` environment variable. For example:
|
via the `FN_LOGSTORE_URL` environment variable. For example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -e "LOGSTORE_URL=sqlite3:///functions/logs/fn.db" ...
|
docker run -e "FN_LOGSTORE_URL=sqlite3:///functions/logs/fn.db" ...
|
||||||
```
|
```
|
||||||
|
|
||||||
settings `LOGSTORE_URL` to `DB_URL` will put logs in the same database as
|
settings `FN_LOGSTORE_URL` to `FN_DB_URL` will put logs in the same database as
|
||||||
other data, this is not recommended for production.
|
other data, this is not recommended for production.
|
||||||
|
|
||||||
## sqlite3 / postgres / mysql (default)
|
## sqlite3 / postgres / mysql (default)
|
||||||
|
|
||||||
NOTE: if you leave LOGSTORE_URL empty, it will default to DB_URL. this is
|
NOTE: if you leave FN_LOGSTORE_URL empty, it will default to FN_DB_URL. this is
|
||||||
recommended if you are not using a separate place for your logs for connection
|
recommended if you are not using a separate place for your logs for connection
|
||||||
pooling reasons.
|
pooling reasons.
|
||||||
|
|
||||||
example URL: `sqlite3:///functions/logs/fn.db`
|
example URL: `sqlite3:///functions/logs/fn.db`
|
||||||
|
|
||||||
sqlite3 is an embedded database which stores to disk. If you want to use this, be sure you don't lose the data directory by mounting
|
sqlite3 is an embedded database which stores to disk. If you want to use this, be sure you don't lose the data directory by mounting
|
||||||
the directory on your host. eg: `docker run -v $PWD/data:/functions/data -e LOGSTORE_URL=sqlite3:///functions/data/fn.db ...`
|
the directory on your host. eg: `docker run -v $PWD/data:/functions/data -e FN_LOGSTORE_URL=sqlite3:///functions/data/fn.db ...`
|
||||||
|
|
||||||
sqlite3 isn't recommended for production environments
|
sqlite3 isn't recommended for production environments
|
||||||
|
|
||||||
## minio / s3
|
## minio / s3
|
||||||
|
|
||||||
If you have an s3-compatible object store, we are using only `put_object` and
|
If you have an s3-compatible object store, we are using only `put_object` and
|
||||||
`get_object` and you may point `LOGSTORE_URL` at that api's url appropriately.
|
`get_object` and you may point `FN_LOGSTORE_URL` at that api's url appropriately.
|
||||||
If you don't have one of those running, you may run minio, an example is
|
If you don't have one of those running, you may run minio, an example is
|
||||||
below:
|
below:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ docker run -d -p 9000:9000 --name minio -e "MINIO_ACCESS_KEY=admin" -e "MINIO_SECRET_KEY=password" minio/minio server /data
|
$ docker run -d -p 9000:9000 --name minio -e "MINIO_ACCESS_KEY=admin" -e "MINIO_SECRET_KEY=password" minio/minio server /data
|
||||||
$ docker run --privileged --link minio -e "LOGSTORE_URL=s3://admin:password@minio:9000/us-east-1/fnlogs" fnproject/functions:latest
|
$ docker run --privileged --link minio -e "FN_LOGSTORE_URL=s3://admin:password@minio:9000/us-east-1/fnlogs" fnproject/fnserver:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
you may include any other necessary args for fnproject, this example only
|
you may include any other necessary args for fnproject, this example only
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
A message queue is used to coordinate asynchronous function calls that run through Fn.
|
A message queue is used to coordinate asynchronous function calls that run through Fn.
|
||||||
|
|
||||||
We currently support the following message queues and they are passed in via the `MQ_URL` environment variable. For example:
|
We currently support the following message queues and they are passed in via the `FN_MQ_URL` environment variable. For example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -e "MQ_URL=redis://localhost:6379/" ...
|
docker run -e "FN_MQ_URL=redis://localhost:6379/" ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## [Bolt](https://github.com/boltdb/bolt) (default)
|
## [Bolt](https://github.com/boltdb/bolt) (default)
|
||||||
|
|||||||
@@ -21,11 +21,12 @@ docker run -e VAR_NAME=VALUE ...
|
|||||||
|
|
||||||
| Env Variables | Description | Default values |
|
| Env Variables | Description | Default values |
|
||||||
| --------------|-------------|----------------|
|
| --------------|-------------|----------------|
|
||||||
| `DB_URL` | The database URL to use in URL format. See [Databases](databases/README.md) for more information. | sqlite3:///app/data/fn.db |
|
| `FN_DB_URL` | The database URL to use in URL format. See [Databases](databases/README.md) for more information. | sqlite3:///app/data/fn.db |
|
||||||
| `MQ_URL` | The message queue to use in URL format. See [Message Queues](mqs/README.md) for more information. | bolt:///app/data/worker_mq.db |
|
| `FN_MQ_URL` | The message queue to use in URL format. See [Message Queues](mqs/README.md) for more information. | bolt:///app/data/worker_mq.db |
|
||||||
| `PORT` | Sets the port to run on | 8080 |
|
| `FN_API_URL` | The primary Fn API URL to that this instance will talk to. In a production environment, this would be your load balancer URL. | N/A |
|
||||||
| `LOG_LEVEL` | Set to DEBUG to enable debugging | INFO |
|
| `FN_PORT `| Sets the port to run on | 8080 |
|
||||||
| `DOCKER_HOST` | Docker remote API URL | /var/run/docker.sock:/var/run/docker.sock |
|
| `FN_LOG_LEVEL` | Set to DEBUG to enable debugging | INFO |
|
||||||
|
| `DOCKER_HOST` | Docker remote API URL | /var/run/docker.sock |
|
||||||
| `DOCKER_API_VERSION` | Docker remote API version | 1.24 |
|
| `DOCKER_API_VERSION` | Docker remote API version | 1.24 |
|
||||||
| `DOCKER_TLS_VERIFY` | Set this option to enable/disable Docker remote API over TLS/SSL. | 0 |
|
| `DOCKER_TLS_VERIFY` | Set this option to enable/disable Docker remote API over TLS/SSL. | 0 |
|
||||||
| `DOCKER_CERT_PATH` | Set this option to specify where CA cert placeholder | ~/.docker/cert.pem |
|
| `DOCKER_CERT_PATH` | Set this option to specify where CA cert placeholder | ~/.docker/cert.pem |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
### Run Functions UI
|
### Run Functions UI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm -it --link functions:api -p 4000:4000 -e "API_URL=http://api:8080" fnproject/ui
|
docker run --rm -it --link functions:api -p 4000:4000 -e "FN_API_URL=http://api:8080" fnproject/ui
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, see: https://github.com/fnproject/ui
|
For more information, see: https://github.com/fnproject/ui
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ docker run -d --name fnlb --link fn-8080 -p 8081:8081 fnproject/fnlb:latest --no
|
|||||||
To make functions requests against the lb with the cli:
|
To make functions requests against the lb with the cli:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
API_URL=http://<fnlb_address> fn call my/function
|
FN_API_URL=http://<fnlb_address> fn call my/function
|
||||||
```
|
```
|
||||||
|
|
||||||
To add a functions node later:
|
To add a functions node later:
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ Test dependencies
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
DOCKER_HOST - for building images
|
DOCKER_HOST - for building images
|
||||||
API_URL - Fn API endpoint
|
FN_API_URL - Fn API endpoint
|
||||||
```
|
```
|
||||||
|
|
||||||
How to run tests?
|
How to run tests?
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export API_URL=http://localhost:8080
|
export FN_API_URL=http://localhost:8080
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ import (
|
|||||||
const lBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
const lBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
func Host() string {
|
func Host() string {
|
||||||
apiURL := "http://localhost:8080"
|
apiURL := os.Getenv("FN_API_URL")
|
||||||
|
if apiURL == "" {
|
||||||
|
apiURL = "http://localhost:8080"
|
||||||
|
}
|
||||||
|
|
||||||
u, err := url.Parse(apiURL)
|
u, err := url.Parse(apiURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -59,7 +62,7 @@ func getServerWithCancel() (*server.Server, context.CancelFunc) {
|
|||||||
|
|
||||||
common.SetLogLevel("fatal")
|
common.SetLogLevel("fatal")
|
||||||
timeString := time.Now().Format("2006_01_02_15_04_05")
|
timeString := time.Now().Format("2006_01_02_15_04_05")
|
||||||
dbURL := os.Getenv("DB_URL")
|
dbURL := os.Getenv(server.EnvDBURL)
|
||||||
tmpDir := os.TempDir()
|
tmpDir := os.TempDir()
|
||||||
tmpMq := fmt.Sprintf("%s/fn_integration_test_%s_worker_mq.db", tmpDir, timeString)
|
tmpMq := fmt.Sprintf("%s/fn_integration_test_%s_worker_mq.db", tmpDir, timeString)
|
||||||
tmpDb := fmt.Sprintf("%s/fn_integration_test_%s_fn.db", tmpDir, timeString)
|
tmpDb := fmt.Sprintf("%s/fn_integration_test_%s_fn.db", tmpDir, timeString)
|
||||||
|
|||||||
Reference in New Issue
Block a user