mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
replace default bolt option with sqlite3 option. the story here is that we just need a working out of the box solution, and sqlite3 is just fine for that (actually, likely better than bolt). with sqlite3 supplanting bolt, we mostly have sql databases. so remove redis and then we just have one package that has a `sql` implementation of the `models.Datastore` and lean on sqlx to do query rewriting. this does mean queries have to be formed a certain way and likely have to be ANSI-SQL (no special features) but we weren't using them anyway and our base api is basically done and we can easily extend this api as needed to only implement certain methods in certain backends if we need to get cute. * remove bolt & redis datastores (can still use as mqs) * make sql queries work on all 3 (maybe?) * remove bolt log store and use sqlite3 * shove the FnLog shit into the datastore shit for now (free pg/mysql logs... just for demos, etc, not prod) * fix up the docs to remove bolt references * add sqlite3, sqlx dep * fix up tests & mock stuff, make validator less insane * remove put & get in datastore layer as nobody is using. this passes tests which at least seem like they test all the different backends. if we trust our tests then this seems to work great. (tests `make docker-test-run-with-*` work now too)
50 lines
2.4 KiB
Markdown
50 lines
2.4 KiB
Markdown
# Oracle Functions Runtime Options
|
|
|
|
## Configuration
|
|
|
|
When starting Oracle Functions, you can pass in the following configuration variables as environment variables. Use `-e VAR_NAME=VALUE` in
|
|
docker run. For example:
|
|
|
|
```sh
|
|
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 |
|
|
| API_URL | The primary Oracle Functions API URL to that this instance will talk to. In a production environment, this would be your load balancer URL. | N/A |
|
|
| 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 |
|
|
| 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 |
|
|
|
|
## Starting without Docker in Docker
|
|
|
|
The default way to run Oracle Functions, as it is in the Quickstart guide, is to use docker-in-docker (dind). There are
|
|
a couple reasons why we did it this way:
|
|
|
|
* It's clean. Once the container exits, there is nothing left behind including all the function images.
|
|
* You can set resource restrictions for the entire Oracle Functions instance. For instance, you can set `--memory` on
|
|
the docker run command to set the max memory for the Oracle Functions instance AND all of the functions it's running.
|
|
|
|
There are some reasons you may not want to use dind, such as using the image cache during testing or you're running
|
|
[Windows](windows.md).
|
|
|
|
### Mount the Host Docker
|
|
|
|
One way is to mount the host Docker. Everything is essentially the same except you add a `-v` flag:
|
|
|
|
```sh
|
|
docker run --rm --name functions -it -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/app/data -p 8080:8080 treeder/functions
|
|
```
|
|
|
|
### Run outside Docker
|
|
|
|
You can of course just run the binary directly, you'll just have to change how you set the environment variables above.
|
|
|
|
See [contributing doc](../CONTRIBUTING.md) for information on how to build and run.
|
|
|