Merge branch 'master' of https://github.com/metrue/fx into fixalldown

This commit is contained in:
Luca Capra
2017-12-16 18:58:16 +01:00
16 changed files with 4286 additions and 329 deletions

View File

@@ -51,6 +51,7 @@ jobs:
fx up examples/functions/func.php >> deploy.log
fx up examples/functions/func.jl >> deploy.log
fx up examples/functions/func.java >> deploy.log
fx up examples/functions/func.d >> deploy.log
cat server_output.log
cat deploy.log;
cat deploy.log | grep '\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-' | wc -l | grep 14

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
assets/* linguist-vendored
*.md linguist-documentation

1
.gitignore vendored
View File

@@ -6,4 +6,5 @@ build/
*.swp
/fx
tmp/
/api/google
/coverage.txt

View File

@@ -2,23 +2,27 @@ OUTPUT_DIR=./build
DIST_DIR=./dist
install-deps:
# install protoc
./bin/install_protoc.sh
# install protobuf and grpc
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u google.golang.org/grpc
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/jteeuwen/go-bindata/...
git clone --depth 1 https://github.com/googleapis/googleapis.git vendor/github.com/googleapis
cp -rf vendor/github.com/googleapis/google/ api/google/
# install protoc
./bin/install_protoc.sh
# install the other dependencies
@dep ensure
generate:
# generate gRPC related code
go generate ./api/fx.go
# bundle assert into binary
go-bindata -pkg common -o common/asset.go ./assets/dockerfiles/fx/...
build: generate
go build -o ${OUTPUT_DIR}/fx fx.go
cross:

View File

@@ -1,8 +1,8 @@
1. Prepare your Dockerfile within this [directory](https://github.com/metrue/fx/tree/master/assets/dockerfiles/fx). you can simply test it:
```
docker -t <foo-bar> build .
docker run foo-bar
docker build -t <foo-bar> .
docker run -p 3000:3000 foo-bar
```
if everything works as you expected, fx will support it without any extra effort.

View File

@@ -204,6 +204,9 @@ Thank you to all the people who already contributed to fx!
<a href="https://github.com/pplam" target="_blank">
<img alt="pplam" src="https://avatars2.githubusercontent.com/u/12783579?v=4&s=50" width="50">
</a>
<a href="https://github.com/muka" target="_blank">
<img alt="muka" src="https://avatars2.githubusercontent.com/u/1021269?v=4&s=50 width="50">
</a>
<a href="https://github.com/xwjdsh" target="_blank">
<img alt="xwjdsh" src="https://avatars2.githubusercontent.com/u/11025519?v=4&s=50" width="50">
</a>
@@ -219,6 +222,9 @@ Thank you to all the people who already contributed to fx!
<a href="https://github.com/chlins" target="_blank">
<img alt="chlins" src="https://avatars2.githubusercontent.com/u/31262637?v=4&s=50" width="50">
</a>
<a href="https://github.com/andre2007" target="_blank">
<img alt="andre2007" src="https://avatars1.githubusercontent.com/u/1451047?s=50&v=4" width="50">
</a>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,5 @@
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y build-essential curl libcurl3 \
&& curl -OL http://downloads.dlang.org/releases/2.x/2.077.1/dmd_2.077.1-0_amd64.deb \
&& apt install ./dmd_2.077.1-0_amd64.deb

View File

@@ -0,0 +1,5 @@
FROM metrue/fx-d-base
COPY . .
EXPOSE 3000
CMD ["rdmd", "-version=embedded_httpd", "app", "--port", "3000"]

View File

@@ -0,0 +1,16 @@
import std.json;
import arsd.cgi;
import fx;
void handle(Cgi cgi)
{
if (cgi.requestMethod == Cgi.RequestMethod.POST && cgi.pathInfo == "/")
{
auto input = parseJSON(cgi.postJson);
auto result = JSONValue(executeFx(input));
cgi.setResponseContentType("application/json");
cgi.write(toJSON(result));
}
}
mixin GenericMain!handle;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
import std.json;
long executeFx(JSONValue input)
{
return input["a"].integer + input["b"].integer;
}

File diff suppressed because one or more lines are too long

1
env/env.go vendored
View File

@@ -9,6 +9,7 @@ func PullBaseDockerImage(verbose bool) {
"metrue/fx-julia-base",
"metrue/fx-python-base",
"metrue/fx-node-base",
"metrue/fx-d-base",
}
task := func(image string, verbose bool) {

View File

@@ -0,0 +1,6 @@
import std.json;
long executeFx(JSONValue input)
{
return input["a"].integer + input["b"].integer;
}

View File

@@ -18,6 +18,7 @@ var funcNames = map[string]string{
"php": "/fx.php",
"julia": "/fx.jl",
"java": "/src/main/java/fx/Fx.java",
"d": "/fx.d",
}
var assetsMap = map[string][]string{
@@ -59,6 +60,12 @@ var assetsMap = map[string][]string{
"assets/dockerfiles/fx/ruby/app.rb",
"assets/dockerfiles/fx/ruby/fx.rb",
},
"d": {
"assets/dockerfiles/fx/d/Dockerfile",
"assets/dockerfiles/fx/d/app.d",
"assets/dockerfiles/fx/d/fx.d",
"assets/dockerfiles/fx/d/arsd/cgi.d",
},
}
func removePrefix(lang string, filename string) (name string) {

View File

@@ -282,6 +282,7 @@ func GetLangFromFileName(fileName string) (lang string) {
".php": "php",
".jl": "julia",
".java": "java",
".d": "d",
}
return extLangMap[filepath.Ext(fileName)]
}