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
@@ -165,7 +165,7 @@ that can be used to track call status using following command:
|
||||
|
||||
```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:
|
||||
|
||||
```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:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
# 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
|
||||
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)
|
||||
@@ -12,7 +12,7 @@ docker run -e "DB_URL=postgres://user:pass@localhost:6212/mydb" ...
|
||||
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
|
||||
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/)
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ For more configuration options, see [docker mysql docs](https://hub.docker.com/_
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
@@ -29,6 +29,6 @@ docker run -it --rm --link func-postgres:postgres postgres \
|
||||
|
||||
```sh
|
||||
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
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
```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
|
||||
|
||||
```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:
|
||||
|
||||
```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}}
|
||||
|
||||
$ 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":{}}}
|
||||
|
||||
$ 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!
|
||||
```
|
||||
|
||||
You can also use the [Fn CLI](https://github.com/fnproject/cli):
|
||||
|
||||
```bash
|
||||
$ export FN_API_URL=http://192.168.99.100:30966
|
||||
$ fn apps list
|
||||
myapp
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ metadata:
|
||||
name: fn-service-config
|
||||
namespace: fn
|
||||
data:
|
||||
MQ_URL: redis://fn-redis-master.fn
|
||||
DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
|
||||
API_URL: http://fn-service.fn:8080
|
||||
FN_MQ_URL: redis://fn-redis-master.fn
|
||||
FN_DB_URL: mysql://root:fnsecretpassword@tcp(fn-mysql-master.fn:3306)/fn
|
||||
FN_API_URL: http://fn-service.fn:8080
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -56,16 +56,16 @@ spec:
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: MQ_URL
|
||||
- name: FN_MQ_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: fn-service-config
|
||||
key: MQ_URL
|
||||
- name: DB_URL
|
||||
key: FN_MQ_URL
|
||||
- name: FN_DB_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: fn-service-config
|
||||
key: DB_URL
|
||||
key: FN_DB_URL
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -108,11 +108,11 @@ spec:
|
||||
env:
|
||||
- name: PORT
|
||||
value: "80"
|
||||
- name: API_URL
|
||||
- name: FN_API_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: fn-service-config
|
||||
key: API_URL
|
||||
key: FN_API_URL
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
# Function logs
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
## 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
|
||||
pooling reasons.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
## minio / s3
|
||||
|
||||
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
|
||||
below:
|
||||
|
||||
```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 --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
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
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
|
||||
docker run -e "MQ_URL=redis://localhost:6379/" ...
|
||||
docker run -e "FN_MQ_URL=redis://localhost:6379/" ...
|
||||
```
|
||||
|
||||
## [Bolt](https://github.com/boltdb/bolt) (default)
|
||||
|
||||
@@ -21,11 +21,12 @@ docker run -e VAR_NAME=VALUE ...
|
||||
|
||||
| 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 |
|
||||
| `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 |
|
||||
| `LOG_LEVEL` | Set to DEBUG to enable debugging | INFO |
|
||||
| `DOCKER_HOST` | Docker remote API URL | /var/run/docker.sock:/var/run/docker.sock |
|
||||
| `FN_DB_URL` | The database URL to use in URL format. See [Databases](databases/README.md) for more information. | sqlite3:///app/data/fn.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 |
|
||||
| `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 |
|
||||
| `FN_PORT `| Sets the port to run on | 8080 |
|
||||
| `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_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 |
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
### Run Functions UI
|
||||
|
||||
```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
|
||||
|
||||
Reference in New Issue
Block a user