fnproject / fn

The container native, cloud agnostic serverless platform.
http://fnproject.io
Apache License 2.0
5.76k stars 405 forks source link

Simplify functions to the core.... Convention over configuration at the fore front. #26

Closed rdallman closed 6 years ago

rdallman commented 7 years ago

In gitlab by @hibooboo2 on May 18, 2017, 09:55

So my thoughts on the whole functions idea of dev is:

In order to meet all of these reqs I think that when you run fn init if there is no app / function configured in the current directory we create one. This discovery should discover all the functions that create an application and publish it all. That means there needs to be a sane way to do that. Right now we can init to create a functions and auto deploy to an app. However it requires us to specify the name of the app. I think that it should be similar to https://zeit.co/now#get-started in the most basic case. To accomplish this I want to kind of expand / add to what @treeder Has said in #10

These are the things I think that fn init or deploy should do if there currently exists no function / app in the current git repo or directory depending on which it is. That being said I have two flows I would propose:

I think first it should just try it using the current directory:

Here is an example:

$ tree
.
├── admin
│   └── allpolls.func.py
├── getpoll.func.go
├── getresults.func.go
├── makepoll.func.go
├── polls.func.rb
└── vote.func.java

1 directory, 6 files

That would give us 6 functions and grouped into an app called strawpoll since the folders name was strawpoll. The thing I am not sure on is the format for app.yaml and how we would name the func.yamls. Was thinking maybe changing it to .fx.yaml and then we can put the function name in front of the .fx.yaml

And then from there you would be able to change the values in the yamls etc...

rdallman commented 7 years ago

In gitlab by @rdallman on May 18, 2017, 10:15

disagree about this Naming the app and functions. part. picking the current directory name is pretty sane for a default, i think. in the app file itself we could probably make it easy to change the name from the default (so still "convention over configuration") but then i think things get really complicated (well, not intuitive). don't like people having to make files named certain things with our own extension, I think it smells and will turn people off -- if there's an app / func definition file then it's pretty obvious that it's functions stuff.

app.yaml and how we would name the func.yamls

func.yaml and app.yaml seem fine ? having docker image names in file names will be horrid. e.g. http://my-private-registry.company.com/1/registry/mythingajig/yodawg:0.0.1.fx.yaml ? idk i don't like the idea of having all these little DSL files laying around either but I can't think of a better alternative.

rdallman commented 7 years ago

In gitlab by @treeder on May 18, 2017, 10:23

I agree for the most part except for the naming thing. Pretty similar thoughts as Reed. Function per directory seems the best to me as typically it won't just be a single file, there will almost always be dependencies and other things that function might need like it's own Dockerfile, it's own metadata in func.yaml, etc.

rdallman commented 7 years ago

In gitlab by @hibooboo2 on May 18, 2017, 14:48

Ok so if it is a function per folder then at the top level if you have a git repo the base folder of the git repo would be the app name?