├── python ├── tests │ ├── src │ │ ├── __init__.py │ │ ├── sub_mod │ │ │ ├── __init__.py │ │ │ └── altmain.py │ │ ├── foo.py │ │ └── main.py │ ├── websocket_test.sh │ └── local_test.sh ├── examples │ ├── multifile │ │ ├── __init__.py │ │ ├── message.txt │ │ ├── readfile.py │ │ ├── main.py │ │ └── README.md │ ├── sourcepkg │ │ ├── __init__.py │ │ ├── requirements.txt │ │ ├── build.sh │ │ └── user.py │ ├── hello.py │ ├── statuscode.py │ ├── requestdata.py │ ├── websocket │ │ └── main.py │ ├── guestbook │ │ ├── add.py │ │ ├── deploy.sh │ │ ├── redis.yaml │ │ └── get.py │ └── README.md ├── Makefile ├── builder │ ├── Makefile │ ├── defaultBuildCmd │ └── Dockerfile ├── Dockerfile ├── Dockerfile-buster ├── requirements.txt └── envconfig.json ├── dotnet20 ├── .dockerignore ├── project-build.sh ├── Makefile ├── builder │ ├── Makefile │ ├── Model │ │ ├── ExcludeDll.cs │ │ ├── IncludeNuget.cs │ │ ├── BuilderSettings.cs │ │ └── FunctionSpecification.cs │ ├── builderSettings.json │ ├── Utility │ │ ├── BuilderExtensions.cs │ │ └── ObjectConverter.cs │ ├── build.sh │ ├── Dockerfile │ ├── nugetSettings.json │ ├── Builder.sln │ ├── log4net.config │ └── Builder.csproj ├── envsettings.json ├── examples │ ├── helloworld.cs │ ├── echo.cs │ ├── arguments.cs │ ├── requestheaders.cs │ └── requestbody.cs ├── Dockerfile ├── Model │ ├── DllInfo.cs │ ├── EnvironmentSettings.cs │ ├── BuilderRequest.cs │ └── FunctionSpecification.cs ├── Program.cs ├── Function.cs ├── Utility │ ├── ObjectConverter.cs │ └── EnvironmentExtension.cs ├── envconfig.json ├── dotnet20.sln └── fission-dotnet20.csproj ├── nodejs ├── .gitignore ├── test │ ├── package.json │ ├── test-case-5 │ │ ├── package.json │ │ └── helloWorld.js │ ├── test-case-6 │ │ ├── package.json │ │ └── helloUser.js │ ├── test-case-7 │ │ ├── package.json │ │ └── wordCount.js │ ├── test-case-1 │ │ └── helloWorld.js │ ├── test.js │ ├── test-case-2 │ │ └── helloUser.js │ ├── test-case-4 │ │ ├── package.json │ │ ├── momentExample.js │ │ └── package-lock.json │ ├── test-case-8 │ │ ├── package.json │ │ ├── momentExample.js │ │ └── package-lock.json │ └── test-case-3 │ │ └── wordCount.js ├── examples │ ├── index.js │ ├── hello-callback.js │ ├── echo.js │ ├── hello.js │ ├── broadcast.js │ ├── multi-entry.js │ ├── hello-esm.js │ ├── package.json │ ├── weather.js │ └── multi-entry-esm.js ├── builder │ ├── build.sh │ ├── Dockerfile │ └── Makefile ├── Dockerfile ├── Makefile └── package.json ├── python-fastapi ├── tests │ ├── src │ │ ├── __init__.py │ │ ├── sub_mod │ │ │ ├── __init__.py │ │ │ └── altmain.py │ │ ├── foo.py │ │ └── main.py │ └── local_test.sh ├── examples │ ├── multifile │ │ ├── __init__.py │ │ ├── message.txt │ │ ├── readfile.py │ │ ├── main.py │ │ └── README.md │ ├── sourcepkg │ │ ├── __init__.py │ │ ├── requirements.txt │ │ ├── build.sh │ │ └── user.py │ ├── guestbook │ │ ├── requirements.txt │ │ ├── build.sh │ │ ├── add.py │ │ ├── redis.yaml │ │ ├── deploy.sh │ │ └── get.py │ ├── statuscode.py │ ├── hello.py │ ├── requestdata.py │ └── README.md ├── requirements.txt ├── Makefile ├── builder │ ├── defaultBuildCmd │ ├── Makefile │ └── Dockerfile ├── Dockerfile └── envconfig.json ├── jvm-jersey ├── .gitignore ├── examples │ └── java │ │ ├── .gitignore │ │ ├── build.sh │ │ ├── specs │ │ ├── fission-deployment-config.yaml │ │ ├── env-java.yaml │ │ ├── package-hellojava.yaml │ │ └── function-hello.yaml │ │ └── src │ │ ├── test │ │ └── java │ │ │ └── io │ │ │ └── fission │ │ │ └── HelloWorldTest.java │ │ └── main │ │ └── java │ │ └── io │ │ └── fission │ │ └── HelloWorld.java ├── Makefile ├── builder │ ├── build.sh │ ├── Makefile │ └── Dockerfile ├── Dockerfile ├── src │ └── main │ │ └── java │ │ └── io │ │ └── fission │ │ ├── FunctionLoadRequest.java │ │ └── Main.java └── envconfig.json ├── binary ├── examples │ ├── headers.sh │ ├── hello.sh │ ├── echo.sh │ ├── hello.go │ └── module-example │ │ └── test.sh ├── builder │ ├── Makefile │ ├── Dockerfile │ └── build.sh ├── Makefile ├── Dockerfile ├── envconfig.json ├── env.go └── test │ └── local_test.sh ├── php7 ├── examples │ ├── multifile │ │ ├── handlers │ │ │ ├── message.txt │ │ │ └── FileReader.php │ │ ├── composer.json │ │ └── README.md │ ├── hello.php │ ├── hellopsr.php │ └── stock.php ├── Makefile ├── builder │ ├── Makefile │ ├── defaultBuildCmd │ └── Dockerfile ├── composer.json ├── envconfig.json ├── Dockerfile └── README.md ├── jvm ├── examples │ └── java │ │ ├── .gitignore │ │ ├── build.sh │ │ ├── specs │ │ ├── fission-deployment-config.yaml │ │ ├── env-java.yaml │ │ ├── package-hellojava.yaml │ │ └── function-hello.yaml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── fission │ │ │ └── HelloWorld.java │ │ └── test │ │ └── java │ │ └── io │ │ └── fission │ │ └── HelloWorldTest.java ├── .gitignore ├── Makefile ├── builder │ ├── Makefile │ ├── build.sh │ └── Dockerfile ├── Dockerfile ├── src │ └── main │ │ └── java │ │ └── io │ │ └── fission │ │ └── FunctionLoadRequest.java ├── envconfig.json └── pom.xml ├── dotnet ├── .gitignore ├── project-build.sh ├── Makefile ├── examples │ ├── helloworld.cs │ ├── arguments.cs │ ├── requestheaders.cs │ └── requestbody.cs ├── Dockerfile ├── Program.cs ├── Function.cs ├── envconfig.json └── fission-dotnet.csproj ├── tensorflow-serving ├── examples │ ├── half_plus_two │ │ └── 00000123 │ │ │ ├── variables │ │ │ ├── variables.data-00000-of-00001 │ │ │ └── variables.index │ │ │ └── saved_model.pb │ └── README.md ├── Makefile ├── Dockerfile ├── envconfig.json └── README.md ├── ruby ├── examples │ ├── hello.rb │ ├── parse │ │ ├── Gemfile │ │ ├── Gemfile.lock │ │ └── parse.rb │ ├── request_data.rb │ └── events_to_slack.rb ├── Gemfile ├── Makefile ├── builder │ ├── Makefile │ ├── defaultBuildCmd │ └── Dockerfile ├── Dockerfile ├── Gemfile.lock ├── fission │ ├── context.rb │ ├── handler.rb │ └── request.rb ├── server.rb └── envconfig.json ├── perl ├── Makefile ├── Dockerfile ├── envconfig.json ├── examples │ └── hello.pm ├── server.pl └── README.md ├── dotnet8 ├── Fission.DotNet.Common │ ├── obj │ │ ├── Release │ │ │ └── net8.0 │ │ │ │ ├── Fission.DotNet.Common.AssemblyInfoInputs.cache │ │ │ │ ├── Fission.DotNet.Common.csproj.CoreCompileInputs.cache │ │ │ │ ├── Fission.DotNet.Common.dll │ │ │ │ ├── Fission.DotNet.Common.pdb │ │ │ │ ├── ref │ │ │ │ └── Fission.DotNet.Common.dll │ │ │ │ ├── refint │ │ │ │ └── Fission.DotNet.Common.dll │ │ │ │ ├── Fission.DotNet.Common.assets.cache │ │ │ │ ├── Fission.DotNet.Common.sourcelink.json │ │ │ │ ├── .NETCoreApp,Version=v8.0.AssemblyAttributes.cs │ │ │ │ ├── Fission.DotNet.Common.GlobalUsings.g.cs │ │ │ │ ├── Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig │ │ │ │ └── Fission.DotNet.Common.AssemblyInfo.cs │ │ ├── Fission.DotNet.Common.csproj.nuget.g.targets │ │ ├── project.nuget.cache │ │ └── Fission.DotNet.Common.csproj.nuget.g.props │ ├── bin │ │ └── Release │ │ │ └── net8.0 │ │ │ ├── Fission.DotNet.Common.dll │ │ │ ├── Fission.DotNet.Common.pdb │ │ │ └── Fission.DotNet.Common.deps.json │ ├── ILogger.cs │ ├── ICorsPolicy.cs │ ├── FissionMqContext.cs │ ├── Fission.DotNet.Common.csproj │ ├── Fission.DotNet.Common.sln │ └── FissionHttpContext.cs ├── Fission.DotNet │ ├── Controllers │ │ ├── BuildController.cs │ │ └── HealthController.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Interfaces │ │ ├── ISpecializeService.cs │ │ ├── IFunctionStoreService.cs │ │ └── IFunctionService.cs │ ├── Model │ │ ├── FissionSpecializeRequest.cs │ │ └── FunctionStore.cs │ ├── Services │ │ ├── BuilderModeService.cs │ │ ├── FunctionStoreService.cs │ │ └── CustomAssemblyLoadContext.cs │ ├── Fission.DotNet.csproj │ ├── Adapter │ │ └── FissionLoggerAdapter.cs │ ├── Properties │ │ └── launchSettings.json │ └── Program.cs ├── examples │ ├── HelloWorld │ │ ├── MyFunction.cs │ │ └── HelloWorld.csproj │ ├── HttpTriggerExample │ │ ├── HttpTriggerExample.csproj │ │ └── MyFunction.cs │ ├── AsyncFunctionExample │ │ ├── AsyncFunctionExample.csproj │ │ └── MyFunction.cs │ └── MultiFileExample │ │ ├── MyFunction.cs │ │ ├── MultiFileExample.csproj │ │ └── Models │ │ ├── User.cs │ │ ├── Weather.cs │ │ └── DataModels.cs ├── builder │ ├── Makefile │ ├── Dockerfile │ └── defaultBuildCmd ├── Makefile ├── envconfig.json ├── Dockerfile └── .gitignore ├── hack ├── sort-json.sh ├── buildx.sh └── merge-json.sh ├── go ├── examples │ ├── module-example │ │ ├── go.mod │ │ ├── main.go │ │ └── README.md │ ├── hello.go │ ├── specs │ │ ├── env.yaml │ │ ├── fission-deployment-config.yaml │ │ └── function-hello.yaml │ └── README.md ├── builder │ ├── Dockerfile-1.1x │ ├── Makefile │ └── build.sh ├── Makefile ├── Dockerfile-1.1x ├── README.md └── envconfig.json ├── README.md ├── .gitignore ├── .github ├── workflows │ ├── filters │ │ ├── filters.yaml │ │ └── version_filter.yaml │ └── README.md └── actions │ ├── collect-fission-dump │ └── action.yml │ └── setup-cluster │ └── action.yml ├── rules.mk ├── .mergify.yml └── kind.yaml /python/tests/src/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotnet20/.dockerignore: -------------------------------------------------------------------------------- 1 | builder -------------------------------------------------------------------------------- /nodejs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /python-fastapi/tests/src/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/examples/multifile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/examples/sourcepkg/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/tests/src/sub_mod/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jvm-jersey/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | bin/ 3 | -------------------------------------------------------------------------------- /python-fastapi/examples/multifile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python-fastapi/examples/sourcepkg/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python-fastapi/tests/src/sub_mod/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/examples/sourcepkg/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | -------------------------------------------------------------------------------- /nodejs/test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "commonjs" 3 | } -------------------------------------------------------------------------------- /python/examples/multifile/message.txt: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /python-fastapi/examples/multifile/message.txt: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | -------------------------------------------------------------------------------- /python-fastapi/examples/sourcepkg/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | -------------------------------------------------------------------------------- /binary/examples/headers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | env | grep "^HTTP_" -------------------------------------------------------------------------------- /binary/examples/hello.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Hello World!" -------------------------------------------------------------------------------- /nodejs/examples/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./hello'); 2 | -------------------------------------------------------------------------------- /nodejs/test/test-case-5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } -------------------------------------------------------------------------------- /nodejs/test/test-case-6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } -------------------------------------------------------------------------------- /nodejs/test/test-case-7/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } -------------------------------------------------------------------------------- /php7/examples/multifile/handlers/message.txt: -------------------------------------------------------------------------------- 1 | I said hellooooo! 2 | -------------------------------------------------------------------------------- /binary/examples/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | printf "... " 4 | /bin/cat - -------------------------------------------------------------------------------- /python-fastapi/requirements.txt: -------------------------------------------------------------------------------- 1 | fastapi==0.114.0 2 | uvicorn==0.30.6 3 | -------------------------------------------------------------------------------- /python/examples/hello.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | return "Hello, world!\n" 3 | -------------------------------------------------------------------------------- /python/tests/src/foo.py: -------------------------------------------------------------------------------- 1 | def bar(): 2 | return 'THIS_IS_FOO_BAR' 3 | -------------------------------------------------------------------------------- /jvm/examples/java/.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .settings 3 | .classpath 4 | target/ 5 | -------------------------------------------------------------------------------- /dotnet/.gitignore: -------------------------------------------------------------------------------- 1 | bin/* 2 | obj/* 3 | out/* 4 | .vscode/* 5 | project.lock* 6 | TODO_dotnet -------------------------------------------------------------------------------- /jvm-jersey/examples/java/.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .settings 3 | .classpath 4 | target/ 5 | -------------------------------------------------------------------------------- /php7/examples/hello.php: -------------------------------------------------------------------------------- 1 | warning("Hello logger"); -------------------------------------------------------------------------------- /jvm/.gitignore: -------------------------------------------------------------------------------- 1 | .springBeans 2 | .project 3 | .mvn 4 | .settings 5 | .classpath 6 | target/ 7 | bin/ 8 | -------------------------------------------------------------------------------- /python/tests/src/sub_mod/altmain.py: -------------------------------------------------------------------------------- 1 | def entrypoint(): 2 | return 'THIS_IS_ALTMAIN_ENTRYPOINT' 3 | -------------------------------------------------------------------------------- /tensorflow-serving/examples/half_plus_two/00000123/variables/variables.data-00000-of-00001: -------------------------------------------------------------------------------- 1 | ?@@@ -------------------------------------------------------------------------------- /jvm/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: jvm-env-img 5 | 6 | jvm-env-img: Dockerfile -------------------------------------------------------------------------------- /ruby/examples/hello.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | def handler 3 | "Hello, world!\n" 4 | end 5 | -------------------------------------------------------------------------------- /perl/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: perl-env-img 5 | 6 | perl-env-img: Dockerfile -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/requirements.txt: -------------------------------------------------------------------------------- 1 | redis==3.5.3 2 | MarkupSafe==2.1.4 3 | python-multipart==0.0.9 4 | -------------------------------------------------------------------------------- /ruby/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | source "https://rubygems.org" 3 | 4 | gem "rack" 5 | gem "thin" 6 | -------------------------------------------------------------------------------- /php7/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: php-builder php-env-img 5 | 6 | php-env-img: Dockerfile -------------------------------------------------------------------------------- /python/examples/multifile/readfile.py: -------------------------------------------------------------------------------- 1 | def readFile(name): 2 | with open(name) as f: 3 | return f.read() 4 | -------------------------------------------------------------------------------- /ruby/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: ruby-builder ruby-env-img 5 | 6 | ruby-env-img: Dockerfile -------------------------------------------------------------------------------- /jvm/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: jvm-builder-img 5 | 6 | jvm-builder-img : Dockerfile -------------------------------------------------------------------------------- /php7/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: php-builder-img 5 | 6 | php-builder-img: Dockerfile -------------------------------------------------------------------------------- /python-fastapi/examples/multifile/readfile.py: -------------------------------------------------------------------------------- 1 | def readFile(name): 2 | with open(name) as f: 3 | return f.read() 4 | -------------------------------------------------------------------------------- /python/tests/src/main.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | return 'THIS_IS_MAIN_MAIN' 3 | 4 | def func(): 5 | return 'THIS_IS_MAIN_FUNC' 6 | -------------------------------------------------------------------------------- /ruby/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: ruby-builder-img 5 | 6 | ruby-builder-img: Dockerfile -------------------------------------------------------------------------------- /binary/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: binary-builder-img 5 | 6 | binary-builder-img: Dockerfile -------------------------------------------------------------------------------- /dotnet/project-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dotnet restore fission-dotnet.csproj 3 | dotnet publish fission-dotnet.csproj -c Release -o out 4 | -------------------------------------------------------------------------------- /jvm/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eou pipefail 3 | mvn clean package 4 | cp ${SRC_PKG}/target/*with-dependencies.jar ${DEPLOY_PKG} -------------------------------------------------------------------------------- /dotnet20/project-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dotnet restore fission-dotnet20.csproj 3 | dotnet publish fission-dotnet20.csproj -c Release -o out 4 | -------------------------------------------------------------------------------- /jvm-jersey/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: jvm-jersey-env-22-img 5 | 6 | jvm-jersey-env-22-img: Dockerfile 7 | -------------------------------------------------------------------------------- /jvm-jersey/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eou pipefail 3 | mvn clean package 4 | cp ${SRC_PKG}/target/*with-dependencies.jar ${DEPLOY_PKG} -------------------------------------------------------------------------------- /nodejs/examples/hello-callback.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = (context, callback) => { 3 | callback(200, "Hello, world callback!\n"); 4 | } 5 | -------------------------------------------------------------------------------- /python/examples/sourcepkg/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG} -------------------------------------------------------------------------------- /dotnet/Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS ?= linux/amd64 2 | 3 | -include ../rules.mk 4 | 5 | .PHONY: all 6 | all: dotnet-env-img 7 | 8 | dotnet-env-img: Dockerfile -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG} 3 | -------------------------------------------------------------------------------- /python-fastapi/examples/sourcepkg/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG} 3 | -------------------------------------------------------------------------------- /python-fastapi/tests/src/foo.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, Response 2 | 3 | def bar(request: Request): 4 | return Response('THIS_IS_FOO_BAR') 5 | -------------------------------------------------------------------------------- /tensorflow-serving/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: tensorflow-serving-env-img 5 | 6 | tensorflow-serving-env-img: Dockerfile -------------------------------------------------------------------------------- /jvm-jersey/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: jvm-jersey-builder-22-img 5 | 6 | jvm-jersey-builder-22-img: Dockerfile 7 | -------------------------------------------------------------------------------- /python-fastapi/examples/statuscode.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, Response 2 | 3 | def main(request: Request): 4 | return Response("Not Found", 404) 5 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 63b7bdec7d16ea8774fceb5335d6bcd9b1cb54c905159b91a92d392e27eb7b7b 2 | -------------------------------------------------------------------------------- /nodejs/examples/echo.js: -------------------------------------------------------------------------------- 1 | module.exports = async function(ws, clients) { 2 | 3 | ws.on('message', message => { 4 | ws.send(message) 5 | }); 6 | } 7 | -------------------------------------------------------------------------------- /nodejs/examples/hello.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = async (context) => { 3 | return { 4 | status: 200, 5 | body: "hello, world!\n" 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /nodejs/test/test-case-1/helloWorld.js: -------------------------------------------------------------------------------- 1 | module.exports = async (context) => { 2 | return { 3 | status: 200, 4 | body: "hello, world!\n", 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /dotnet20/Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS ?= linux/amd64 2 | 3 | -include ../rules.mk 4 | 5 | .PHONY: all 6 | all: dotnet20-builder dotnet20-env-img 7 | 8 | dotnet20-env-img: Dockerfile -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 3e116a7e531ffaf5633e32e0bf4deb38175e8205076e04a01b1d750018d2f736 2 | -------------------------------------------------------------------------------- /python-fastapi/examples/hello.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, Response 2 | 3 | def main(request: Request): 4 | return Response(content="Hello, World!", status_code=200) -------------------------------------------------------------------------------- /dotnet20/builder/Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS ?= linux/amd64 2 | 3 | -include ../../rules.mk 4 | 5 | .PHONY: all 6 | all: dotnet20-builder-img 7 | 8 | dotnet20-builder-img: Dockerfile -------------------------------------------------------------------------------- /hack/sort-json.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | JQ=jq 4 | for file in $(find . -name envconfig.json); do 5 | $JQ . -S <$file >$file.sorted 6 | mv $file.sorted $file 7 | done 8 | -------------------------------------------------------------------------------- /python-fastapi/tests/src/sub_mod/altmain.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, Response 2 | 3 | def entrypoint(request: Request): 4 | return Response('THIS_IS_ALTMAIN_ENTRYPOINT') 5 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Controllers/BuildController.cs: -------------------------------------------------------------------------------- 1 | // This controller is not needed in the runtime environment 2 | // Build functionality is handled by the separate builder container -------------------------------------------------------------------------------- /go/examples/module-example/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/fission/environments/go/examples/module-example 2 | 3 | go 1.22 4 | 5 | require golang.org/x/example v0.0.0-20210811190340-787a929d5a0d 6 | -------------------------------------------------------------------------------- /tensorflow-serving/examples/half_plus_two/00000123/saved_model.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/tensorflow-serving/examples/half_plus_two/00000123/saved_model.pb -------------------------------------------------------------------------------- /python/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: python-env-img 5 | 6 | python-env-img-buildargs := --build-arg PY_BASE_IMG=3.11-alpine 7 | 8 | python-env-img: Dockerfile 9 | -------------------------------------------------------------------------------- /binary/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder:latest 2 | FROM ${BUILDER_IMAGE} 3 | 4 | FROM alpine:3.20 5 | 6 | COPY --from=0 /builder /builder 7 | 8 | ADD build.sh /usr/local/bin/build -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /perl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM perl:latest 2 | 3 | RUN cpanm -n Twiggy Getopt::Args Dancer2 4 | 5 | COPY server.pl /server.pl 6 | WORKDIR / 7 | 8 | EXPOSE 8888 9 | ENTRYPOINT ["/server.pl"] 10 | -------------------------------------------------------------------------------- /ruby/builder/defaultBuildCmd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -euxo pipefail 3 | 4 | if [ -f ${SRC_PKG}/Gemfile.lock ] 5 | then 6 | cd $SRC_PKG 7 | bundle install --deployment 8 | fi 9 | cp -r ${SRC_PKG} ${DEPLOY_PKG} -------------------------------------------------------------------------------- /dotnet20/envsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "LogDirectory": "logs", 3 | "RunningOnwindows": false, 4 | "DllDirectory": "Dlls", 5 | "functionBodyFileName": "func.cs", 6 | "functionSpecFileName": "func.meta.json" 7 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.dll -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.pdb -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.dll -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.pdb -------------------------------------------------------------------------------- /ruby/examples/parse/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 | 7 | gem "nokogiri", ">= 1.12.5" -------------------------------------------------------------------------------- /tensorflow-serving/examples/half_plus_two/00000123/variables/variables.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/tensorflow-serving/examples/half_plus_two/00000123/variables/variables.index -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/ref/Fission.DotNet.Common.dll -------------------------------------------------------------------------------- /python/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: python-builder-img 5 | 6 | python-builder-img-buildargs := --build-arg PY_BASE_IMG=3.11-alpine 7 | 8 | python-builder-img: Dockerfile 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fission Environments 2 | 3 | A set of language environments for Fission. 4 | 5 | Please visit [Environments Reference](https://fission.io/environments/) to get information about different environments. 6 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/refint/Fission.DotNet.Common.dll -------------------------------------------------------------------------------- /python/examples/statuscode.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | # You can return any http status code you like, simply place a comma after 3 | # your return statement, and typing in the status code. 4 | return "Not Found\n", 404 5 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidchase/environments/master/dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.assets.cache -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /python-fastapi/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: python-fastapi-env-img 5 | 6 | python-fastapi-env-img-buildargs := --build-arg PY_BASE_IMG=3.11-alpine 7 | 8 | python-fastapi-env-img: Dockerfile 9 | -------------------------------------------------------------------------------- /python/builder/defaultBuildCmd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -euxo pipefail 3 | 4 | if [ -f ${SRC_PKG}/requirements.txt ] 5 | then 6 | pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} 7 | fi 8 | cp -r ${SRC_PKG} ${DEPLOY_PKG} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | environments-ui/node_modules 2 | #environments-ui/src/resources/environments.json 3 | environments-ui/public/bundle.js 4 | environments-ui/server.js 5 | .vscode 6 | node_modules 7 | **/node_modules/** 8 | *.DS_Store 9 | -------------------------------------------------------------------------------- /dotnet/examples/helloworld.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNetCore.Api; 2 | 3 | public class FissionFunction 4 | { 5 | public string Execute(FissionContext context) 6 | { 7 | return "Hello World!"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /python/examples/sourcepkg/user.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | document = """ 4 | a: 1 5 | b: 6 | c: 3 7 | d: 4 8 | """ 9 | 10 | def main(): 11 | return yaml.dump(yaml.load(document), default_flow_style=None) 12 | -------------------------------------------------------------------------------- /ruby/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.6.1-alpine3.9 2 | 3 | RUN apk update 4 | RUN apk add --no-cache build-base 5 | 6 | COPY . /app 7 | WORKDIR /app 8 | RUN bundle install 9 | 10 | ENTRYPOINT ["ruby"] 11 | CMD ["server.rb"] 12 | -------------------------------------------------------------------------------- /binary/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: binary-builder binary-env-img 5 | 6 | binary-env-img-buildargs := --build-arg GO_BASE_IMAGE=1.22-alpine --build-arg ALPINE_VERSION=3.20 7 | 8 | binary-env-img: Dockerfile -------------------------------------------------------------------------------- /dotnet20/examples/helloworld.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNetCore.Api; 2 | 3 | public class FissionFunction 4 | { 5 | public string Execute(FissionContext context) 6 | { 7 | return "Hello World!"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.sourcelink.json: -------------------------------------------------------------------------------- 1 | {"documents":{"/Users/davidcasa/environments/*":"https://raw.githubusercontent.com/davidchase/environments/da8ab386daab96def321895f43b0f975caf774ca/*"}} -------------------------------------------------------------------------------- /nodejs/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${SRC_PKG} 3 | if [[ -n "$NPM_TOKEN" ]] && [[ -n "$NPM_REGISTRY" ]]; then 4 | npm set //${NPM_REGISTRY}/:_authToken ${NPM_TOKEN} 5 | fi 6 | npm install && cp -r ${SRC_PKG} ${DEPLOY_PKG} 7 | -------------------------------------------------------------------------------- /php7/builder/defaultBuildCmd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -euxo pipefail 3 | 4 | if [ -f ${SRC_PKG}/composer.json ] 5 | then 6 | cd ${SRC_PKG} 7 | composer install --no-interaction 8 | fi 9 | cp -r ${SRC_PKG} ${DEPLOY_PKG} 10 | -------------------------------------------------------------------------------- /python-fastapi/builder/defaultBuildCmd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -euxo pipefail 3 | 4 | if [ -f ${SRC_PKG}/requirements.txt ] 5 | then 6 | pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} 7 | fi 8 | cp -r ${SRC_PKG} ${DEPLOY_PKG} -------------------------------------------------------------------------------- /python-fastapi/tests/src/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, Response 2 | 3 | def main(request: Request): 4 | return Response('THIS_IS_MAIN_MAIN') 5 | 6 | def func(request: Request): 7 | return Response('THIS_IS_MAIN_FUNC') 8 | -------------------------------------------------------------------------------- /binary/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | apk update 4 | 5 | CWD=$(pwd) 6 | 7 | if [ -f ${SRC_PKG}/build.sh ]; then 8 | cd ${SRC_PKG} 9 | ./build.sh 10 | cd ${CWD} 11 | fi 12 | 13 | cp -rf ${SRC_PKG} ${DEPLOY_PKG} 14 | -------------------------------------------------------------------------------- /dotnet8/examples/HelloWorld/MyFunction.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNet.Common; 2 | 3 | public class MyFunction 4 | { 5 | public object Execute(FissionContext context) 6 | { 7 | return "Hello World!x"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /python-fastapi/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: python-fastapi-builder-img 5 | 6 | python-fastapi-builder-img-buildargs := --build-arg PY_BASE_IMG=3.11-alpine 7 | 8 | python-fastapi-builder-img: Dockerfile 9 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Interfaces/ISpecializeService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNet.Model; 3 | 4 | namespace Fission.DotNet.Interfaces; 5 | 6 | public interface ISpecializeService 7 | { 8 | void Specialize(FissionSpecializeRequest request); 9 | } 10 | -------------------------------------------------------------------------------- /go/examples/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | // Handler is the entry point for this fission function 8 | func Handler(w http.ResponseWriter, r *http.Request) { 9 | msg := "Hello, world!\n" 10 | w.Write([]byte(msg)) 11 | } 12 | -------------------------------------------------------------------------------- /binary/examples/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | // See README.md in the examples/binary directory for instructions 9 | func main() { 10 | fmt.Println("Hello World!") 11 | fmt.Printf("Environment: %v", os.Environ()) 12 | } 13 | -------------------------------------------------------------------------------- /python/examples/requestdata.py: -------------------------------------------------------------------------------- 1 | from flask import request 2 | from flask import current_app 3 | 4 | def main(): 5 | current_app.logger.info("Received request") 6 | msg = "---HEADERS---\n%s\n--BODY--\n%s\n-----\n" % (request.headers, request.get_data()) 7 | return msg 8 | -------------------------------------------------------------------------------- /binary/examples/module-example/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | num1=0 4 | num2=1 5 | 6 | i=0 7 | while [ "$i" -le 10 ] 8 | do 9 | echo "$num1 " 10 | sum=$((num1+num2)) 11 | num1=$num2 12 | num2=$sum 13 | i=$(( i + 1 )) 14 | done 15 | echo "Modules are awesome!" -------------------------------------------------------------------------------- /nodejs/examples/broadcast.js: -------------------------------------------------------------------------------- 1 | module.exports = async function(ws, clients) { 2 | 3 | ws.on('message', function incoming(data) { 4 | clients.forEach(function each(client) { 5 | client.send(data); 6 | }); 7 | }); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /python/examples/websocket/main.py: -------------------------------------------------------------------------------- 1 | def main(ws, clients): 2 | print("The number of clients is: {}".format(len(clients))) 3 | count = 0 4 | while not ws.closed and count < 5: 5 | message = ws.receive() 6 | ws.send(message) 7 | count += 1 8 | ws.close() -------------------------------------------------------------------------------- /php7/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "autoload": { 3 | "psr-4": { 4 | "PHPEnv\\": "src/" 5 | } 6 | }, 7 | "require": { 8 | "monolog/monolog": "^1.22", 9 | "react/http": "^0.8.4", 10 | "nikic/php-parser": "^4.2" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] 5 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "j1Y/WP+AzWA=", 4 | "success": true, 5 | "projectFilePath": "/Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj", 6 | "expectedPackageFiles": [], 7 | "logs": [] 8 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Interfaces/IFunctionStoreService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNet.Model; 3 | 4 | namespace Fission.DotNet.Interfaces; 5 | 6 | public interface IFunctionStoreService 7 | { 8 | void SetFunction(FunctionStore function); 9 | FunctionStore GetFunction(); 10 | } 11 | -------------------------------------------------------------------------------- /go/builder/Dockerfile-1.1x: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder 2 | ARG GO_VERSION 3 | 4 | FROM ${BUILDER_IMAGE} 5 | 6 | FROM golang:${GO_VERSION} 7 | 8 | ENV GOPATH /usr 9 | ENV GO111MODULE on 10 | WORKDIR ${GOPATH} 11 | 12 | COPY --from=0 /builder /builder 13 | ADD build.sh /usr/local/bin/build 14 | -------------------------------------------------------------------------------- /go/examples/specs/env.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: fission.io/v1 2 | kind: Environment 3 | metadata: 4 | name: go 5 | namespace: default 6 | spec: 7 | version: 2 8 | builder: 9 | command: build 10 | image: fission/go-builder-1.12:1.5.0 11 | runtime: 12 | image: fission/go-env-1.12:1.5.0 13 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Model/FissionSpecializeRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Fission.DotNet.Model; 4 | 5 | public class FissionSpecializeRequest 6 | { 7 | public string filepath { get; set; } 8 | public string functionName { get; set; } 9 | public string url { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /nodejs/test/test.js: -------------------------------------------------------------------------------- 1 | module.exports = async function (context) { 2 | console.log("headers=", JSON.stringify(context.request.headers)); 3 | console.log("body=", JSON.stringify(context.request.body)); 4 | 5 | return { 6 | status: 200, 7 | body: "Hello, world !\n" 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /python/examples/multifile/main.py: -------------------------------------------------------------------------------- 1 | from flask import current_app 2 | import sys 3 | import readfile 4 | import os 5 | 6 | def main(): 7 | current_app.logger.info("Hi") 8 | 9 | current_dir = os.path.dirname(__file__) 10 | 11 | return readfile.readFile(os.path.join(current_dir, "message.txt")) 12 | -------------------------------------------------------------------------------- /dotnet20/builder/Model/ExcludeDll.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Builder.Model 6 | { 7 | public class ExcludeDll 8 | { 9 | public string dllName { get; set; } 10 | public string packageName { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dotnet20/builder/Model/IncludeNuget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Builder.Model 6 | { 7 | public class IncludeNuget 8 | { 9 | public string packageName { get; set; } 10 | public string version { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /python-fastapi/examples/requestdata.py: -------------------------------------------------------------------------------- 1 | from fastapi import logger, Request, Response 2 | 3 | async def main(request: Request): 4 | logger.logger.info("Received request") 5 | msg = "---HEADERS---\n%s\n--BODY--\n%s\n-----\n" % (request.headers, str(await request.body(), encoding='utf-8')) 6 | return Response(msg) 7 | -------------------------------------------------------------------------------- /dotnet20/examples/echo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNetCore.Api; 3 | 4 | public class FissionFunction 5 | { 6 | public string Execute(FissionContext context){ 7 | context.Logger.WriteInfo("executing.. {0}", context.Arguments["text"]); 8 | return (string)context.Arguments["text"]; 9 | } 10 | } -------------------------------------------------------------------------------- /jvm/examples/java/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script allows you to build the jar without needing Maven & JDK installed locally. 3 | # You need docker, as it uses a Docker image to build source code 4 | set -eou pipefail 5 | docker run -it --rm -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.5-jdk-8 mvn clean package 6 | -------------------------------------------------------------------------------- /nodejs/test/test-case-5/helloWorld.js: -------------------------------------------------------------------------------- 1 | // ESM helloWorld test case for Node.js 22 2 | export default async (context) => { 3 | return { 4 | status: 200, 5 | body: "hello, world from ESM! 🎉\n", 6 | headers: { 7 | "X-Module-Type": "ESM", 8 | "X-Node-Version": process.version 9 | } 10 | }; 11 | }; -------------------------------------------------------------------------------- /ruby/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder:latest 2 | FROM ${BUILDER_IMAGE} 3 | 4 | FROM ruby:2.6.1-alpine3.9 5 | COPY --from=0 /builder /builder 6 | 7 | RUN apk update 8 | RUN apk add --no-cache ruby ruby-dev ruby-bundler build-base 9 | 10 | ADD defaultBuildCmd /usr/local/bin/build 11 | 12 | EXPOSE 8001 13 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script allows you to build the jar without needing Maven & JDK installed locally. 3 | # You need docker, as it uses a Docker image to build source code 4 | set -eou pipefail 5 | docker run -it --rm -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.5-jdk-8 mvn clean package 6 | -------------------------------------------------------------------------------- /nodejs/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_BASE_IMG 2 | ARG BUILDER_IMAGE=fission/builder:latest 3 | 4 | FROM ${BUILDER_IMAGE} 5 | 6 | FROM node:${NODE_BASE_IMG} 7 | 8 | ARG NODE_ENV 9 | ENV NODE_ENV $NODE_ENV 10 | 11 | COPY --from=0 /builder /builder 12 | ADD build.sh /usr/local/bin/build 13 | RUN chmod +x /usr/local/bin/build 14 | -------------------------------------------------------------------------------- /nodejs/examples/multi-entry.js: -------------------------------------------------------------------------------- 1 | module.exports.entry1 = async (context) => { 2 | return { 3 | status: 200, 4 | body: "Hello, entry 1!\n" 5 | }; 6 | } 7 | 8 | module.exports.entry2 = async (context) => { 9 | return { 10 | status: 200, 11 | body: "Hello, entry 2!\n" 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /go/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: go-builder-img go-builder-1.23-img 5 | 6 | go-builder-img-buildargs := --build-arg GO_VERSION=1.22 7 | 8 | go-builder-1.23-img-buildargs := --build-arg GO_VERSION=1.23 9 | 10 | go-builder-img: Dockerfile-1.1x 11 | 12 | go-builder-1.23-img: Dockerfile-1.1x 13 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Interfaces/IFunctionService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNet.Common; 3 | 4 | namespace Fission.DotNet.Interfaces; 5 | 6 | public interface IFunctionService 7 | { 8 | void Load(); 9 | void Unload(); 10 | Task Execute(FissionContext context); 11 | ICorsPolicy GetCorsPolicy(); 12 | } 13 | -------------------------------------------------------------------------------- /go/examples/specs/fission-deployment-config.yaml: -------------------------------------------------------------------------------- 1 | # This file is generated by the 'fission spec init' command. 2 | # See the README in this directory for background and usage information. 3 | # Do not edit the UID below: that will break 'fission spec apply' 4 | kind: DeploymentConfig 5 | name: hello-go 6 | uid: a8cdb63c-9be8-4a59-9427-89051afecd7b 7 | -------------------------------------------------------------------------------- /python/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder 2 | ARG PY_BASE_IMG=3.11-alpine 3 | 4 | FROM ${BUILDER_IMAGE} 5 | FROM python:${PY_BASE_IMG} 6 | 7 | COPY --from=0 /builder /builder 8 | RUN apk add --update --no-cache python3-dev build-base gcc bash 9 | 10 | ADD defaultBuildCmd /usr/local/bin/build 11 | 12 | EXPOSE 8001 13 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Services/BuilderModeService.cs: -------------------------------------------------------------------------------- 1 | namespace Fission.DotNet.Services 2 | { 3 | public class BuilderModeService 4 | { 5 | public bool IsBuilderMode { get; } 6 | 7 | public BuilderModeService(bool isBuilderMode) 8 | { 9 | IsBuilderMode = isBuilderMode; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /python-fastapi/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder 2 | ARG PY_BASE_IMG=3.11-alpine 3 | 4 | FROM ${BUILDER_IMAGE} 5 | FROM python:${PY_BASE_IMG} 6 | 7 | COPY --from=0 /builder /builder 8 | RUN apk add --update --no-cache python3-dev build-base gcc bash 9 | 10 | ADD defaultBuildCmd /usr/local/bin/build 11 | 12 | EXPOSE 8001 13 | -------------------------------------------------------------------------------- /ruby/examples/parse/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | mini_portile2 (2.6.1) 5 | nokogiri (1.12.5) 6 | mini_portile2 (~> 2.6.1) 7 | racc (~> 1.4) 8 | racc (1.5.2) 9 | 10 | PLATFORMS 11 | ruby 12 | 13 | DEPENDENCIES 14 | nokogiri (>= 1.12.5) 15 | 16 | BUNDLED WITH 17 | 1.17.3 18 | -------------------------------------------------------------------------------- /dotnet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:1.1-sdk AS builder 2 | 3 | COPY * /proj/ 4 | RUN cd /proj && ./project-build.sh 5 | 6 | # Build env image 7 | FROM microsoft/dotnet:1.1.0-runtime 8 | 9 | WORKDIR /fission-workdir 10 | COPY --from=builder /proj/out . 11 | EXPOSE 8888 12 | 13 | ENTRYPOINT ["dotnet"] 14 | 15 | CMD ["fission-dotnet.dll"] 16 | -------------------------------------------------------------------------------- /dotnet/examples/arguments.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNetCore.Api; 3 | 4 | public class FissionFunction 5 | { 6 | public string Execute(FissionContext context){ 7 | var x = Convert.ToInt32(context.Arguments["x"]); 8 | var y = Convert.ToInt32(context.Arguments["y"]); 9 | return (x+y).ToString(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /dotnet20/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.0.0-sdk AS builder 2 | 3 | COPY * /proj/ 4 | RUN cd /proj && ./project-build.sh 5 | 6 | # Build env image 7 | FROM microsoft/dotnet:2.0-runtime 8 | 9 | WORKDIR /fission-workdir 10 | COPY --from=builder /proj/out . 11 | EXPOSE 8888 12 | 13 | ENTRYPOINT ["dotnet"] 14 | 15 | CMD ["fission-dotnet20.dll"] 16 | -------------------------------------------------------------------------------- /python-fastapi/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PY_BASE_IMG=3.11-alpine 2 | 3 | FROM python:${PY_BASE_IMG} 4 | 5 | WORKDIR /app 6 | 7 | RUN pip install --no-cache-dir --upgrade pip 8 | 9 | COPY requirements.txt /app 10 | RUN pip install --no-cache-dir --upgrade -r requirements.txt 11 | 12 | COPY *.py /app 13 | 14 | ENTRYPOINT ["python3"] 15 | CMD ["server.py"] 16 | -------------------------------------------------------------------------------- /python-fastapi/examples/multifile/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import logger, Request, Response 2 | import sys 3 | import readfile 4 | import os 5 | 6 | def main(request: Request): 7 | logger.logger.info("Hi") 8 | 9 | current_dir = os.path.dirname(__file__) 10 | 11 | return Response(readfile.readFile(os.path.join(current_dir, "message.txt"))) 12 | -------------------------------------------------------------------------------- /dotnet20/examples/arguments.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNetCore.Api; 3 | 4 | public class FissionFunction 5 | { 6 | public string Execute(FissionContext context){ 7 | var x = Convert.ToInt32(context.Arguments["x"]); 8 | var y = Convert.ToInt32(context.Arguments["y"]); 9 | return (x+y).ToString(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /nodejs/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_BASE_IMG 2 | 3 | FROM node:${NODE_BASE_IMG} 4 | 5 | ARG NODE_ENV 6 | ENV NODE_ENV $NODE_ENV 7 | 8 | RUN mkdir -p /usr/src/app 9 | WORKDIR /usr/src/app 10 | 11 | COPY package.json /usr/src/app/ 12 | RUN npm install && npm cache clean --force 13 | COPY server.js /usr/src/app/server.js 14 | 15 | CMD [ "npm", "start" ] 16 | 17 | EXPOSE 8888 -------------------------------------------------------------------------------- /ruby/examples/parse/parse.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'nokogiri' 4 | 5 | def handler(context) 6 | context.logger.info("Received request") 7 | 8 | doc = Nokogiri::XML(context.request.body.read) 9 | ele = doc.at_xpath('//message') 10 | msg = ele.nil? ? 'No Message' : ele.content 11 | 12 | Rack::Response.new([msg, "\n"]).finish 13 | end -------------------------------------------------------------------------------- /go/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: go-env-img go-env-1.23-img 5 | 6 | go-env-img-buildargs := --build-arg GO_VERSION=1.22 --build-arg UBUNTU_VERSION=22.04 7 | 8 | go-env-1.23-img-buildargs := --build-arg GO_VERSION=1.23 --build-arg UBUNTU_VERSION=22.04 9 | 10 | go-env-img: Dockerfile-1.1x 11 | 12 | go-env-1.23-img: Dockerfile-1.1x 13 | 14 | -------------------------------------------------------------------------------- /jvm/examples/java/specs/fission-deployment-config.yaml: -------------------------------------------------------------------------------- 1 | # This file is generated by the 'fission spec init' command. 2 | # See the README in this directory for background and usage information. 3 | # Do not edit the UID below: that will break 'fission spec apply' 4 | apiVersion: fission.io/v1 5 | kind: DeploymentConfig 6 | name: java 7 | uid: 908a303a-bf23-4bae-a22c-b1db9a1f71a9 8 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/specs/fission-deployment-config.yaml: -------------------------------------------------------------------------------- 1 | # This file is generated by the 'fission spec init' command. 2 | # See the README in this directory for background and usage information. 3 | # Do not edit the UID below: that will break 'fission spec apply' 4 | apiVersion: fission.io/v1 5 | kind: DeploymentConfig 6 | name: java-jersey 7 | uid: 908a303a-bf23-4bae-a22c-b1db9a1f71a9 8 | -------------------------------------------------------------------------------- /python/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PY_BASE_IMG=3.11-alpine 2 | 3 | FROM python:${PY_BASE_IMG} 4 | 5 | WORKDIR /app 6 | 7 | RUN apk add --update --no-cache gcc python3-dev build-base libev-dev libffi-dev bash 8 | 9 | COPY requirements.txt /app 10 | RUN pip3 install -r requirements.txt 11 | 12 | COPY *.py /app/ 13 | 14 | ENV PYTHONUNBUFFERED=1 15 | ENTRYPOINT ["python3"] 16 | CMD ["server.py"] 17 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GlobalUsings.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | global using global::System; 3 | global using global::System.Collections.Generic; 4 | global using global::System.IO; 5 | global using global::System.Linq; 6 | global using global::System.Net.Http; 7 | global using global::System.Threading; 8 | global using global::System.Threading.Tasks; 9 | -------------------------------------------------------------------------------- /ruby/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | daemons (1.3.1) 5 | eventmachine (1.2.7) 6 | rack (2.1.4) 7 | thin (1.7.2) 8 | daemons (~> 1.0, >= 1.0.9) 9 | eventmachine (~> 1.0, >= 1.0.4) 10 | rack (>= 1, < 3) 11 | 12 | PLATFORMS 13 | ruby 14 | 15 | DEPENDENCIES 16 | rack 17 | thin 18 | 19 | BUNDLED WITH 20 | 1.15.1 21 | -------------------------------------------------------------------------------- /php7/examples/multifile/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example/php7", 3 | "description": "Example for php7 environment", 4 | "require": { 5 | "psr/log": "^1.1", 6 | "psr/http-message": "^1.0" 7 | }, 8 | "authors": [ 9 | { 10 | "name": "Alberto Lopez", 11 | "email": "alberto.lopez.benito@gmail.com" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /nodejs/test/test-case-2/helloUser.js: -------------------------------------------------------------------------------- 1 | var url = require("url"); 2 | 3 | module.exports = async (context) => { 4 | console.log(context.request.url); 5 | 6 | var url_parts = url.parse(context.request.url, true); 7 | var query = url_parts.query; 8 | 9 | console.log("query user : ", query.user); 10 | 11 | return { 12 | status: 200, 13 | body: "hello " + query.user + "!", 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /python/Dockerfile-buster: -------------------------------------------------------------------------------- 1 | # offical docker image of python debian buster variant 2 | ARG PY_BASE_IMG 3 | 4 | FROM ${PY_BASE_IMG} 5 | 6 | RUN apt-get update -y && apt-get install -y python3-dev libev-dev 7 | WORKDIR /app 8 | 9 | COPY requirements.txt /app 10 | RUN pip3 install -r requirements.txt 11 | 12 | COPY . /app 13 | 14 | ENV PYTHONUNBUFFERED 1 15 | ENTRYPOINT ["python3"] 16 | CMD ["server.py"] 17 | -------------------------------------------------------------------------------- /nodejs/examples/hello-esm.js: -------------------------------------------------------------------------------- 1 | export default async (context) => { 2 | return { 3 | status: 200, 4 | body: JSON.stringify({ 5 | message: "Hello from Node.js 22 Pure ESM! 🚀", 6 | nodeVersion: process.version, 7 | moduleType: "ESM", 8 | timestamp: new Date().toISOString() 9 | }, null, 2), 10 | headers: { 11 | "Content-Type": "application/json" 12 | } 13 | }; 14 | }; -------------------------------------------------------------------------------- /dotnet8/examples/HttpTriggerExample/HttpTriggerExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Library 4 | net8.0 5 | 6 | 7 | 8 | ./Fission.DotNet.Common.dll 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /dotnet8/examples/HelloWorld/HelloWorld.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Library 4 | net8.0 5 | 6 | 7 | 8 | ./Fission.DotNet.Common.dll 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jvm/examples/java/specs/env-java.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: fission.io/v1 2 | kind: Environment 3 | metadata: 4 | creationTimestamp: null 5 | name: java 6 | namespace: default 7 | spec: 8 | builder: 9 | command: build 10 | image: fission/jvm-builder:1.7.1 11 | imagepullsecret: "" 12 | keeparchive: true 13 | poolsize: 3 14 | resources: {} 15 | runtime: 16 | image: fission/jvm-env:1.7.1 17 | version: 2 18 | -------------------------------------------------------------------------------- /dotnet8/examples/AsyncFunctionExample/AsyncFunctionExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Library 5 | net8.0 6 | 7 | 8 | 9 | 10 | ./Fission.DotNet.Common.dll 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/specs/env-java.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: fission.io/v1 2 | kind: Environment 3 | metadata: 4 | creationTimestamp: null 5 | name: java-jersey 6 | namespace: default 7 | spec: 8 | builder: 9 | command: build 10 | image: fission/jvm-jersey-builder 11 | imagepullsecret: "" 12 | keeparchive: true 13 | poolsize: 3 14 | resources: {} 15 | runtime: 16 | image: fission/jvm-jersey-env 17 | version: 2 18 | -------------------------------------------------------------------------------- /nodejs/test/test-case-4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-runtime", 3 | "engines": { 4 | "node": ">=7.6.0" 5 | }, 6 | "dependencies": { 7 | "moment": "*" 8 | }, 9 | "version": "1.0.0", 10 | "main": "momentExample.js", 11 | "scripts": { 12 | "test": "echo \"Error: no test specified\" && exit 1" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "description": "" 18 | } 19 | -------------------------------------------------------------------------------- /ruby/fission/context.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'request' 4 | require 'forwardable' 5 | 6 | module Fission 7 | class Context 8 | extend Forwardable 9 | 10 | def_instance_delegator :request, :logger 11 | 12 | attr_reader :env 13 | 14 | def initialize(env) 15 | @env = env 16 | end 17 | 18 | def request 19 | @request ||= Request.new(env) 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Fission.DotNet.Common 4 | { 5 | public interface ILogger 6 | { 7 | void LogInformation(string message); 8 | void LogDebug(string message); 9 | void LogWarning(string message); 10 | void LogError(string message); 11 | void LogCritical(string message); 12 | void LogError(string message, Exception exception); 13 | } 14 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Controllers/HealthController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace Fission.DotNet.Controllers 4 | { 5 | [ApiController] 6 | public class HealthController : ControllerBase 7 | { 8 | [HttpGet] 9 | [Route("/healthz")] 10 | public IActionResult Health() 11 | { 12 | return Ok(new { status = "healthy", timestamp = DateTime.UtcNow }); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /dotnet20/Model/DllInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Fission.DotNetCore.Model 6 | { 7 | public class DllInfo 8 | { 9 | public string name { get; set; } 10 | public string rootPackage { get; set; } 11 | public string framework { get; set; } 12 | 13 | public string processor { get; set; } 14 | public string path { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dotnet20/builder/builderSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "NugetSpecsFile": "nuget.txt", 3 | "DllExcludeFile": "exclude.txt", 4 | "BuildLogDirectory": "logs", 5 | "DllDirectory": "Dlls", 6 | "NugetPackageRegEx": "\\s*(?[^:\\n]*)(?:\\:)?(?.*)?", 7 | "ExcludeDllRegEx": "\\:?\\s*(?[^:\\n]*)(?:\\:)?(?.*)?", 8 | "RunningOnwindows": false, 9 | "functionBodyFileName": "func.cs", 10 | "functionSpecFileName": "func.meta.json" 11 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/ICorsPolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Fission.DotNet.Common 4 | { 5 | public interface ICorsPolicy 6 | { 7 | void AllowAnyOrigin(); 8 | void AllowAnyHeader(); 9 | void AllowAnyMethod(); 10 | void AllowCredentials(); 11 | 12 | void WithOrigin(string[] origin); 13 | void WithHeader(string[] header); 14 | void WithMethod(string[] method); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dotnet8/builder/Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS ?= linux/amd64,linux/arm64 2 | 3 | -include ../../rules.mk 4 | 5 | .PHONY: all 6 | all: dotnet8-builder-img 7 | 8 | # Override the rule to use parent directory as context 9 | dotnet8-builder-img: Dockerfile 10 | @echo === Building image $(REPO)/dotnet8-builder:$(TAG) using parent directory as context 11 | cd .. && docker buildx build --platform=$(PLATFORMS) -t $(REPO)/dotnet8-builder:$(TAG) $(DOCKER_FLAGS) -f builder/Dockerfile . -------------------------------------------------------------------------------- /nodejs/test/test-case-8/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-runtime", 3 | "type": "module", 4 | "engines": { 5 | "node": ">=7.6.0" 6 | }, 7 | "dependencies": { 8 | "moment": "*" 9 | }, 10 | "version": "1.0.0", 11 | "main": "momentExample.js", 12 | "scripts": { 13 | "test": "echo \"Error: no test specified\" && exit 1" 14 | }, 15 | "keywords": [], 16 | "author": "", 17 | "license": "ISC", 18 | "description": "" 19 | } 20 | -------------------------------------------------------------------------------- /go/examples/module-example/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net/http" 6 | 7 | "golang.org/x/example/stringutil" 8 | ) 9 | 10 | // Handler is the entry point for this fission function 11 | func Handler(w http.ResponseWriter, r *http.Request) { 12 | msg := stringutil.Reverse(stringutil.Reverse("Vendor Example Test")) 13 | _, err := w.Write([]byte(msg)) 14 | if err != nil { 15 | log.Printf("Error writing response: %v", err) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jvm/examples/java/src/main/java/io/fission/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import org.springframework.http.RequestEntity; 4 | import org.springframework.http.ResponseEntity; 5 | 6 | import io.fission.Function; 7 | import io.fission.Context; 8 | 9 | public class HelloWorld implements Function { 10 | 11 | @Override 12 | public ResponseEntity call(RequestEntity req, Context context) { 13 | return ResponseEntity.ok("Hello World!"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dotnet8/examples/HttpTriggerExample/MyFunction.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNet.Common; 2 | 3 | public class MyFunction 4 | { 5 | public object Execute(FissionContext context) 6 | { 7 | var httpContext = context as FissionHttpContext; 8 | if (httpContext != null) 9 | { 10 | return $"Hello from HTTP trigger! Method: {httpContext.Method}, URL: {httpContext.Url}"; 11 | } 12 | return "Hello from non-HTTP trigger!"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /nodejs/Makefile: -------------------------------------------------------------------------------- 1 | -include ../rules.mk 2 | 3 | .PHONY: all 4 | all: node-builder node-env-img node-env-debian-img node-env-22-img 5 | 6 | node-env-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0-alpine3.21 7 | 8 | node-env-debian-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0 9 | 10 | node-env-22-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0-alpine3.21 11 | 12 | node-env-img: Dockerfile 13 | 14 | node-env-debian-img: Dockerfile 15 | 16 | node-env-22-img: Dockerfile -------------------------------------------------------------------------------- /python-fastapi/examples/sourcepkg/user.py: -------------------------------------------------------------------------------- 1 | from yaml import load, dump 2 | from fastapi import Request, Response 3 | 4 | try: 5 | from yaml import CLoader as Loader, CDumper as Dumper 6 | except ImportError: 7 | from yaml import Loader, Dumper 8 | 9 | document = """ 10 | a: 1 11 | b: 12 | c: 3 13 | d: 4 14 | """ 15 | 16 | 17 | def main(request: Request): 18 | return Response(dump(load(document, Loader=Loader), default_flow_style=None, Dumper=Dumper)) 19 | -------------------------------------------------------------------------------- /php7/examples/hellopsr.php: -------------------------------------------------------------------------------- 1 | getBody()->write("Hello from handler PHP"); 11 | $logger->warning("Hello logger"); 12 | } -------------------------------------------------------------------------------- /binary/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG GO_BASE_IMAGE 2 | ARG ALPINE_VERSION 3 | 4 | FROM golang:${GO_BASE_IMAGE} 5 | 6 | WORKDIR /binary 7 | COPY *.go /binary/ 8 | 9 | RUN go mod init github.com/fission/environments/binary 10 | RUN go mod tidy 11 | 12 | RUN go build -o server . 13 | 14 | FROM alpine:${ALPINE_VERSION} 15 | 16 | WORKDIR /app 17 | 18 | RUN apk update 19 | RUN apk add --no-cache coreutils binutils findutils grep 20 | 21 | COPY --from=0 /binary/server /app/server 22 | 23 | EXPOSE 8888 24 | ENTRYPOINT ["./server"] 25 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Services/FunctionStoreService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNet.Interfaces; 3 | using Fission.DotNet.Model; 4 | 5 | namespace Fission.DotNet.Services; 6 | 7 | public class FunctionStoreService : IFunctionStoreService 8 | { 9 | private FunctionStore _function; 10 | public FunctionStore GetFunction() 11 | { 12 | return _function; 13 | } 14 | 15 | public void SetFunction(FunctionStore function) 16 | { 17 | _function = function; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /nodejs/builder/Makefile: -------------------------------------------------------------------------------- 1 | -include ../../rules.mk 2 | 3 | .PHONY: all 4 | all: node-builder-debian-img node-builder-img node-builder-22-img 5 | 6 | node-builder-debian-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0 7 | 8 | node-builder-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0-alpine3.21 9 | 10 | node-builder-22-img-buildargs := --build-arg NODE_BASE_IMG=22.18.0-alpine3.21 11 | 12 | node-builder-debian-img: Dockerfile 13 | 14 | node-builder-img: Dockerfile 15 | 16 | node-builder-22-img: Dockerfile 17 | -------------------------------------------------------------------------------- /dotnet20/Model/EnvironmentSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Fission.DotNetCore.Model 6 | { 7 | public class EnvironmentSettings 8 | { 9 | public string LogDirectory { get; set; } 10 | 11 | public string DllDirectory { get; set; } 12 | public string functionBodyFileName { get; set; } 13 | public string functionSpecFileName { get; set; } 14 | public bool RunningOnwindows { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nodejs/test/test-case-8/momentExample.js: -------------------------------------------------------------------------------- 1 | // ESM momentExample test case for Node.js 22 2 | import moment from "moment"; 3 | 4 | export default async (context) => { 5 | return { 6 | status: 200, 7 | body: JSON.stringify({ 8 | message: "Hello from ESM Node.js 22! 🕐", 9 | timestamp: moment().format(), 10 | moduleType: "ESM", 11 | nodeVersion: process.version 12 | }), 13 | headers: { 14 | "Content-Type": "application/json", 15 | "X-Module-Type": "ESM" 16 | } 17 | }; 18 | }; -------------------------------------------------------------------------------- /nodejs/test/test-case-4/momentExample.js: -------------------------------------------------------------------------------- 1 | // CJS momentExample test case for Node.js 22 2 | const moment = require("moment"); 3 | 4 | module.exports = async (context) => { 5 | return { 6 | status: 200, 7 | body: JSON.stringify({ 8 | message: "Hello from CJS Node.js 22! 🕐", 9 | timestamp: moment().format(), 10 | moduleType: "CJS", 11 | nodeVersion: process.version 12 | }), 13 | headers: { 14 | "Content-Type": "application/json", 15 | "X-Module-Type": "CJS" 16 | } 17 | }; 18 | }; -------------------------------------------------------------------------------- /php7/examples/multifile/handlers/FileReader.php: -------------------------------------------------------------------------------- 1 | getBody()->write(file_get_contents(__DIR__ . '/message.txt')); 15 | $logger->debug('File read: example.txt'); 16 | } 17 | -------------------------------------------------------------------------------- /ruby/examples/request_data.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | def handler(context) 3 | context.logger.info("Received request") 4 | 5 | msg = <<~MSG 6 | ---ENV--- 7 | #{context.request.env.map { |h| h.join('=') }.join("\n") } 8 | 9 | ---HEADERS--- 10 | #{context.request.headers.map { |h| h.join(': ') }.join("\n") } 11 | 12 | ---PARAMS--- 13 | #{context.request.params.map { |h| h.join('=') }.join("\n") } 14 | 15 | --BODY-- 16 | #{context.request.body.read} 17 | MSG 18 | 19 | Rack::Response.new([msg]).finish 20 | end 21 | -------------------------------------------------------------------------------- /jvm/examples/java/specs/package-hellojava.yaml: -------------------------------------------------------------------------------- 1 | include: 2 | - src 3 | - pom.xml 4 | kind: ArchiveUploadSpec 5 | name: src-URlE 6 | 7 | --- 8 | apiVersion: fission.io/v1 9 | kind: Package 10 | metadata: 11 | creationTimestamp: null 12 | name: hellojava 13 | namespace: default 14 | spec: 15 | deployment: 16 | checksum: {} 17 | environment: 18 | name: java 19 | namespace: default 20 | source: 21 | checksum: {} 22 | type: url 23 | url: archive://src-URlE 24 | status: 25 | buildstatus: pending 26 | lastUpdateTimestamp: "2020-01-29T09:43:56Z" 27 | -------------------------------------------------------------------------------- /tensorflow-serving/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG GO_VERSION=1.13 2 | 3 | FROM tensorflow/serving as serving 4 | RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* 5 | 6 | FROM golang:${GO_VERSION} AS builder 7 | 8 | ENV GOPATH /usr 9 | ENV APP ${GOPATH}/src/github.com/fission/fission/environments/tensorflow-serving 10 | 11 | WORKDIR ${APP} 12 | 13 | ADD server.go ${APP} 14 | 15 | RUN go get 16 | RUN go build -a -o /server server.go 17 | 18 | FROM serving 19 | WORKDIR / 20 | COPY --from=builder /server / 21 | 22 | ENTRYPOINT ["/server"] 23 | EXPOSE 8888 24 | -------------------------------------------------------------------------------- /.github/workflows/filters/filters.yaml: -------------------------------------------------------------------------------- 1 | binary: 2 | - 'binary/**' 3 | jvm-jersey: 4 | - 'jvm-jersey/**' 5 | php7: 6 | - 'php7/**' 7 | dotnet: 8 | - 'dotnet/**' 9 | dotnet20: 10 | - 'dotnet20/**' 11 | dotnet8: 12 | - 'dotnet8/**' 13 | go: 14 | - 'go/**' 15 | jvm: 16 | - 'jvm/**' 17 | nodejs: 18 | - 'nodejs/**' 19 | perl: 20 | - 'perl/**' 21 | python: 22 | - 'python/**' 23 | python-fastapi: 24 | - 'python-fastapi/**' 25 | ruby: 26 | - 'ruby/**' 27 | tensorflow-serving: 28 | - 'tensorflow-serving/**' 29 | -------------------------------------------------------------------------------- /dotnet8/examples/AsyncFunctionExample/MyFunction.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNet.Common; 2 | using System.Threading.Tasks; 3 | 4 | public class MyFunction 5 | { 6 | public object Execute(FissionContext context) 7 | { 8 | // Call the async method and wait for it to complete 9 | return ExecuteAsync(context).GetAwaiter().GetResult(); 10 | } 11 | 12 | public async Task ExecuteAsync(FissionContext context) 13 | { 14 | await Task.Delay(1000); // Simulate an asynchronous operation 15 | return "Hello from async function!"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jvm-jersey/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM maven:3.9.9-eclipse-temurin-22-alpine AS build 2 | WORKDIR /usr/src/myapp/ 3 | 4 | # To reuse the build cache, here we split maven dependency 5 | # download and package into two RUN commands to avoid cache invalidation. 6 | COPY pom.xml . 7 | RUN mvn dependency:go-offline 8 | 9 | COPY src /usr/src/myapp/src/ 10 | RUN mvn package 11 | 12 | FROM eclipse-temurin:22-jdk-alpine 13 | COPY --from=build /usr/src/myapp/target/env-jvm-jersey-0.0.1.jar /app.jar 14 | ENTRYPOINT java ${JVM_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.jar 8888 15 | EXPOSE 8888 16 | -------------------------------------------------------------------------------- /python/examples/guestbook/add.py: -------------------------------------------------------------------------------- 1 | # 2 | # Handles POST /guestbook -- adds item to guestbook 3 | # 4 | 5 | from flask import request, redirect 6 | import redis 7 | 8 | # Connect to redis. 9 | redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0) 10 | 11 | def main(): 12 | # Read the item from POST params, add it to redis, and redirect 13 | # back to the list 14 | item = request.form['text'] 15 | redisConnection.rpush('guestbook', item) 16 | r = redirect('/guestbook', code=303) 17 | r.autocorrect_location_header = False 18 | return r 19 | -------------------------------------------------------------------------------- /go/Dockerfile-1.1x: -------------------------------------------------------------------------------- 1 | ARG GO_VERSION 2 | ARG UBUNTU_VERSION 3 | 4 | FROM ubuntu:${UBUNTU_VERSION} AS base 5 | WORKDIR / 6 | RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* 7 | 8 | FROM golang:${GO_VERSION} AS builder 9 | 10 | ENV GOPATH /usr 11 | ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go 12 | 13 | WORKDIR ${APP} 14 | 15 | ADD server.go ${APP} 16 | 17 | RUN go mod init 18 | RUN go mod tidy 19 | RUN go build -a -o /server server.go 20 | 21 | FROM base 22 | COPY --from=builder /server / 23 | 24 | ENTRYPOINT ["/server"] 25 | EXPOSE 8888 26 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/specs/package-hellojava.yaml: -------------------------------------------------------------------------------- 1 | include: 2 | - src 3 | - pom.xml 4 | kind: ArchiveUploadSpec 5 | name: src-URlE 6 | 7 | --- 8 | apiVersion: fission.io/v1 9 | kind: Package 10 | metadata: 11 | creationTimestamp: null 12 | name: hellojavajersey 13 | namespace: default 14 | spec: 15 | deployment: 16 | checksum: {} 17 | environment: 18 | name: java-jersey 19 | namespace: default 20 | source: 21 | checksum: {} 22 | type: url 23 | url: archive://src-URlE 24 | status: 25 | buildstatus: pending 26 | lastUpdateTimestamp: "2020-01-29T09:43:56Z" 27 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/bin/Release/net8.0/Fission.DotNet.Common.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v8.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v8.0": { 9 | "Fission.DotNet.Common/1.1.0": { 10 | "runtime": { 11 | "Fission.DotNet.Common.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "Fission.DotNet.Common/1.1.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /jvm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM maven:3.9.9-eclipse-temurin-22-alpine AS build 2 | WORKDIR /usr/src/myapp/ 3 | 4 | # To reuse the build cache, here we split maven dependency 5 | # download and package into two RUN commands to avoid cache invalidation. 6 | COPY pom.xml . 7 | RUN mvn dependency:go-offline 8 | 9 | COPY src /usr/src/myapp/src/ 10 | RUN mvn package 11 | 12 | FROM eclipse-temurin:22-jdk-alpine 13 | VOLUME /tmp 14 | COPY --from=build /usr/src/myapp/target/env-java-0.0.1-SNAPSHOT.jar /app.jar 15 | ENTRYPOINT java ${JVM_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.jar --server.port=8888 16 | EXPOSE 8888 -------------------------------------------------------------------------------- /python/requirements.txt: -------------------------------------------------------------------------------- 1 | bjoern==3.2.1 2 | blinker==1.4 3 | certifi==2024.7.4 4 | chardet==4.0.0 5 | charset-normalizer==2.0.7 6 | click==8.0.3 7 | Flask==2.1.1 8 | gevent==22.10.2 9 | gevent-ws==2.1.0 10 | greenlet==3.0.2 11 | hiredis==2.0.0 12 | httplib2==0.20.1 13 | idna==3.7 14 | importlib-metadata==4.11.3 15 | itsdangerous==2.0.1 16 | Jinja2==3.1.4 17 | MarkupSafe==2.1.4 18 | pyparsing==2.4.7 19 | python-dateutil==2.8.2 20 | redis==3.5.3 21 | requests==2.32.2 22 | sentry-sdk==2.8.0 23 | six==1.16.0 24 | urllib3==1.26.19 25 | Werkzeug==2.2.2 26 | zipp==3.19.1 27 | zope.event==4.5.0 28 | zope.interface==5.4.0 29 | -------------------------------------------------------------------------------- /dotnet20/builder/Utility/BuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Builder.Utility 6 | { 7 | public static class BuilderExtensions 8 | { 9 | public static string GetrelevantPathAsPerOS(this string curruntPath) 10 | { 11 | if (BuilderHelper.Instance.builderSettings.RunningOnwindows) 12 | { 13 | return curruntPath; 14 | } 15 | else 16 | { 17 | return curruntPath.Replace("\\","/"); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rules.mk: -------------------------------------------------------------------------------- 1 | # Platforms to build in multi-architecture images. 2 | PLATFORMS ?= linux/amd64,linux/arm64 3 | 4 | # Repository prefix and tag to push multi-architecture images to. 5 | REPO ?= ghcr.io/fission 6 | TAG ?= dev 7 | DOCKER_FLAGS ?= --push --progress plain 8 | FISSION_VERSION ?= v1.21.0 9 | SKAFFOLD_PROFILE ?= kind 10 | 11 | %-img: 12 | @echo === Building image $(REPO)/$(subst -img,,$@):$(TAG) using context $(CURDIR) and dockerfile $< 13 | docker buildx build $($@-buildargs) --platform=$(PLATFORMS) -t $(REPO)/$(subst -img,,$@):$(TAG) $(DOCKER_FLAGS) -f $< . 14 | 15 | %-builder: 16 | cd builder/ && $(MAKE) 17 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Fission.DotNet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.github/actions/collect-fission-dump/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Collect Fission Dump' 2 | description: 'Collects Fission dump on job failure' 3 | inputs: 4 | workflow-name: 5 | description: 'Name of the workflow' 6 | required: true 7 | runs: 8 | using: "composite" 9 | steps: 10 | - name: Collect Fission Dump 11 | shell: bash 12 | run: | 13 | command -v fission && fission support dump 14 | 15 | - name: Archive fission dump 16 | uses: actions/upload-artifact@v4 17 | with: 18 | name: ${{ inputs.workflow-name }}-fission-dump 19 | path: fission-dump/*.zip 20 | retention-days: 5 21 | -------------------------------------------------------------------------------- /dotnet/Program.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Hosting; 4 | using Nancy.Owin; 5 | 6 | namespace Fission.DotNetCore 7 | { 8 | public class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | var host = new WebHostBuilder() 13 | .UseContentRoot(Directory.GetCurrentDirectory()) 14 | .UseKestrel() 15 | .UseUrls("http://*:8888") 16 | .Configure(app => app.UseOwin(x => x.UseNancy())) 17 | .Build(); 18 | host.Run(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dotnet20/Program.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Hosting; 4 | using Nancy.Owin; 5 | 6 | namespace Fission.DotNetCore 7 | { 8 | public class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | var host = new WebHostBuilder() 13 | .UseContentRoot(Directory.GetCurrentDirectory()) 14 | .UseKestrel() 15 | .UseUrls("http://*:8888") 16 | .Configure(app => app.UseOwin(x => x.UseNancy())) 17 | .Build(); 18 | host.Run(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: Automatic merge on approval 3 | conditions: 4 | - base=master 5 | - "#approved-reviews-by>=1" 6 | - label=ready-to-merge 7 | - label!=hold-off-merging 8 | - check-success=check 9 | - or: 10 | - check-success=binary 11 | - check-success=go 12 | - check-success=jvm 13 | - check-success=nodejs 14 | - check-success=perl 15 | - check-success=php7 16 | - check-success=python 17 | - check-success=ruby 18 | - check-success=tensorflow 19 | actions: 20 | merge: 21 | method: squash 22 | -------------------------------------------------------------------------------- /ruby/fission/handler.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'context' 4 | 5 | module Fission 6 | module Handler 7 | def self.call(env) 8 | context = Context.new(env) 9 | 10 | response = if $handler.arity > 0 11 | $handler.call(context) 12 | else 13 | $handler.call 14 | end 15 | 16 | response.is_a?(Array) ? response : Rack::Response.new([response]).finish 17 | 18 | rescue => e 19 | context.logger.error(%(Function failed - #{e}\n#{e.backtrace.join("\n")})) 20 | Rack::Response.new(['500 Internal Server Error'], 500, {}).finish 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /dotnet/examples/requestheaders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNetCore.Api; 3 | 4 | public class FissionFunction 5 | { 6 | public string Execute(FissionContext context){ 7 | var buffer = new System.Text.StringBuilder(); 8 | foreach(var header in context.Request.Headers){ 9 | buffer.AppendLine(header.Key); 10 | foreach(var item in header.Value){ 11 | buffer.AppendLine($"\t{item}"); 12 | } 13 | } 14 | buffer.AppendLine($"Url: {context.Request.Url}, method: {context.Request.Method}"); 15 | return buffer.ToString(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dotnet8/Makefile: -------------------------------------------------------------------------------- 1 | PLATFORMS ?= linux/amd64 2 | 3 | -include ../rules.mk 4 | 5 | REPO ?= fission 6 | TAG ?= latest 7 | 8 | .PHONY: all 9 | all: dotnet8-env-img dotnet8-builder-img 10 | 11 | dotnet8-env-img: Dockerfile 12 | @echo === Building image $(REPO)/dotnet8-env:$(TAG) using context $(CURDIR) and dockerfile $< 13 | docker buildx build --platform=$(PLATFORMS) -t $(REPO)/dotnet8-env:$(TAG) $(DOCKER_FLAGS) -f $< . 14 | 15 | dotnet8-builder-img: builder/Dockerfile 16 | @echo === Building image $(REPO)/dotnet8-builder:$(TAG) using context $(CURDIR) and dockerfile $< 17 | docker build --platform=$(PLATFORMS) -t $(REPO)/dotnet8-builder:$(TAG) -f $< . -------------------------------------------------------------------------------- /python/examples/guestbook/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | kubectl create -f redis.yaml 6 | 7 | if [ -z "$FISSION_URL" ] 8 | then 9 | echo "Need $FISSION_URL set to a fission controller address" 10 | exit 1 11 | fi 12 | 13 | # Create python env if it doesn't exist 14 | fission env get --name python || fission env create --name python --image fission/python-env 15 | 16 | # Register functions and routes with fission 17 | fission function create --name guestbook-get --env python --code get.py --url /guestbook --method GET 18 | fission function create --name guestbook-add --env python --code add.py --url /guestbook --method POST 19 | -------------------------------------------------------------------------------- /dotnet20/examples/requestheaders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNetCore.Api; 3 | 4 | public class FissionFunction 5 | { 6 | public string Execute(FissionContext context){ 7 | var buffer = new System.Text.StringBuilder(); 8 | foreach(var header in context.Request.Headers){ 9 | buffer.AppendLine(header.Key); 10 | foreach(var item in header.Value){ 11 | buffer.AppendLine($"\t{item}"); 12 | } 13 | } 14 | buffer.AppendLine($"Url: {context.Request.Url}, method: {context.Request.Method}"); 15 | return buffer.ToString(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/FissionMqContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace Fission.DotNet.Common; 6 | 7 | public class FissionMqContext : FissionContext 8 | { 9 | public FissionMqContext(Stream body, Dictionary arguments, Dictionary headers, Dictionary parameters) : base(body, arguments, headers, parameters) 10 | { 11 | 12 | } 13 | 14 | public string Topic => GetHeaderValue("Topic"); 15 | public string ErrorTopic => GetHeaderValue("Errortopic"); 16 | public string ResponseTopic => GetHeaderValue("Resptopic"); 17 | } 18 | -------------------------------------------------------------------------------- /nodejs/test/test-case-6/helloUser.js: -------------------------------------------------------------------------------- 1 | // ESM helloUser test case for Node.js 22 2 | import { parse } from "url"; 3 | 4 | export default async (context) => { 5 | console.log("ESM Function - URL:", context.request.url); 6 | 7 | const urlParts = parse(context.request.url, true); 8 | const query = urlParts.query; 9 | 10 | console.log("ESM Function - query user:", query.user); 11 | 12 | return { 13 | status: 200, 14 | body: `hello ${query.user || 'anonymous'} from ESM Node.js 22! 🚀\n`, 15 | headers: { 16 | "X-Module-Type": "ESM", 17 | "Content-Type": "text/plain", 18 | "X-Node-Version": process.version 19 | } 20 | }; 21 | }; -------------------------------------------------------------------------------- /dotnet8/examples/MultiFileExample/MyFunction.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNet.Common; 2 | using System.Threading.Tasks; 3 | using MultiFileExample.Controllers; 4 | 5 | namespace MultiFileExample 6 | { 7 | 8 | public class MyFunction 9 | { 10 | private readonly ApiController _controller; 11 | 12 | public MyFunction() 13 | { 14 | _controller = new ApiController(); 15 | } 16 | 17 | public async Task Execute(FissionContext context) 18 | { 19 | // Delegate all routing and business logic to the controller 20 | return await _controller.RouteRequest(context); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /dotnet20/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euxo pipefail 3 | cd ${SRC_PKG} 4 | #now start execution of custom logic dll in such a way that it should copy everything in ${SRC_PKG} 5 | #first lets try putting sample file which will prove that this worked 6 | echo src : ${SRC_PKG} ,dest: ${DEPLOY_PKG} >builderpaths.txt 7 | 8 | #now run actual dll for custom builder logic 9 | # please note as this need to be executed from app folder so that all dependent files are avilable 10 | # else you will end up getting File not found error 11 | cd /app 12 | 13 | #now execute dll 14 | dotnet Builder.dll 15 | 16 | #copy entire content to deployment package 17 | cp -r ${SRC_PKG} ${DEPLOY_PKG} -------------------------------------------------------------------------------- /jvm/src/main/java/io/fission/FunctionLoadRequest.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | public class FunctionLoadRequest { 4 | 5 | private String filepath; 6 | private String functionName; 7 | private String url; 8 | 9 | String getFilepath() { 10 | return filepath; 11 | } 12 | 13 | void setFilepath(String filepath) { 14 | this.filepath = filepath; 15 | } 16 | 17 | String getUrl() { 18 | return url; 19 | } 20 | 21 | void setUrl(String url) { 22 | this.url = url; 23 | } 24 | 25 | public String getFunctionName() { 26 | return functionName; 27 | } 28 | 29 | public void setFunctionName(String functionName) { 30 | this.functionName = functionName; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dotnet8/examples/MultiFileExample/MultiFileExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Library 4 | net8.0 5 | MultiFileExample 6 | MultiFileExample 7 | true 8 | 9 | 10 | 11 | 12 | ./Fission.DotNet.Common.dll 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /go/examples/README.md: -------------------------------------------------------------------------------- 1 | # Hello World in Go on Fission 2 | 3 | `hello.go` contains a very simple fission function that says "Hello, World!". 4 | 5 | ## Deploying this function on your cluster 6 | 7 | ```bash 8 | 9 | # Create the Fission Go environment and function, and wait for the 10 | # function to build. (Take a look at the YAML files in the specs 11 | # directory for details about how the environment and function are 12 | # specified.) 13 | 14 | $ fission spec apply --wait 15 | 1 environment created 16 | 1 package created 17 | 1 function created 18 | 19 | # Now, run the function with the "fission function test" command: 20 | 21 | $ fission function test --name hello-go 22 | Hello, World! 23 | ``` 24 | -------------------------------------------------------------------------------- /jvm/examples/java/specs/function-hello.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: fission.io/v1 2 | kind: Function 3 | metadata: 4 | creationTimestamp: null 5 | name: hello 6 | namespace: default 7 | spec: 8 | InvokeStrategy: 9 | ExecutionStrategy: 10 | ExecutorType: poolmgr 11 | MaxScale: 0 12 | MinScale: 0 13 | SpecializationTimeout: 120 14 | TargetCPUPercent: 0 15 | StrategyType: execution 16 | configmaps: null 17 | environment: 18 | name: java 19 | namespace: default 20 | functionTimeout: 60 21 | package: 22 | functionName: io.fission.HelloWorld 23 | packageref: 24 | name: hellojava 25 | namespace: default 26 | resources: {} 27 | secrets: null 28 | -------------------------------------------------------------------------------- /ruby/server.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rack' 4 | require 'thin' 5 | require 'logger' 6 | 7 | require_relative 'fission/specializer' 8 | require_relative 'fission/handler' 9 | 10 | $handler = nil 11 | 12 | app = Rack::Builder.new do 13 | use Rack::Logger, Logger::DEBUG 14 | use Rack::CommonLogger 15 | 16 | map "/specialize" do 17 | run Fission::Specializer 18 | end 19 | 20 | map '/v2/specialize' do 21 | run Fission::V2::Specializer 22 | end 23 | 24 | map "/healthz" do 25 | run ->(env) { [ 200, {}, [] ] } 26 | end 27 | 28 | map '/' do 29 | run Fission::Handler 30 | end 31 | end 32 | 33 | Rack::Handler::Thin.run app, Host: '0.0.0.0', Port: 8888 34 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/specs/function-hello.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: fission.io/v1 2 | kind: Function 3 | metadata: 4 | creationTimestamp: null 5 | name: hello 6 | namespace: default 7 | spec: 8 | InvokeStrategy: 9 | ExecutionStrategy: 10 | ExecutorType: poolmgr 11 | MaxScale: 0 12 | MinScale: 0 13 | SpecializationTimeout: 120 14 | TargetCPUPercent: 0 15 | StrategyType: execution 16 | configmaps: null 17 | environment: 18 | name: java-jersey 19 | namespace: default 20 | functionTimeout: 60 21 | package: 22 | functionName: io.fission.HelloWorld 23 | packageref: 24 | name: hellojava 25 | namespace: default 26 | resources: {} 27 | secrets: null 28 | -------------------------------------------------------------------------------- /go/examples/module-example/README.md: -------------------------------------------------------------------------------- 1 | # Go module usage 2 | 3 | 1. Initialize your project 4 | 5 | ```console 6 | go mod init 7 | ``` 8 | 9 | 2. Add dependencies 10 | See [modules daily-workflow](https://github.com/golang/go/wiki/Modules#daily-workflow) 11 | 12 | 3. Verify 13 | 14 | ```console 15 | go mod tidy 16 | go mod verify 17 | ``` 18 | 19 | 4. Archive and create package as usual 20 | 21 | ```console 22 | $ zip -r go.zip . 23 | adding: go.mod (deflated 26%) 24 | adding: go.sum (deflated 1%) 25 | adding: README.md (deflated 37%) 26 | adding: main.go (deflated 30%) 27 | 28 | $ fission pkg create --env go --src go.zip 29 | ``` 30 | -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/add.py: -------------------------------------------------------------------------------- 1 | # 2 | # Handles POST /guestbook -- adds item to guestbook 3 | # 4 | 5 | from fastapi import Request, Response 6 | from fastapi.responses import RedirectResponse 7 | import redis 8 | 9 | # Connect to redis. 10 | redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0) 11 | 12 | async def main(request: Request): 13 | # Read the item from POST params, add it to redis, and redirect 14 | # back to the list 15 | form = await request.form() 16 | book = form.get('text') 17 | if book is None: 18 | return Response(status_code=400) 19 | redisConnection.rpush('guestbook', book) 20 | return RedirectResponse('/guestbook', status_code=303) 21 | -------------------------------------------------------------------------------- /nodejs/examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-example", 3 | "version": "0.1.0", 4 | "author": "Soam Vasani", 5 | "contributors": [ 6 | { 7 | "name": "Soam Vasani", 8 | "email": "soamvasani+1@gmail.com" 9 | }, 10 | { 11 | "name": "Gary Yeap", 12 | "email": "contact@garyyeap.com" 13 | } 14 | ], 15 | "description": "Nodejs example for Fission framework", 16 | "engines": { 17 | "node": ">=7.6.0" 18 | }, 19 | "dependencies": { 20 | "body-parser": "*", 21 | "co": "~4.6.0", 22 | "express": "*", 23 | "minimist": "*", 24 | "morgan": "*", 25 | "mz": "~2.7.0", 26 | "node-fetch": "^2.6.1", 27 | "underscore": ">=1.8.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dotnet20/builder/Model/BuilderSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Builder.Model 6 | { 7 | public class BuilderSettings 8 | { 9 | public string NugetSpecsFile { get; set; } 10 | public string DllExcludeFile { get; set; } 11 | public string BuildLogDirectory { get; set; } 12 | public string NugetPackageRegEx { get; set; } 13 | public string ExcludeDllRegEx { get; set; } 14 | public bool RunningOnwindows { get; set; } 15 | public string functionBodyFileName { get; set; } 16 | public string functionSpecFileName { get; set; } 17 | public string DllDirectory { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dotnet8/examples/MultiFileExample/Models/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiFileExample.Models 5 | { 6 | public class User 7 | { 8 | public int Id { get; set; } 9 | public string Name { get; set; } 10 | public string Email { get; set; } 11 | public bool IsActive { get; set; } 12 | public DateTime CreatedAt { get; set; } 13 | } 14 | 15 | public class UserListResponse 16 | { 17 | public List Users { get; set; } 18 | public int Total { get; set; } 19 | public string FilteredBy { get; set; } 20 | public DateTime Timestamp { get; set; } 21 | public string Source { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /dotnet/examples/requestbody.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization.Json; 3 | using Fission.DotNetCore.Api; 4 | 5 | public class FissionFunction 6 | { 7 | public string Execute(FissionContext context) 8 | { 9 | var person = Person.Deserialize(context.Request.Body); 10 | return $"Hello, my name is {person.Name} and I am {person.Age} years old."; 11 | } 12 | } 13 | 14 | public class Person 15 | { 16 | public string Name { get; set; } 17 | public int Age { get; set; } 18 | 19 | public static Person Deserialize(Stream json) 20 | { 21 | var serializer = new DataContractJsonSerializer(typeof(Person)); 22 | return (Person)serializer.ReadObject(json); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dotnet20/examples/requestbody.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization.Json; 3 | using Fission.DotNetCore.Api; 4 | 5 | public class FissionFunction 6 | { 7 | public string Execute(FissionContext context) 8 | { 9 | var person = Person.Deserialize(context.Request.Body); 10 | return $"Hello, my name is {person.Name} and I am {person.Age} years old."; 11 | } 12 | } 13 | 14 | public class Person 15 | { 16 | public string Name { get; set; } 17 | public int Age { get; set; } 18 | 19 | public static Person Deserialize(Stream json) 20 | { 21 | var serializer = new DataContractJsonSerializer(typeof(Person)); 22 | return (Person)serializer.ReadObject(json); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/filters/version_filter.yaml: -------------------------------------------------------------------------------- 1 | binary: 2 | - 'binary/envconfig.json' 3 | jvm-jersey: 4 | - 'jvm-jersey/envconfig.json' 5 | php7: 6 | - 'php7/envconfig.json' 7 | dotnet: 8 | - 'dotnet/envconfig.json' 9 | dotnet20: 10 | - 'dotnet20/envconfig.json' 11 | dotnet8: 12 | - 'dotnet8/envconfig.json' 13 | go: 14 | - 'go/envconfig.json' 15 | jvm: 16 | - 'jvm/envconfig.json' 17 | nodejs: 18 | - 'nodejs/envconfig.json' 19 | perl: 20 | - 'perl/envconfig.json' 21 | python: 22 | - 'python/envconfig.json' 23 | python-fastapi: 24 | - 'python-fastapi/envconfig.json' 25 | ruby: 26 | - 'ruby/envconfig.json' 27 | tensorflow-serving: 28 | - 'tensorflow-serving/envconfig.json' 29 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net8.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property.EnforceExtendedAnalyzerRules = 9 | build_property._SupportedPlatformList = Linux,macOS,Windows 10 | build_property.RootNamespace = Fission.DotNet.Common 11 | build_property.ProjectDir = /Users/davidcasa/environments/dotnet8/Fission.DotNet.Common/ 12 | build_property.EnableComHosting = 13 | build_property.EnableGeneratedComInterfaceComImportInterop = 14 | -------------------------------------------------------------------------------- /nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-runtime", 3 | "version": "1.0.0", 4 | "author": "Soam Vasani", 5 | "contributors": [ 6 | { 7 | "name": "Soam Vasani", 8 | "email": "soamvasani+1@gmail.com" 9 | }, 10 | { 11 | "name": "Gary Yeap", 12 | "email": "contact@garyyeap.com" 13 | } 14 | ], 15 | "description": "Pure ESM Node.js 22 runtime for Fission with multi-entry support, modern dependencies, and enhanced function loading", 16 | "engines": { 17 | "node": ">= 22.0.0" 18 | }, 19 | "dependencies": { 20 | "express": "^5.1.0", 21 | "minimist": "^1.2.8", 22 | "pino": "^9.4.0", 23 | "pino-pretty": "^11.2.2", 24 | "ws": "^8.18.3" 25 | }, 26 | "scripts": { 27 | "start": "node server.js" 28 | } 29 | } -------------------------------------------------------------------------------- /dotnet20/builder/Utility/ObjectConverter.cs: -------------------------------------------------------------------------------- 1 | using Builder.Model; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Builder.Utility 8 | { 9 | public sealed class ObjectConverter 10 | { 11 | 12 | private static readonly Lazy lazy = 13 | new Lazy(() => new ObjectConverter()); 14 | 15 | public static ObjectConverter Instance { get { return lazy.Value; } } 16 | 17 | private ObjectConverter() 18 | { 19 | 20 | } 21 | 22 | 23 | public BuilderSettings GetBuilderSettingsFromJson(string json) 24 | { 25 | return JsonConvert.DeserializeObject(json); 26 | } 27 | 28 | 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jvm/examples/java/src/test/java/io/fission/HelloWorldTest.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import java.net.URI; 4 | import java.net.URISyntaxException; 5 | 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.RequestEntity; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.util.Assert; 10 | 11 | public class HelloWorldTest { 12 | 13 | public void testResponse() { 14 | HelloWorld hw = new HelloWorld(); 15 | RequestEntity request = null; 16 | try { 17 | request = RequestEntity.get(new URI("http://example.com/bar")).build(); 18 | } catch (URISyntaxException e) { 19 | e.printStackTrace(); 20 | } 21 | ResponseEntity resp = hw.call(request, null); 22 | Assert.hasText(resp.getBody().toString(), "Hello World!"); 23 | } 24 | } -------------------------------------------------------------------------------- /jvm-jersey/src/main/java/io/fission/FunctionLoadRequest.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | 5 | @JsonIgnoreProperties(ignoreUnknown = true) 6 | public class FunctionLoadRequest { 7 | 8 | private String filepath; 9 | private String functionName; 10 | private String url; 11 | 12 | String getFilepath() { 13 | return filepath; 14 | } 15 | 16 | void setFilepath(String filepath) { 17 | this.filepath = filepath; 18 | } 19 | 20 | String getUrl() { 21 | return url; 22 | } 23 | 24 | void setUrl(String url) { 25 | this.url = url; 26 | } 27 | 28 | public String getFunctionName() { 29 | return functionName; 30 | } 31 | 32 | public void setFunctionName(String functionName) { 33 | this.functionName = functionName; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hack/buildx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | ## This script needs to be run to start the emulator for multiarch builds 5 | create_docker_builder() { 6 | if ! $(docker buildx inspect --bootstrap | grep "^Driver" | grep -q "docker-container"); then 7 | echo "Starting docker builder fission" 8 | docker buildx create --name=fission --use --driver=docker-container 9 | docker buildx inspect --bootstrap 10 | fi 11 | } 12 | 13 | check_platform() { 14 | if ! $(docker buildx inspect --bootstrap | grep "^Platforms:" | grep -q "$1"); then 15 | echo "Platform $1 not supported by builder" 16 | exit 1 17 | fi 18 | } 19 | 20 | PLATFORMS=($(echo "$@" | tr ',' '\n')) 21 | create_docker_builder 22 | for platform in "${PLATFORMS[@]}"; do 23 | check_platform $platform 24 | done 25 | -------------------------------------------------------------------------------- /nodejs/test/test-case-4/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-runtime", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "fission-nodejs-runtime", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "moment": "*" 13 | }, 14 | "engines": { 15 | "node": ">=7.6.0" 16 | } 17 | }, 18 | "node_modules/moment": { 19 | "version": "2.30.1", 20 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", 21 | "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", 22 | "license": "MIT", 23 | "engines": { 24 | "node": "*" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /nodejs/test/test-case-8/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fission-nodejs-runtime", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "fission-nodejs-runtime", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "moment": "*" 13 | }, 14 | "engines": { 15 | "node": ">=7.6.0" 16 | } 17 | }, 18 | "node_modules/moment": { 19 | "version": "2.30.1", 20 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", 21 | "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", 22 | "license": "MIT", 23 | "engines": { 24 | "node": "*" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /go/examples/specs/function-hello.yaml: -------------------------------------------------------------------------------- 1 | kind: ArchiveUploadSpec 2 | name: hello-go 3 | include: 4 | - hello.go 5 | 6 | --- 7 | apiVersion: fission.io/v1 8 | kind: Package 9 | metadata: 10 | creationTimestamp: null 11 | name: hello-go-pkg 12 | namespace: default 13 | spec: 14 | environment: 15 | name: go 16 | namespace: default 17 | source: 18 | type: url 19 | url: archive://hello-go 20 | status: 21 | buildstatus: pending 22 | 23 | --- 24 | apiVersion: fission.io/v1 25 | kind: Function 26 | metadata: 27 | creationTimestamp: null 28 | name: hello-go 29 | namespace: default 30 | spec: 31 | environment: 32 | name: go 33 | namespace: default 34 | functionTimeout: 60 35 | package: 36 | functionName: Handler 37 | packageref: 38 | name: hello-go-pkg 39 | namespace: default 40 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/src/test/java/io/fission/HelloWorldTest.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import java.net.URI; 4 | import java.net.URISyntaxException; 5 | import org.glassfish.jersey.server.ContainerRequest; 6 | import javax.ws.rs.core.Response; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | 10 | 11 | public class HelloWorldTest { 12 | 13 | @Test 14 | public void testResponse() { 15 | HelloWorld hw = new HelloWorld(); 16 | ContainerRequest request = null; 17 | try { 18 | request = new ContainerRequest(new URI("http://example.com/"),new URI("/hello"),"GET",null,null); 19 | } catch (URISyntaxException e) { 20 | e.printStackTrace(); 21 | } 22 | Response response = hw.call(request, null); 23 | Assert.assertTrue(response.getEntity().toString().equals(HelloWorld.RETURN_STRING)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /kind.yaml: -------------------------------------------------------------------------------- 1 | ####################################################################################### 2 | # Kind Config for running a local cluster (More about Kind:https://kind.sigs.k8s.io/) 3 | # Creates a three node cluster for local development and testing 4 | # 5 | ####################################################################################### 6 | 7 | kind: Cluster 8 | apiVersion: kind.x-k8s.io/v1alpha4 9 | nodes: 10 | - role: control-plane 11 | kubeadmConfigPatches: 12 | - | 13 | kind: InitConfiguration 14 | nodeRegistration: 15 | kubeletExtraArgs: 16 | node-labels: "ingress-ready=true" 17 | authorization-mode: "AlwaysAllow" 18 | extraPortMappings: 19 | - containerPort: 80 20 | hostPort: 80 21 | protocol: TCP 22 | - containerPort: 443 23 | hostPort: 443 24 | protocol: TCP -------------------------------------------------------------------------------- /python/examples/guestbook/redis.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: guestbook 5 | labels: 6 | name: guestbook 7 | 8 | --- 9 | apiVersion: apps/v1 10 | kind: Deployment 11 | metadata: 12 | labels: 13 | run: redis 14 | name: redis 15 | namespace: guestbook 16 | spec: 17 | replicas: 1 18 | selector: 19 | matchLabels: 20 | run: redis 21 | template: 22 | metadata: 23 | labels: 24 | run: redis 25 | spec: 26 | containers: 27 | - image: redis 28 | name: redis 29 | 30 | --- 31 | apiVersion: v1 32 | kind: Service 33 | metadata: 34 | labels: 35 | run: redis 36 | name: redis 37 | namespace: guestbook 38 | spec: 39 | selector: 40 | run: redis 41 | type: ClusterIP 42 | ports: 43 | - port: 6379 44 | protocol: TCP 45 | targetPort: 6379 46 | -------------------------------------------------------------------------------- /dotnet8/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "dotnet8-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/dotnet8/examples", 5 | "icon": "./logo/logo_NETcore.svg", 6 | "image": "dotnet8-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/sanketsudake", 12 | "name": "sanketsudake" 13 | } 14 | ], 15 | "name": "Dotnet 8 Environment", 16 | "readme": "https://github.com/fission/environments/tree/master/dotnet8", 17 | "runtimeVersion": "8.0.0", 18 | "shortDescription": "Fission Dotnet 8.0.0 runtime uses Kestrel to host the internal web server. Supports both single file compilation (--code) and project-based compilation (--src).", 19 | "status": "Stable", 20 | "version": "1.4.0" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/redis.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: guestbook 5 | labels: 6 | name: guestbook 7 | 8 | --- 9 | apiVersion: apps/v1 10 | kind: Deployment 11 | metadata: 12 | labels: 13 | run: redis 14 | name: redis 15 | namespace: guestbook 16 | spec: 17 | replicas: 1 18 | selector: 19 | matchLabels: 20 | run: redis 21 | template: 22 | metadata: 23 | labels: 24 | run: redis 25 | spec: 26 | containers: 27 | - image: redis 28 | name: redis 29 | 30 | --- 31 | apiVersion: v1 32 | kind: Service 33 | metadata: 34 | labels: 35 | run: redis 36 | name: redis 37 | namespace: guestbook 38 | spec: 39 | selector: 40 | run: redis 41 | type: ClusterIP 42 | ports: 43 | - port: 6379 44 | protocol: TCP 45 | targetPort: 6379 46 | -------------------------------------------------------------------------------- /binary/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "binary-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/binary/examples", 5 | "icon": "./logo/full_colored_dark.svg", 6 | "image": "binary-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/sanketsudake", 12 | "name": "sanketsudake" 13 | }, 14 | { 15 | "link": "https://github.com/vishal-biyani", 16 | "name": "vishal-biyani" 17 | } 18 | ], 19 | "name": "Fission Binary Environment", 20 | "readme": "https://github.com/fission/environments/tree/master/binary", 21 | "runtimeVersion": "3.20-alpine", 22 | "shortDescription": "Fission environment to run any binary", 23 | "status": "Stable", 24 | "version": "1.32.3" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /python/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "python-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/python/examples", 5 | "icon": "./logo/Python-logo-notext.png", 6 | "image": "python-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/sanketsudake", 12 | "name": "sanketsudake" 13 | }, 14 | { 15 | "link": "https://github.com/vishal-biyani", 16 | "name": "vishal-biyani" 17 | } 18 | ], 19 | "name": "Python Environment", 20 | "readme": "https://github.com/fission/environments/tree/master/python", 21 | "runtimeVersion": "3.11", 22 | "shortDescription": "Fission Python environment based on Flask framework.", 23 | "status": "stable", 24 | "version": "1.34.3" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /python-fastapi/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "python-fastapi-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/python/examples", 5 | "icon": "./logo/Python-logo-notext.png", 6 | "image": "python-fastapi-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/sanketsudake", 12 | "name": "sanketsudake" 13 | }, 14 | { 15 | "link": "https://github.com/vishal-biyani", 16 | "name": "vishal-biyani" 17 | } 18 | ], 19 | "name": "Python FastAPI Environment", 20 | "readme": "https://github.com/fission/environments/tree/master/python", 21 | "runtimeVersion": "3.11", 22 | "shortDescription": "Fission Python environment based on FastAPI framework.", 23 | "status": "stable", 24 | "version": "1.34.2" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /tensorflow-serving/examples/README.md: -------------------------------------------------------------------------------- 1 | # Tensorflow Serving Environment Example 2 | 3 | ## Create Environment 4 | 5 | ```bash 6 | $ fission env create --name tensorflow --image fission/tensorflow-serving-env --version 2 7 | ``` 8 | 9 | ## Create Package 10 | 11 | ```bash 12 | $ zip -r half_plus_two.zip ./half_plus_two 13 | $ fission pkg create --env tensorflow --deploy half_plus_two.zip 14 | ``` 15 | 16 | ## Create Function 17 | 18 | Here, the `--entrypoint` represents the name of the top directory contains the trained model and what kind of API the model supports. 19 | Currently, three API are supported: `predict`, `classify`, `regress`. `predict` API will be used if no API kind was given. 20 | 21 | ```bash 22 | $ fission fn create --name t1 --pkg --env tensorflow --entrypoint "half_plus_two:predict" 23 | $ fission fn test --name t1 --body '{"instances": [1.0, 2.0, 0.0]}' --method POST 24 | ``` 25 | -------------------------------------------------------------------------------- /jvm-jersey/examples/java/src/main/java/io/fission/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.container.ContainerRequestContext; 5 | import io.fission.Function; 6 | import java.io.BufferedReader; 7 | import java.util.stream.Collectors; 8 | import java.io.InputStreamReader; 9 | 10 | public class HelloWorld implements Function { 11 | 12 | public static final String RETURN_STRING = "Hello World!"; 13 | 14 | @Override 15 | public Response call(ContainerRequestContext request, Context arg1) { 16 | if(request.getMethod().equals("GET")) { 17 | return Response.ok(RETURN_STRING).build(); 18 | } 19 | else { 20 | String body = new BufferedReader(new InputStreamReader(request.getEntityStream())).lines() 21 | .parallel().collect(Collectors.joining("\n")); 22 | return Response.ok("Echo: " + body).build(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /perl/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "examples": "https://github.com/fission/environments/tree/master/perl/examples", 4 | "icon": "./logo/perl-programming-language.svg", 5 | "image": "perl-env", 6 | "keywords": [], 7 | "kind": "environment", 8 | "maintainers": [ 9 | { 10 | "link": "https://github.com/life1347", 11 | "name": "life1347" 12 | }, 13 | { 14 | "link": "https://github.com/soamvasani", 15 | "name": "soamvasani" 16 | }, 17 | { 18 | "link": "https://github.com/vishal-biyani", 19 | "name": "vishal-biyani" 20 | } 21 | ], 22 | "name": "Perl Environment", 23 | "readme": "https://github.com/fission/environments/tree/master/perl", 24 | "runtimeVersion": "5", 25 | "shortDescription": "Perl environment based on the Dancer2 framework", 26 | "status": "Stable", 27 | "version": "1.31.1" 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /ruby/fission/request.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Fission 4 | HEADER_PREFIX = 'HTTP_' 5 | PARAM_HEADER_PREFIX = 'HTTP_X_FISSION_PARAMS_' 6 | PARAMETERS_KEY = 'fission.request.parameters' 7 | 8 | class Request < Rack::Request 9 | def headers 10 | Hash[ 11 | *env.select { |k,v| k.start_with?(HEADER_PREFIX) } 12 | .map { |k,v| [k.sub(/\A#{HEADER_PREFIX}/, '').split('_').map(&:capitalize).join('-'), v] } 13 | .sort 14 | .flatten 15 | ] 16 | end 17 | 18 | def params 19 | env[PARAMETERS_KEY] ||= super.merge(path_parameters) 20 | end 21 | 22 | def path_parameters 23 | Hash[ 24 | *env.select { |k,v| k.start_with?(PARAM_HEADER_PREFIX) } 25 | .map { |k,v| [k.sub(/\A#{PARAM_HEADER_PREFIX}/, '').downcase, v] } 26 | .sort 27 | .flatten 28 | ] 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /jvm/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "jvm-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/jvm/examples", 5 | "icon": "./logo/Java-Logo.png", 6 | "image": "jvm-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/life1347", 12 | "name": "life1347" 13 | }, 14 | { 15 | "link": "https://github.com/soamvasani", 16 | "name": "soamvasani" 17 | }, 18 | { 19 | "link": "https://github.com/vishal-biyani", 20 | "name": "vishal-biyani" 21 | } 22 | ], 23 | "name": "JVM Environment", 24 | "readme": "https://github.com/fission/environments/tree/master/jvm", 25 | "runtimeVersion": "22", 26 | "shortDescription": "JVM environment based on Spring Boot server", 27 | "status": "Stable", 28 | "version": "1.31.3" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /php7/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "php-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/perl/examples", 5 | "icon": "./logo/new-php-logo.svg", 6 | "image": "php-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/life1347", 12 | "name": "life1347" 13 | }, 14 | { 15 | "link": "https://github.com/soamvasani", 16 | "name": "soamvasani" 17 | }, 18 | { 19 | "link": "https://github.com/vishal-biyani", 20 | "name": "vishal-biyani" 21 | } 22 | ], 23 | "name": "PHP Environment", 24 | "readme": "https://github.com/fission/environments/tree/master/perl", 25 | "runtimeVersion": "7", 26 | "shortDescription": "PHP environment with built-in server", 27 | "status": "Stable", 28 | "version": "1.31.2" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | kubectl apply -f redis.yaml 6 | 7 | if [ -z "$FISSION_URL" ] 8 | then 9 | echo "Need $FISSION_URL set to a fission controller address" 10 | exit 1 11 | fi 12 | 13 | # Create python env if it doesn't exist 14 | fission env get --name python || fission env create --name python --image python-fastapi-env --builder python-fastapi-builder 15 | 16 | # Create zip file 17 | zip -jr guestbook.zip ../guestbook 18 | 19 | # Create packages 20 | fission package create --name guestbook --sourcearchive guestbook.zip --env python --buildcmd "./build.sh" 21 | 22 | # Register functions and routes with fission 23 | fission function create --name guestbook-get --env python --pkg guestbook --entrypoint "get.main" --url /guestbook --method GET 24 | fission function create --name guestbook-add --env python --pkg guestbook --entrypoint "add.main" --url /guestbook --method POST 25 | -------------------------------------------------------------------------------- /ruby/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "ruby-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/ruby/examples", 5 | "icon": "./logo/Ruby_logo.svg", 6 | "image": "ruby-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/life1347", 12 | "name": "life1347" 13 | }, 14 | { 15 | "link": "https://github.com/soamvasani", 16 | "name": "soamvasani" 17 | }, 18 | { 19 | "link": "https://github.com/vishal-biyani", 20 | "name": "vishal-biyani" 21 | } 22 | ], 23 | "name": "Ruby Environment", 24 | "readme": "https://github.com/fission/environments/tree/master/ruby", 25 | "runtimeVersion": "2.6.1", 26 | "shortDescription": "Ruby environment with WEBrick library", 27 | "status": "Stable", 28 | "version": "1.31.1" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Model/FunctionStore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Fission.DotNet.Model; 4 | 5 | public class FunctionStore 6 | { 7 | public FunctionStore(string function) 8 | { 9 | if (string.IsNullOrEmpty(function)) 10 | { 11 | throw new ArgumentException("Function string cannot be null or empty", nameof(function)); 12 | } 13 | 14 | var parts = function.Split(':'); 15 | if (parts.Length != 3) 16 | { 17 | throw new ArgumentException("Function string must contain exactly three parts separated by dots", nameof(function)); 18 | } 19 | 20 | Assembly = $"{parts[0]}.dll"; 21 | Namespace = parts[1]; 22 | FunctionName = parts[2]; 23 | } 24 | public string Assembly { get; private set; } 25 | public string Namespace { get; private set; } 26 | public string FunctionName { get; private set; } 27 | } 28 | -------------------------------------------------------------------------------- /dotnet/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using Fission.DotNetCore.Api; 4 | 5 | namespace Fission.DotNetCore.Compiler 6 | { 7 | class Function 8 | { 9 | private readonly Assembly _assembly; 10 | private readonly Type _type; 11 | private readonly MethodInfo _info; 12 | 13 | public Function(Assembly assembly, Type type, MethodInfo info) 14 | { 15 | if (info == null) throw new ArgumentNullException(nameof(info)); 16 | if (assembly == null) throw new ArgumentNullException(nameof(assembly)); 17 | if (type == null) throw new ArgumentNullException(nameof(type)); 18 | _assembly = assembly; 19 | _type = type; 20 | _info = info; 21 | } 22 | 23 | public object Invoke(FissionContext context) 24 | { 25 | return _info.Invoke(_assembly.CreateInstance(_type.FullName), new[] { context }); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dotnet20/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using Fission.DotNetCore.Api; 4 | 5 | namespace Fission.DotNetCore.Compiler 6 | { 7 | class Function 8 | { 9 | private readonly Assembly _assembly; 10 | private readonly Type _type; 11 | private readonly MethodInfo _info; 12 | 13 | public Function(Assembly assembly, Type type, MethodInfo info) 14 | { 15 | if (info == null) throw new ArgumentNullException(nameof(info)); 16 | if (assembly == null) throw new ArgumentNullException(nameof(assembly)); 17 | if (type == null) throw new ArgumentNullException(nameof(type)); 18 | _assembly = assembly; 19 | _type = type; 20 | _info = info; 21 | } 22 | 23 | public object Invoke(FissionContext context) 24 | { 25 | return _info.Invoke(_assembly.CreateInstance(_type.FullName), new[] { context }); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | Fission.DotNet.Common 11 | 1.1.0 12 | Lorenzo Caldon 13 | Fission dotnet environment common package 14 | GPL-3.0-or-later 15 | https://github.com/lcsoft77/fission-env-dotnet8 16 | ./nupkg 17 | 18 | 19 | 20 | README.md 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /binary/env.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // Utility functions for working with environment variables 9 | type Env struct { 10 | Vars []*EnvVar 11 | } 12 | 13 | type EnvVar struct { 14 | Key string 15 | Val string 16 | } 17 | 18 | func FromString(rawEnvVar string) *EnvVar { 19 | parts := strings.SplitN(rawEnvVar, "=", 2) 20 | return &EnvVar{parts[0], parts[1]} 21 | } 22 | 23 | func (ev *EnvVar) ToString() string { 24 | return fmt.Sprintf("%s=%s", ev.Key, ev.Val) 25 | } 26 | 27 | func (e *Env) SetEnv(envVar *EnvVar) { 28 | e.Vars = append(e.Vars, envVar) 29 | } 30 | 31 | func (e *Env) ToStringEnv() []string { 32 | var result []string 33 | for _, envVar := range e.Vars { 34 | result = append(result, envVar.ToString()) 35 | } 36 | return result 37 | } 38 | 39 | func NewEnv(stringEnv []string) *Env { 40 | env := &Env{} 41 | for _, rawEnvVar := range stringEnv { 42 | env.SetEnv(FromString(rawEnvVar)) 43 | } 44 | return env 45 | } 46 | -------------------------------------------------------------------------------- /tensorflow-serving/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "examples": "https://github.com/fission/environments/tree/master/tensorflow-serving/examples", 4 | "icon": "./logo/Tensorflow_logo.svg", 5 | "image": "tensorflow-serving-env", 6 | "keywords": [], 7 | "kind": "environment", 8 | "maintainers": [ 9 | { 10 | "link": "https://github.com/life1347", 11 | "name": "life1347" 12 | }, 13 | { 14 | "link": "https://github.com/soamvasani", 15 | "name": "soamvasani" 16 | }, 17 | { 18 | "link": "https://github.com/vishal-biyani", 19 | "name": "vishal-biyani" 20 | } 21 | ], 22 | "name": "Tensorflow Serving Environment", 23 | "readme": "https://github.com/fission/environments/tree/master/tensorflow-serving", 24 | "runtimeVersion": "latest", 25 | "shortDescription": "TensorFlow Serving for machine learning models", 26 | "status": "Stable", 27 | "version": "1.31.1" 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /jvm-jersey/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "jvm-jersey-builder-22", 4 | "examples": "https://github.com/fission/environments/tree/master/jvm-jersey/examples", 5 | "icon": "./logo/Java-Logo.png", 6 | "image": "jvm-jersey-env-22", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/life1347", 12 | "name": "life1347" 13 | }, 14 | { 15 | "link": "https://github.com/soamvasani", 16 | "name": "soamvasani" 17 | }, 18 | { 19 | "link": "https://github.com/vishal-biyani", 20 | "name": "vishal-biyani" 21 | } 22 | ], 23 | "name": "JVM Environment", 24 | "readme": "https://github.com/fission/environments/tree/master/jvm-jersey", 25 | "runtimeVersion": "22", 26 | "shortDescription": "JVM environment based on Jersey RESTful Web Services framework", 27 | "status": "Stable", 28 | "version": "1.31.2" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /dotnet20/Model/BuilderRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Fission.DotNetCore.Model 6 | { 7 | public class BuilderRequest 8 | { 9 | /// 10 | /// this is folder path of deployment package which contains all deployment content copied to env 11 | /// 12 | public string filepath { get; set; } 13 | public string functionName { get; set; } 14 | public string url { get; set; } 15 | public FunctionMetadata FunctionMetadata { get; set; } 16 | } 17 | public class FunctionMetadata 18 | { 19 | public string name { get; set; } 20 | public string @namespace { get; set; } 21 | public string selfLink { get; set; } 22 | public string uid { get; set; } 23 | public string resourceVersion { get; set; } 24 | public int generation { get; set; } 25 | public DateTime creationTimestamp { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dotnet/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "examples": "https://github.com/fission/environments/tree/master/dotnet/examples", 4 | "icon": "./logo/dotnet-logo.svg", 5 | "image": "dotnet-env", 6 | "keywords": [], 7 | "kind": "environment", 8 | "maintainers": [ 9 | { 10 | "link": "https://github.com/life1347", 11 | "name": "life1347" 12 | }, 13 | { 14 | "link": "https://github.com/soamvasani", 15 | "name": "soamvasani" 16 | }, 17 | { 18 | "link": "https://github.com/vishal-biyani", 19 | "name": "vishal-biyani" 20 | } 21 | ], 22 | "name": "Dotnet Environment", 23 | "readme": "https://github.com/fission/environments/tree/master/dotnet", 24 | "runtimeVersion": "1.1.0", 25 | "shortDescription": "Fission Dotnet 1.1.0 runtime uses Kestrel with Nancy to host the internal web server and uses Roslyn to compile the uploaded code.", 26 | "status": "Stable", 27 | "version": "1.31.1" 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /binary/test/local_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # TODO placeholder until we have better tests :) 4 | TMPPATH="/tmp/binary" 5 | SERVER="http://localhost:8888" 6 | set -x 7 | set -e 8 | 9 | DIR=$(dirname $0) 10 | if [ -d "$TMPPATH" ]; then 11 | rm -r $TMPPATH 12 | fi 13 | 14 | mkdir -p "$TMPPATH"/userfunc/user 15 | mkdir -p "$TMPPATH"/bin 16 | 17 | echo "-- Starting server" 18 | go build -o binary-server server.go env.go 19 | ./binary-server -i "$TMPPATH"/bin/userfunc & 20 | 21 | cleanup() { 22 | echo "-- Cleanup" 23 | echo "Killing process $SERVER_PID" 24 | pkill binary-server 25 | } 26 | trap cleanup EXIT 27 | sleep 5 28 | 29 | echo "--Healthz" 30 | curl -i -f -X GET "$SERVER"/healthz 31 | 32 | echo "-- Specializing" 33 | curl -i -f -XPOST "$SERVER"/v2/specialize -H 'Content-Type: application/json' -d '{"filepath": "./examples/echo.sh"}' 34 | 35 | echo "-- Running" 36 | curl -i -f -XPOST "$SERVER" -d 'Echoooooo!' 37 | 38 | echo "-- Done running jobs" 39 | 40 | echo "-- Background jobs" 41 | jobs 42 | -------------------------------------------------------------------------------- /dotnet8/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=ghcr.io/fission/builder:v1.21.0 2 | ARG DOTNET_BASE_IMG=mcr.microsoft.com/dotnet/sdk:8.0 3 | 4 | FROM ${BUILDER_IMAGE} 5 | FROM ${DOTNET_BASE_IMG} 6 | 7 | COPY --from=0 /builder /builder 8 | 9 | # Install required tools 10 | RUN apt-get update && apt-get install -y unzip zip curl && rm -rf /var/lib/apt/lists/* 11 | 12 | # Create Fission.DotNet.Common project directory 13 | RUN mkdir -p /app/Fission.DotNet.Common 14 | 15 | # Copy Fission.DotNet.Common source files 16 | COPY Fission.DotNet.Common/ /app/Fission.DotNet.Common/ 17 | 18 | # Build the Fission.DotNet.Common library properly 19 | WORKDIR /app/Fission.DotNet.Common 20 | RUN dotnet build -c Release 21 | RUN dotnet publish -c Release -o /app 22 | 23 | # Verify the DLL was created 24 | RUN ls -la /app/Fission.DotNet.Common.dll 25 | 26 | # Copy the build script 27 | COPY builder/defaultBuildCmd /usr/local/bin/build 28 | COPY builder/defaultBuildCmd /build 29 | RUN chmod +x /usr/local/bin/build /build 30 | 31 | EXPOSE 8001 -------------------------------------------------------------------------------- /dotnet20/Utility/ObjectConverter.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNetCore.Model; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace Fission.DotNetCore.Utilty 8 | { 9 | public sealed class ObjectConverter 10 | { 11 | 12 | private static readonly Lazy lazy = 13 | new Lazy(() => new ObjectConverter()); 14 | 15 | public static ObjectConverter Instance { get { return lazy.Value; } } 16 | 17 | private ObjectConverter() 18 | { 19 | 20 | } 21 | 22 | 23 | public EnvironmentSettings GetWatcherSettingsFromJson(string json) 24 | { 25 | return JsonConvert.DeserializeObject(json); 26 | } 27 | 28 | public FunctionSpecification GetFunctionSpecificationFromJson(string json) 29 | { 30 | return JsonConvert.DeserializeObject(json); 31 | } 32 | 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /python/examples/guestbook/get.py: -------------------------------------------------------------------------------- 1 | # 2 | # Handles GET /guestbook -- returns a list of items in the guestbook 3 | # with a form to add more. 4 | # 5 | 6 | from flask import current_app, escape 7 | import redis 8 | 9 | # Connect to redis. This is run only when this file is loaded; as 10 | # long as the pod is alive, the connection is reused. 11 | redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0) 12 | 13 | def main(): 14 | messages = redisConnection.lrange('guestbook', 0, -1) 15 | 16 | items = [("
  • %s
  • " % escape(m.decode('utf-8'))) for m in messages] 17 | ul = "
      %s
    " % "\n".join(items) 18 | return """ 19 | 20 |

    Guestbook

    21 |
    22 | 23 | 24 |
    25 |
    26 | %s 27 | 28 | """ % ul 29 | -------------------------------------------------------------------------------- /perl/examples/hello.pm: -------------------------------------------------------------------------------- 1 | =pod 2 | 3 | You return a CODEREF from the package that will be called as your function. 4 | 5 | The code in the server is something like this (simplified): 6 | 7 | my $sub = require('hello.pm'); 8 | $sub->(request); 9 | 10 | As you can see, you get the L object as first argument 11 | to your function. You can use it to retrieve params given to your function or 12 | anything else Dancer2 offers. You can also use Dancer2 and use its DSL. 13 | 14 | =cut 15 | 16 | use utf8; 17 | use strict; 18 | use warnings; 19 | 20 | # Get more helper functions (status and send_as below) 21 | use Dancer2; 22 | 23 | return sub { 24 | my ($request) = @_; 25 | 26 | my ($name) = $request->query_parameters->{'name'} // 'world'; 27 | 28 | # set status code by name 29 | status 'i_m_a_teapot'; 30 | 31 | # send message as JSON 32 | send_as JSON => { 33 | msg => "Hello, $name", 34 | auth => $request->header('Authorization'), # read request header 35 | }; 36 | }; 37 | -------------------------------------------------------------------------------- /dotnet20/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "dotnet20-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/dotnet20/examples", 5 | "icon": "./logo/logo_NETcore.svg", 6 | "image": "dotnet20-env", 7 | "keywords": [], 8 | "kind": "environment", 9 | "maintainers": [ 10 | { 11 | "link": "https://github.com/life1347", 12 | "name": "life1347" 13 | }, 14 | { 15 | "link": "https://github.com/soamvasani", 16 | "name": "soamvasani" 17 | }, 18 | { 19 | "link": "https://github.com/vishal-biyani", 20 | "name": "vishal-biyani" 21 | } 22 | ], 23 | "name": "Dotnet 2 Environment", 24 | "readme": "https://github.com/fission/environments/tree/master/dotnet20", 25 | "runtimeVersion": "2.0.0", 26 | "shortDescription": "Fission Dotnet 2.0.0 runtime uses Kestrel with Nancy to host the internal web server and uses Roslyn to compile the uploaded code.", 27 | "status": "Stable", 28 | "version": "1.31.1" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /dotnet20/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder 2 | FROM ${BUILDER_IMAGE} AS fission-builder 3 | 4 | 5 | FROM microsoft/dotnet:2.0.0-sdk AS builderimage 6 | 7 | 8 | WORKDIR /app 9 | 10 | # Copy csproj and restore as distinct layers 11 | COPY *.csproj ./ 12 | RUN dotnet restore 13 | 14 | # Copy everything else and build 15 | COPY . ./ 16 | RUN dotnet publish -c Release -o out 17 | 18 | 19 | # Build runtime image 20 | FROM microsoft/dotnet:aspnetcore-runtime 21 | WORKDIR /app 22 | COPY --from=builderimage /app/out . 23 | 24 | #this builder is actually compilation from : https://github.com/fission/fission/tree/master/builder/cmd and renamed cmd.exe to builder 25 | # make sure to compile it in linux only else you will get exec execute error as binary was compiled in windows and running on linux 26 | 27 | COPY --from=fission-builder /builder /builder 28 | 29 | #ADD builder /builder 30 | 31 | ADD build.sh /usr/local/bin/build 32 | RUN chmod +x /usr/local/bin/build 33 | 34 | ADD build.sh /bin/build 35 | RUN chmod +x /bin/build 36 | 37 | EXPOSE 8001 -------------------------------------------------------------------------------- /perl/server.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use utf8; 4 | use strict; 5 | use warnings; 6 | 7 | use Getopt::Args; 8 | use Plack::Handler::Twiggy; 9 | 10 | opt codepath => ( 11 | isa => 'Str', 12 | default => '/userfunc/user', 13 | comment => 'Path to the user code', 14 | ); 15 | 16 | opt port => ( 17 | isa => 'Int', 18 | default => 8888, 19 | comment => 'Port to listen on', 20 | ); 21 | 22 | my $options = optargs(); 23 | 24 | { 25 | package App::Fission::Perl; 26 | 27 | use Dancer2; 28 | 29 | our $userfunc; 30 | 31 | post '/specialize' => sub { 32 | if($userfunc) { 33 | send_error('Not a generic container', 400); 34 | } 35 | 36 | $userfunc = require($options->{codepath}); 37 | return ''; 38 | }; 39 | 40 | any '/' => sub { 41 | return $userfunc ? $userfunc->(request) : send_error('Not yet specialized', 500); 42 | }; 43 | } 44 | 45 | my $handler = Plack::Handler::Twiggy->new(port => $options->{port}); 46 | $handler->run(App::Fission::Perl->to_app); 47 | -------------------------------------------------------------------------------- /dotnet/fission-dotnet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp1.0 5 | fission-dotnet 6 | Exe 7 | dotnet 8 | $(PackageTargetFallback);netstandard1.3 9 | 1.1.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /dotnet20/Utility/EnvironmentExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Fission.DotNetCore.Utilty 8 | { 9 | public static class EnvironmentExtension 10 | { 11 | 12 | public static IEnumerable DistinctBy( 13 | this IEnumerable source, 14 | Func keySelector) 15 | { 16 | var knownKeys = new HashSet(); 17 | return source.Where(element => knownKeys.Add(keySelector(element))); 18 | } 19 | public static string GetrelevantPathAsPerOS(this string curruntPath) 20 | { 21 | if (EnvironmentHelper.Instance.environmentSettings.RunningOnwindows && curruntPath.Contains("\\")) 22 | { 23 | return curruntPath; 24 | } 25 | else 26 | { 27 | return curruntPath.Replace("\\", "/"); 28 | } 29 | } 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /python-fastapi/examples/guestbook/get.py: -------------------------------------------------------------------------------- 1 | # 2 | # Handles GET /guestbook -- returns a list of items in the guestbook 3 | # with a form to add more. 4 | # 5 | 6 | from fastapi import Request, Response 7 | from markupsafe import escape 8 | import redis 9 | 10 | # Connect to redis. This is run only when this file is loaded; as 11 | # long as the pod is alive, the connection is reused. 12 | redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0) 13 | 14 | def main(request: Request): 15 | messages = redisConnection.lrange('guestbook', 0, -1) 16 | 17 | items = [("
  • %s
  • " % escape(m.decode('utf-8'))) for m in messages] 18 | ul = "
      %s
    " % "\n".join(items) 19 | return Response(""" 20 | 21 |

    Guestbook

    22 |
    23 | 24 | 25 |
    26 |
    27 | %s 28 | 29 | """ % ul) 30 | -------------------------------------------------------------------------------- /dotnet8/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use the .NET 8 SDK image for runtime (needed for compilation support) 2 | FROM mcr.microsoft.com/dotnet/sdk:8.0 3 | 4 | # Install required tools 5 | RUN apt-get update && apt-get install -y unzip curl && rm -rf /var/lib/apt/lists/* 6 | 7 | # Set working directory 8 | WORKDIR /app 9 | 10 | # Copy the Fission .NET runtime application 11 | COPY Fission.DotNet/ /app/Fission.DotNet/ 12 | COPY Fission.DotNet.Common/ /app/Fission.DotNet.Common/ 13 | 14 | # Build the runtime application 15 | RUN dotnet restore Fission.DotNet/Fission.DotNet.csproj 16 | RUN dotnet publish Fission.DotNet/Fission.DotNet.csproj -c Release -o /app/publish 17 | 18 | # Build and copy Fission.DotNet.Common.dll to /app for runtime compilation 19 | RUN dotnet build Fission.DotNet.Common/Fission.DotNet.Common.csproj -c Release -o /app/ 20 | 21 | # Create function directory 22 | RUN mkdir -p /function 23 | 24 | # Set environment variables 25 | ENV ASPNETCORE_URLS=http://*:8888 26 | ENV ASPNETCORE_ENVIRONMENT=Production 27 | 28 | # Expose port 29 | EXPOSE 8888 30 | 31 | # Start the runtime 32 | CMD ["dotnet", "/app/publish/Fission.DotNet.dll"] 33 | -------------------------------------------------------------------------------- /hack/merge-json.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TMP_FILE=temp.json 4 | JQ=jq 5 | 6 | if ! command -v sed >/dev/null 2>&1; then 7 | echo "You must install 'sed' to use this script." 8 | exit 1 9 | fi 10 | if ! command -v $JQ >/dev/null; then 11 | echo "jq is not installed. Please install it and try again." 12 | exit 1 13 | fi 14 | 15 | echo "[" >"$TMP_FILE" 16 | for file in $(find . -name envconfig.json); do 17 | echo "Validating $file" 18 | if ! $JQ . <"$file" >/dev/null; then 19 | echo "Invaild json file $file. Please check $file" 20 | echo "JSON merge failed. Please try again." 21 | exit 1 22 | fi 23 | echo "Merging $file" 24 | cat "$file" >>"$TMP_FILE" 25 | echo "," >>"$TMP_FILE" 26 | done 27 | sed -ie '$s/,$//' "$TMP_FILE" 28 | echo "]" >>"$TMP_FILE" 29 | 30 | if ! $JQ . <"$TMP_FILE" >/dev/null; then 31 | echo "JSON merge failed. Please check the merge result $TMP_FILE and try again." 32 | exit 1 33 | fi 34 | 35 | echo "Updating environments.json" 36 | cp -v $TMP_FILE ./environments.json 37 | rm $TMP_FILE* 38 | 39 | # cd environments-ui && npm i && npm run build 40 | -------------------------------------------------------------------------------- /nodejs/test/test-case-3/wordCount.js: -------------------------------------------------------------------------------- 1 | module.exports = async (context) => { 2 | // Get the request body as string 3 | let requestText = ""; 4 | 5 | if (context.request && context.request.body) { 6 | // Handle different body types 7 | if (typeof context.request.body === 'string') { 8 | requestText = context.request.body; 9 | } else if (typeof context.request.body === 'object') { 10 | // When body is parsed as form data, get the first key 11 | const keys = Object.keys(context.request.body); 12 | if (keys.length > 0) { 13 | // Reconstruct the original string from form data keys 14 | requestText = keys.join(' '); 15 | } 16 | } 17 | } 18 | 19 | const splitStringArray = requestText.toString().split(" ").filter(word => word.length > 0); 20 | 21 | return { 22 | status: 200, 23 | body: JSON.stringify({ 24 | wordCount: splitStringArray.length, 25 | words: splitStringArray, 26 | moduleType: "CJS", 27 | nodeVersion: process.version 28 | }), 29 | headers: { 30 | "Content-Type": "application/json" 31 | } 32 | }; 33 | }; 34 | -------------------------------------------------------------------------------- /dotnet20/Model/FunctionSpecification.cs: -------------------------------------------------------------------------------- 1 | using Fission.DotNetCore.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Fission.DotNetCore.Model 7 | { 8 | public class FunctionSpecification 9 | { 10 | public FunctionSpecification() 11 | { 12 | this.libraries = new List(); 13 | } 14 | public string functionName { get; set; } 15 | public List libraries { get; set; } 16 | public string hash { get; set; } 17 | public string certificatePath { get; set; } 18 | } 19 | public class Library 20 | { 21 | public Library() 22 | { 23 | 24 | } 25 | 26 | public Library(DllInfo dllInfo) 27 | { 28 | this.name = dllInfo.name; 29 | this.nugetPackage = dllInfo.rootPackage; 30 | this.path = dllInfo.path; 31 | } 32 | public string name { get; set; } 33 | //public string version { get; set; } 34 | public string path { get; set; } 35 | public string nugetPackage { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Adapter/FissionLoggerAdapter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Fission.DotNet.Common; 3 | 4 | namespace Fission.DotNet.Adapter; 5 | 6 | public class FissionLoggerAdapter : Common.ILogger 7 | { 8 | private Microsoft.Extensions.Logging.ILogger _logger; 9 | 10 | public FissionLoggerAdapter(Microsoft.Extensions.Logging.ILogger logger) 11 | { 12 | this._logger = logger; 13 | } 14 | 15 | public void LogCritical(string message) 16 | { 17 | _logger.LogCritical(message); 18 | } 19 | 20 | public void LogDebug(string message) 21 | { 22 | _logger.LogDebug(message); 23 | } 24 | 25 | public void LogError(string message, Exception exception) 26 | { 27 | _logger.LogError(exception, message); 28 | } 29 | 30 | public void LogError(string message) 31 | { 32 | _logger.LogError(message); 33 | } 34 | 35 | public void LogInformation(string message) 36 | { 37 | _logger.LogInformation(message); 38 | } 39 | 40 | public void LogWarning(string message) 41 | { 42 | _logger.LogWarning(message); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dotnet20/builder/Model/FunctionSpecification.cs: -------------------------------------------------------------------------------- 1 | using NugetWorker; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace Builder.Model 8 | { 9 | public class FunctionSpecification 10 | { 11 | public FunctionSpecification() 12 | { 13 | this.libraries = new List(); 14 | } 15 | public string functionName { get; set; } 16 | public List libraries { get; set; } 17 | public string hash { get; set; } 18 | public string certificatePath { get; set; } 19 | } 20 | 21 | 22 | public class Library 23 | { 24 | public Library() 25 | { 26 | 27 | } 28 | 29 | public Library(DllInfo dllInfo) 30 | { 31 | this.name = dllInfo.name; 32 | this.nugetPackage = dllInfo.rootPackage; 33 | this.path = dllInfo.path; 34 | } 35 | public string name { get; set; } 36 | //public string version { get; set; } 37 | public string path { get; set; } 38 | public string nugetPackage { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dotnet8/examples/MultiFileExample/Models/Weather.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MultiFileExample.Models 5 | { 6 | public class WeatherResponse 7 | { 8 | public string City { get; set; } 9 | public int Temperature { get; set; } 10 | public string Condition { get; set; } 11 | public int Humidity { get; set; } 12 | public int WindSpeed { get; set; } 13 | public DateTime Timestamp { get; set; } 14 | public string Source { get; set; } 15 | } 16 | 17 | public class DailyForecast 18 | { 19 | public DateTime Date { get; set; } 20 | public int High { get; set; } 21 | public int Low { get; set; } 22 | public string Condition { get; set; } 23 | public int ChanceOfRain { get; set; } 24 | } 25 | 26 | public class ForecastResponse 27 | { 28 | public string City { get; set; } 29 | public int Days { get; set; } 30 | public List Forecasts { get; set; } 31 | public DateTime GeneratedAt { get; set; } 32 | public string Source { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /dotnet20/builder/nugetSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "NugetFolder": "Nugetdownload", 3 | "DisableCache": false, 4 | "CSVDirectory": "logs", 5 | "RunningOnwindows": false, 6 | "NugetRepositories": [ 7 | { 8 | "Order": 1, 9 | "IsPrivate": false, 10 | "Name": "local", 11 | "Source": "Nugetdownload", //in case of local , relative path to folder 12 | "IsPasswordClearText": false, 13 | "Username": "", 14 | "Password": "" 15 | }, 16 | { 17 | "Order": 2, 18 | "IsPrivate": false, 19 | "Name": "NugetV3", 20 | "Source": "https://api.nuget.org/v3/index.json", 21 | "IsPasswordClearText": false, 22 | "Username": "", 23 | "Password": "" 24 | } 25 | //, 26 | //{ 27 | // "Order": 3, 28 | // "IsPrivate": true, 29 | // "Name": "myPrivateRepository", //in case of private repo , if not using, then just remove this section No 3 30 | // "Source": "https://URL-FOR-myPrivateRepository/api/nuget/nugetcore/COMPLETE-END-POINT", 31 | // "IsPasswordClearText": true, 32 | // "Username": "johndeo@myorg.com", 33 | // "Password": "AlPH24GAMAc49fDELTA" 34 | //} 35 | 36 | ] 37 | } -------------------------------------------------------------------------------- /perl/README.md: -------------------------------------------------------------------------------- 1 | # Fission Perl environment 2 | 3 | This is an environment to execute perl code. 4 | 5 | It is implemented using the lightweight web application framework 6 | [Dancer2](https://metacpan.org/pod/Dancer2) and the async I/O webserver 7 | [Twiggy](https://metacpan.org/pod/Twiggy). 8 | 9 | Since Twiggy is implemented with [AnyEvent](https://metacpan.org/pod/AnyEvent), 10 | you can write async code using AnyEvent in your function. 11 | 12 | Looking for ready-to-run examples? See the [Perl examples directory](../../examples/perl). 13 | 14 | ## Build this image 15 | 16 | ``` 17 | docker build -t USER/perl . && docker push USER/perl 18 | ``` 19 | 20 | ## Usage 21 | 22 | The function you upload is actually a perl package returning a coderef (see the 23 | example). 24 | 25 | You can use other packages and add more subs, but only the coderef you returned 26 | from the package is executed directly. 27 | 28 | Your main-function gets exactly one argument: the Dancer2 request object. You 29 | may want to `use Dancer2` to get functions like `send_error`. 30 | 31 | ## Example 32 | 33 | ```perl 34 | # hello.pm 35 | return sub { 36 | return 'Hello, Perl!'; 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /tensorflow-serving/README.md: -------------------------------------------------------------------------------- 1 | # Fission: Tensorflow Serving Environment 2 | 3 | This is the Tensorflow Serving environment for Fission. 4 | 5 | It's a Docker image containing a Go runtime, along with a tensorflow serving service. 6 | 7 | ## How it works 8 | 9 | Tensorflow Serving is an serving service that supports both RESTful API and gRPC endpoints. In current implementation, 10 | Go server launches `tensorflow_model_server` to load in model during specialization. As long as the Go server receives 11 | requests from router it creates a reverse proxy that connects to RESTful API endpoint exposed by tensorflow_model_server 12 | and get response from the upstream server for user. 13 | 14 | ## Build this image 15 | 16 | ``` 17 | docker build -t USER/tensorflow-serving . && docker push USER/tensorflow-serving 18 | ``` 19 | 20 | ## Using the image in fission 21 | 22 | You can add this customized image to fission with "fission env create": 23 | 24 | ``` 25 | fission env create --name tensorflow --image USER/tensorflow-serving --version 2 26 | ``` 27 | 28 | After this, fission functions that have the env parameter set to the 29 | same environment name as this command will use this environment. 30 | -------------------------------------------------------------------------------- /dotnet20/builder/Builder.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27906.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Builder.csproj", "{D479FF57-44A0-483D-B5B0-B6C475D12292}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D479FF57-44A0-483D-B5B0-B6C475D12292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D479FF57-44A0-483D-B5B0-B6C475D12292}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D479FF57-44A0-483D-B5B0-B6C475D12292}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D479FF57-44A0-483D-B5B0-B6C475D12292}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {AA20D0B8-E5D5-4BA1-9E29-FC5132A4DD00} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /ruby/examples/events_to_slack.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | require 'net/http' 3 | require 'uri' 4 | require 'json' 5 | 6 | SLACK_BASE_URL = 'https://hooks.slack.com/' 7 | SLACK_WEBHOOK_PATH = 'YOUR RELATIVE PATH HERE' # Something like "/services/XXX/YYY/zZz123" 8 | 9 | def send_slack_message(message) 10 | uri = URI.join(SLACK_BASE_URL, SLACK_WEBHOOK_PATH) 11 | data = "{'channel': '#hackdays-serverless', 'username': 'fissionbot', 'text': \"#{message}\", 'icon_emoji': ':fission:'}" 12 | res = Net::HTTP.post_form(uri, payload: data) 13 | res.success? 14 | end 15 | 16 | def handler(context) 17 | request = context.request 18 | 19 | event_type = request.headers['X-Kubernetes-Event-Type'] 20 | object_type = request.headers['X-Kubernetes-Object-Type'] 21 | 22 | object = JSON.parse(request.body.read) 23 | object_name = object.dig('metadata', 'name') 24 | object_namespace = object.dig('metadata', 'namespace') 25 | 26 | message = "#{event_type} #{object_type} #{object_namespace}/#{object_name}" 27 | 28 | if send_slack_message(message) 29 | "Slack message sent - #{message}" 30 | else 31 | Rack::Response.new(["Failed to send Slack message - #{message}"], 500).finish 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /dotnet20/builder/log4net.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /nodejs/test/test-case-7/wordCount.js: -------------------------------------------------------------------------------- 1 | // ESM wordCount test case for Node.js 22 2 | export default async (context) => { 3 | // Get the request body as string 4 | let requestText = ""; 5 | 6 | if (context.request && context.request.body) { 7 | // Handle different body types 8 | if (typeof context.request.body === 'string') { 9 | requestText = context.request.body; 10 | } else if (typeof context.request.body === 'object') { 11 | // When body is parsed as form data, get the first key 12 | const keys = Object.keys(context.request.body); 13 | if (keys.length > 0) { 14 | // Reconstruct the original string from form data keys 15 | requestText = keys.join(' '); 16 | } 17 | } 18 | } 19 | 20 | const splitStringArray = requestText.toString().split(" ").filter(word => word.length > 0); 21 | 22 | return { 23 | status: 200, 24 | body: JSON.stringify({ 25 | wordCount: splitStringArray.length, 26 | words: splitStringArray, 27 | moduleType: "ESM", 28 | nodeVersion: process.version 29 | }), 30 | headers: { 31 | "Content-Type": "application/json", 32 | "X-Module-Type": "ESM" 33 | } 34 | }; 35 | }; -------------------------------------------------------------------------------- /dotnet20/dotnet20.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "fission-dotnet20", "fission-dotnet20.csproj", "{3F044DE1-74E5-48F7-8D23-233C24AAA45C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3F044DE1-74E5-48F7-8D23-233C24AAA45C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {3F044DE1-74E5-48F7-8D23-233C24AAA45C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {3F044DE1-74E5-48F7-8D23-233C24AAA45C}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {3F044DE1-74E5-48F7-8D23-233C24AAA45C}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {272000F7-BBEC-4B61-8865-783EF7E5CEE9} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Fission.DotNet.Common.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | /Users/davidcasa/.nuget/packages/ 8 | /Users/davidcasa/.nuget/packages/ 9 | PackageReference 10 | 6.11.1 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dotnet20/fission-dotnet20.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Always 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/Fission.DotNet.Common.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 17 3 | VisualStudioVersion = 17.5.2.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fission.DotNet.Common", "Fission.DotNet.Common.csproj", "{66CA3524-4798-6315-18DF-47CD0B936395}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {66CA3524-4798-6315-18DF-47CD0B936395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {66CA3524-4798-6315-18DF-47CD0B936395}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {66CA3524-4798-6315-18DF-47CD0B936395}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {66CA3524-4798-6315-18DF-47CD0B936395}.Release|Any CPU.Build.0 = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(SolutionProperties) = preSolution 19 | HideSolutionNode = FALSE 20 | EndGlobalSection 21 | GlobalSection(ExtensibilityGlobals) = postSolution 22 | SolutionGuid = {AF6A70F1-84DB-4983-A581-08BC54DF98A5} 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /nodejs/examples/weather.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fetch = require('node-fetch'); 4 | 5 | module.exports = async (context) => { 6 | const location = ctx.request.body.location; 7 | 8 | if (!location) { 9 | return { 10 | status: 400, 11 | body: { 12 | text: 'You must provide a location.' 13 | } 14 | }; 15 | } 16 | 17 | try { 18 | const locationSearch = await fetch(`https://www.metaweather.com/api/location/search/?query=${encodeURIComponent(location)}`).then(res => JSON.parse(res)); 19 | const weatherResponse = await fetch(`https://www.metaweather.com/api/location/(${locationSearch[0].woeid}/`).then(res => JSON.parse(res)); 20 | const weather = weatherResponse.consolidatedWeather[0] 21 | return { 22 | status: 200, 23 | body: { 24 | text: `It is ${weather.the_temp} celsius degrees in ${location} and ${weather.weather_state_name}` 25 | }, 26 | headers: { 27 | 'Content-Type': 'application/json' 28 | } 29 | }; 30 | } catch (e) { 31 | console.error(e); 32 | return { 33 | status: 500, 34 | body: e 35 | }; 36 | } 37 | } -------------------------------------------------------------------------------- /python-fastapi/examples/README.md: -------------------------------------------------------------------------------- 1 | # Python Examples 2 | 3 | This directory contains a Python examples to show different the features of the Fission Python environment: 4 | - `hello.py` is a simple Pythonic _hello world_ function. 5 | - `sourcepkg/` is an example of how to use the Fission Python Build environment to resolve (pip) dependencies 6 | before deploying the function. 7 | - `multifile/` shows how to create Fission Python functions with multiple source files. 8 | - `requestdata.py` shows how you can access the HTTP request fields, such as the body, headers and query. 9 | - `statuscode.py` is an example of how you can change the response status code. 10 | - `guestbook/` is a more realistic demonstration of using Python and Fission to create a serverless guestbook. 11 | 12 | ## Getting Started 13 | 14 | Create a Fission Python environment with the default Python runtime image (this does not include the build environment): 15 | ``` 16 | fission environment create --name python --image ghcr.io/fission/python-fastapi-env 17 | ``` 18 | 19 | Use the `hello.py` to create a Fission Python function: 20 | ``` 21 | fission function create --name hello-py --env python --code hello.py 22 | ``` 23 | 24 | Test the function: 25 | ``` 26 | fission function test --name hello-py 27 | ``` 28 | -------------------------------------------------------------------------------- /dotnet8/.gitignore: -------------------------------------------------------------------------------- 1 | # Build results 2 | [Dd]ebug/ 3 | [Dd]ebugPublic/ 4 | [Rr]elease/ 5 | [Rr]eleases/ 6 | x64/ 7 | x86/ 8 | [Ww][Ii][Nn]32/ 9 | [Aa][Rr][Mm]/ 10 | [Aa][Rr][Mm]64/ 11 | bld/ 12 | [Bb]in/ 13 | [Oo]bj/ 14 | [Ll]og/ 15 | [Ll]ogs/ 16 | 17 | # Visual Studio cache/options directory 18 | .vs/ 19 | 20 | # .NET Core 21 | project.lock.json 22 | project.fragment.lock.json 23 | artifacts/ 24 | 25 | # Files built by Visual Studio 26 | *.user 27 | *.userosscache 28 | *.sln.docstates 29 | 30 | # Build results 31 | *.dll 32 | *.exe 33 | *.pdb 34 | *.cache 35 | *.log 36 | 37 | # NuGet Packages 38 | *.nupkg 39 | *.snupkg 40 | # The packages folder can be ignored because of Package Restore 41 | **/[Pp]ackages/* 42 | # except build/, which is used as an MSBuild target. 43 | !**/[Pp]ackages/build/ 44 | # Uncomment if necessary however generally it will be regenerated when needed 45 | #!**/[Pp]ackages/repositories.config 46 | # NuGet v3's project.json files produces more ignorable files 47 | *.nuget.props 48 | *.nuget.targets 49 | 50 | # Visual Studio cache files 51 | # files ending in .cache can be ignored 52 | *.[Cc]ache 53 | # but keep track of directories ending in .cache 54 | !?*.[Cc]ache/ 55 | 56 | # Example ZIP files (for testing) 57 | examples/**/*.zip 58 | 59 | # macOS 60 | .DS_Store -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Services/CustomAssemblyLoadContext.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.Loader; 3 | 4 | namespace Fission.DotNet.Services 5 | { 6 | public class CustomAssemblyLoadContext : AssemblyLoadContext 7 | { 8 | private AssemblyDependencyResolver _resolver; 9 | 10 | public CustomAssemblyLoadContext(string pluginPath, bool isCollectible = false) 11 | : base(pluginPath, isCollectible) 12 | { 13 | _resolver = new AssemblyDependencyResolver(pluginPath); 14 | } 15 | 16 | protected override Assembly? Load(AssemblyName assemblyName) 17 | { 18 | var assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName); 19 | if (assemblyPath != null) 20 | { 21 | return LoadFromAssemblyPath(assemblyPath); 22 | } 23 | return null; 24 | } 25 | 26 | protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) 27 | { 28 | var libraryPath = _resolver.ResolveUnmanagedDllToPath(unmanagedDllName); 29 | if (libraryPath != null) 30 | { 31 | return LoadUnmanagedDllFromPath(libraryPath); 32 | } 33 | return IntPtr.Zero; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:24776", 8 | "sslPort": 44362 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5074", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "launchUrl": "swagger", 27 | "applicationUrl": "https://localhost:7199;http://localhost:5074", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "launchUrl": "swagger", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /go/README.md: -------------------------------------------------------------------------------- 1 | # Fission: Go Environment 2 | 3 | This is the Go environment for Fission. 4 | 5 | It's a Docker image containing a Go runtime, along with a dynamic loader. 6 | 7 | Looking for ready-to-run examples? See the [Go examples directory](../../examples/go). 8 | 9 | ## Build this image 10 | 11 | ```sh 12 | docker build -t USER/go-env --build-arg GO_VERSION=1.16 --build-arg UBUNTU_VERSION=20.04 -f Dockerfile-1.1x . && docker push USER/go-env 13 | ``` 14 | 15 | Note that if you build the runtime, you must also build the go-builder 16 | image, to ensure that it's at the same version of go: 17 | 18 | ```sh 19 | cd builder && docker build -t USER/go-builder --build-arg GO_VERSION=1.16 -f Dockerfile-1.1x . && docker push USER/go-builder 20 | ``` 21 | 22 | ## Using the image in fission 23 | 24 | You can add this customized image to fission with "fission env 25 | create": 26 | 27 | ```sh 28 | fission env create --name go --image USER/go-env --builder USER/go-builder --version 2 29 | ``` 30 | 31 | Or, if you already have an environment, you can update its image: 32 | 33 | ```sh 34 | fission env update --name go --image USER/go-env --builder USER/go-builder 35 | ``` 36 | 37 | After this, fission functions that have the env parameter set to the 38 | same environment name as this command will use this environment. 39 | -------------------------------------------------------------------------------- /python/tests/websocket_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # TODO placeholder until we have better tests :) 4 | 5 | set -x 6 | set -e 7 | 8 | DIR=$(dirname $0) 9 | export RUNTIME_PORT=8083 10 | export MOCK_FETCHER=true 11 | export WSGI_FRAMEWORK=GEVENT 12 | export USERFUNCVOL=/tmp 13 | export TIMEOUT=5 14 | 15 | if ! [ -d test_env ]; then 16 | python3 -m virtualenv test_env 17 | fi 18 | source test_env/bin/activate 19 | 20 | pip3 install -r requirements.txt 21 | 22 | echo "-- Starting server" 23 | python3 $DIR/../server.py & 24 | 25 | SERVER_PID=$! 26 | cleanup() { 27 | echo "-- Cleanup" 28 | echo "Killing process $SERVER_PID" 29 | pkill -f '.*server.py' 30 | kill $SERVER_PID 31 | # deactivate 32 | # rm -r test_env 33 | ps -ef | grep python3 | grep -v grep 34 | } 35 | trap cleanup EXIT 36 | sleep 5 37 | 38 | echo "--Healthz" 39 | curl -f -X GET http://localhost:$RUNTIME_PORT/healthz 40 | 41 | echo "-- Specializing" 42 | curl -f -XPOST http://localhost:$RUNTIME_PORT/v2/specialize -H 'Content-Type: application/json' -d '{"filepath": "./examples/websocket/main.py", "functionName": "main"}' 43 | 44 | echo "-- Websocket ready to connect ws://localhost:$RUNTIME_PORT/." 45 | read -p "Press enter to continue" 46 | 47 | echo "-- Running user function" 48 | 49 | echo "-- Done running jobs" 50 | 51 | echo "-- Background jobs" 52 | jobs -------------------------------------------------------------------------------- /python/examples/README.md: -------------------------------------------------------------------------------- 1 | # Python Examples 2 | 3 | This directory contains a Python examples to show different the features of the Fission Python environment: 4 | - `hello.py` is a simple Pythonic _hello world_ function. 5 | - `requestdata.py` shows how you can access the HTTP request fields, such as the body, headers and query. 6 | - `statuscode.py` is an example of how you can change the response status code. 7 | - `multifile/` shows how to create Fission Python functions with multiple source files. 8 | - `guestbook/` is a more realistic demonstration of using Python and Fission to create a serverless guestbook. 9 | - `sourcepkg/` is an example of how to use the Fission Python Build environment to resolve (pip) dependencies 10 | before deploying the function. 11 | 12 | ## Getting Started 13 | 14 | Create a Fission Python environment with the default Python runtime image (this does not include the build environment): 15 | ``` 16 | fission environment create --name python --image fission/python-env 17 | ``` 18 | 19 | Use the `hello.py` to create a Fission Python function: 20 | ``` 21 | fission function create --name hello-py --env python --code hello.py 22 | ``` 23 | 24 | Test the function: 25 | ``` 26 | fission function test --name hello-py 27 | ``` 28 | 29 | For a full guide see the [official documentation on Python with Fission](https://docs.fission.io/languages/python/). 30 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/obj/Release/net8.0/Fission.DotNet.Common.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("Lorenzo Caldon")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] 15 | [assembly: System.Reflection.AssemblyDescriptionAttribute("Fission dotnet environment common package")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.1.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.1.0+da8ab386daab96def321895f43b0f975caf774ca")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("Fission.DotNet.Common")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("Fission.DotNet.Common")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.1.0.0")] 21 | [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/lcsoft77/fission-env-dotnet8")] 22 | 23 | // Generated by the MSBuild WriteCodeFragment class. 24 | 25 | -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Text.Json; 3 | using Fission.DotNet; 4 | using Fission.DotNet.Adapter; 5 | using Fission.DotNet.Interfaces; 6 | using Fission.DotNet.Services; 7 | 8 | var builder = WebApplication.CreateBuilder(args); 9 | 10 | // Use port 8888 for runtime 11 | builder.WebHost.UseUrls("http://*:8888"); 12 | 13 | // Add services to the container. 14 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle 15 | builder.Services.AddEndpointsApiExplorer(); 16 | builder.Services.AddSwaggerGen(); 17 | 18 | builder.Services.AddControllers(); 19 | 20 | builder.Services.AddSingleton(); 21 | builder.Services.AddTransient(); 22 | builder.Services.AddSingleton(); 23 | 24 | // Add the builder mode flag as a singleton service so controllers can access it 25 | builder.Services.AddSingleton(new BuilderModeService(false)); 26 | 27 | var app = builder.Build(); 28 | 29 | // Configure the HTTP request pipeline. 30 | if (app.Environment.IsDevelopment()) 31 | { 32 | app.UseSwagger(); 33 | app.UseSwaggerUI(); 34 | } 35 | 36 | app.UseRouting(); // Add the routing middleware 37 | 38 | app.UseEndpoints(endpoints => 39 | { 40 | endpoints.MapControllers(); 41 | }); 42 | 43 | app.Run(); 44 | -------------------------------------------------------------------------------- /nodejs/examples/multi-entry-esm.js: -------------------------------------------------------------------------------- 1 | export const entry1 = async (context) => { 2 | const { request } = context; 3 | const name = request.query?.name || 'World'; 4 | 5 | return { 6 | status: 200, 7 | body: JSON.stringify({ 8 | message: `Hello from Entry Point 1, ${name}! 🚀`, 9 | entryPoint: 'entry1', 10 | nodeVersion: process.version, 11 | timestamp: new Date().toISOString(), 12 | features: ['Named Exports', 'ESM Modules', 'Multiple Endpoints'] 13 | }, null, 2), 14 | headers: { 15 | 'Content-Type': 'application/json', 16 | 'X-Entry-Point': 'entry1' 17 | } 18 | }; 19 | }; 20 | 21 | export const entry2 = async (context) => { 22 | const { request } = context; 23 | const data = request.body || {}; 24 | 25 | return { 26 | status: 200, 27 | body: JSON.stringify({ 28 | message: `Greetings from Entry Point 2! 🎯`, 29 | entryPoint: 'entry2', 30 | nodeVersion: process.version, 31 | timestamp: new Date().toISOString(), 32 | receivedData: data, 33 | capabilities: ['Data Processing', 'JSON Handling', 'Modern ESM'] 34 | }, null, 2), 35 | headers: { 36 | 'Content-Type': 'application/json', 37 | 'X-Entry-Point': 'entry2' 38 | } 39 | }; 40 | }; -------------------------------------------------------------------------------- /python/examples/multifile/README.md: -------------------------------------------------------------------------------- 1 | This is an example of creating a deployment package with multiple 2 | files including some static data in text file. 3 | 4 | ### Create an environment 5 | 6 | ``` 7 | fission env create --name python --image fission/python-env:0.4.0rc --version 2 8 | ``` 9 | 10 | ### Create a zip file with all your files 11 | 12 | ``` 13 | zip -jr multifile.zip *.py *.txt 14 | ``` 15 | 16 | ### Create a function 17 | 18 | Since there are multiple files, you have to specify an _entrypoint_ to 19 | for the function. Its format is `.`. In our 20 | example, that's `main.main`, to run function `main` in `main.py`. 21 | 22 | ``` 23 | fission function create --name multifile --env python --code multifile.zip --entrypoint main.main 24 | ``` 25 | 26 | ### Test it 27 | 28 | ``` 29 | fission function test --name multifile 30 | ``` 31 | 32 | You should see the "Hello, world" message. 33 | 34 | 35 | ## Updating the function 36 | 37 | ### Edit a file 38 | 39 | ``` 40 | echo "I said hellooooo!" > message.txt 41 | ``` 42 | 43 | ### Update the deployment package 44 | 45 | ``` 46 | zip -jr multifile.zip *.py *.txt 47 | ``` 48 | 49 | ### Update the function 50 | 51 | ``` 52 | fission function update --name multifile --code multifile.zip 53 | ``` 54 | 55 | ### Test it 56 | 57 | ``` 58 | fission function test --name multifile 59 | ``` 60 | 61 | You should now see your new, edited message. 62 | 63 | -------------------------------------------------------------------------------- /python-fastapi/examples/multifile/README.md: -------------------------------------------------------------------------------- 1 | This is an example of creating a deployment package with multiple 2 | files including some static data in text file. 3 | 4 | ### Create an environment 5 | 6 | ``` 7 | fission env create --name python --image ghcr.io/fission/python-fastapi-env --version 3 8 | ``` 9 | 10 | ### Create a zip file with all your files 11 | 12 | ``` 13 | zip -jr multifile.zip *.py *.txt 14 | ``` 15 | 16 | ### Create a function 17 | 18 | Since there are multiple files, you have to specify an _entrypoint_ to 19 | for the function. Its format is `.`. In our 20 | example, that's `main.main`, to run function `main` in `main.py`. 21 | 22 | ``` 23 | fission function create --name multifile --env python --code multifile.zip --entrypoint main.main 24 | ``` 25 | 26 | ### Test it 27 | 28 | ``` 29 | fission function test --name multifile 30 | ``` 31 | 32 | You should see the "Hello, world" message. 33 | 34 | 35 | ## Updating the function 36 | 37 | ### Edit a file 38 | 39 | ``` 40 | echo "I said hellooooo!" > message.txt 41 | ``` 42 | 43 | ### Update the deployment package 44 | 45 | ``` 46 | zip -jr multifile.zip *.py *.txt 47 | ``` 48 | 49 | ### Update the function 50 | 51 | ``` 52 | fission function update --name multifile --code multifile.zip 53 | ``` 54 | 55 | ### Test it 56 | 57 | ``` 58 | fission function test --name multifile 59 | ``` 60 | 61 | You should now see your new, edited message. 62 | 63 | -------------------------------------------------------------------------------- /dotnet20/builder/Builder.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | System 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | Always 28 | 29 | 30 | Always 31 | 32 | 33 | Always 34 | 35 | 36 | Always 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /dotnet8/examples/MultiFileExample/Models/DataModels.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MultiFileExample.Models 4 | { 5 | public class DataRequest 6 | { 7 | public string Input { get; set; } 8 | public string Format { get; set; } 9 | public bool Validate { get; set; } 10 | } 11 | 12 | public class ProcessedData 13 | { 14 | public string Original { get; set; } 15 | public string Uppercase { get; set; } 16 | public string Lowercase { get; set; } 17 | public string Reversed { get; set; } 18 | public int Length { get; set; } 19 | public int WordCount { get; set; } 20 | public string Hash { get; set; } 21 | public string Base64Encoded { get; set; } 22 | } 23 | 24 | public class ProcessingStats 25 | { 26 | public int CharacterCount { get; set; } 27 | public int AlphaCount { get; set; } 28 | public int DigitCount { get; set; } 29 | public int SpaceCount { get; set; } 30 | public int SpecialCharCount { get; set; } 31 | } 32 | 33 | public class DataResponse 34 | { 35 | public bool Success { get; set; } 36 | public string Error { get; set; } 37 | public ProcessedData ProcessedData { get; set; } 38 | public ProcessingStats Statistics { get; set; } 39 | public DateTime ProcessedAt { get; set; } 40 | public string ProcessingTime { get; set; } 41 | public string Source { get; set; } 42 | } 43 | } -------------------------------------------------------------------------------- /dotnet8/Fission.DotNet.Common/FissionHttpContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using System.Text.Json; 6 | 7 | namespace Fission.DotNet.Common; 8 | 9 | public class FissionHttpContext : FissionContext 10 | { 11 | private string _method; 12 | 13 | public FissionHttpContext(Stream body, string method, Dictionary arguments, Dictionary headers, Dictionary parameters) : base(body, arguments, headers, parameters) 14 | { 15 | _method = method; 16 | } 17 | 18 | public Dictionary Headers => _headers; 19 | public string Url 20 | { 21 | get 22 | { 23 | var urlHeader = GetHeaderValue("X-Fission-Full-Url"); 24 | 25 | if (urlHeader != null) 26 | { 27 | if (urlHeader.Contains("?")) 28 | { 29 | urlHeader = urlHeader.Substring(0, urlHeader.IndexOf("?")); 30 | } 31 | 32 | return urlHeader; 33 | } 34 | else 35 | { 36 | return "/"; 37 | } 38 | } 39 | } 40 | public string Method => _method; 41 | public string Host => GetHeaderValue("X-Forwarded-Host"); 42 | public int Port => _headers.ContainsKey("X-Forwarded-Port") ? Int32.Parse(GetHeaderValue("X-Forwarded-Port")) : 0; 43 | public string UserAgent => GetHeaderValue("User-Agent"); 44 | } 45 | -------------------------------------------------------------------------------- /python/tests/local_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # TODO placeholder until we have better tests :) 4 | 5 | set -x 6 | set -e 7 | 8 | DIR=$(dirname $0) 9 | 10 | python3 -m virtualenv test_env 11 | source test_env/bin/activate 12 | 13 | pip3 install -r requirements.txt 14 | 15 | echo "-- Starting server" 16 | python3 $DIR/../server.py & 17 | 18 | SERVER_PID=$! 19 | cleanup() { 20 | echo "-- Cleanup" 21 | echo "Killing process $SERVER_PID" 22 | pkill -f '.*server.py' 23 | kill $SERVER_PID 24 | deactivate 25 | rm -r test_env 26 | ps -ef | grep python3 | grep -v grep 27 | } 28 | trap cleanup EXIT 29 | sleep 5 30 | 31 | echo "--Healthz" 32 | curl -f -X GET http://localhost:$RUNTIME_PORT/healthz 33 | 34 | echo "-- Specializing" 35 | curl -f -XPOST http://localhost:$RUNTIME_PORT/v2/specialize -H 'Content-Type: application/json' -d '{"filepath": "./examples/hello.py", "functionName": "main"}' 36 | 37 | echo "-- Running user function" 38 | echo "-- GET request" 39 | curl -f -X GET http://localhost:$RUNTIME_PORT 40 | echo "-- POST request" 41 | curl -f -X POST http://localhost:$RUNTIME_PORT 42 | echo "-- PUT request" 43 | curl -f -X PUT http://localhost:$RUNTIME_PORT 44 | echo "-- DELETE request" 45 | curl -f -X DELETE http://localhost:$RUNTIME_PORT 46 | echo "-- OPTIONS request" 47 | curl -f -X OPTIONS http://localhost:$RUNTIME_PORT 48 | echo "-- HEAD request" 49 | # -I causes curl to make a HEAD request. 50 | curl -f -I http://localhost:$RUNTIME_PORT 51 | echo "-- Done running jobs" 52 | 53 | echo "-- Background jobs" 54 | jobs -------------------------------------------------------------------------------- /python-fastapi/tests/local_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # TODO placeholder until we have better tests :) 4 | 5 | set -x 6 | set -e 7 | 8 | DIR=$(dirname $0) 9 | 10 | python3 -m virtualenv test_env 11 | source test_env/bin/activate 12 | 13 | pip3 install -r requirements.txt 14 | 15 | echo "-- Starting server" 16 | python3 $DIR/../server.py & 17 | 18 | SERVER_PID=$! 19 | cleanup() { 20 | echo "-- Cleanup" 21 | echo "Killing process $SERVER_PID" 22 | pkill -f '.*server.py' 23 | kill $SERVER_PID 24 | deactivate 25 | rm -r test_env 26 | ps -ef | grep python3 | grep -v grep 27 | } 28 | trap cleanup EXIT 29 | sleep 5 30 | 31 | echo "--Healthz" 32 | curl -f -X GET http://localhost:$RUNTIME_PORT/healthz 33 | 34 | echo "-- Specializing" 35 | curl -f -XPOST http://localhost:$RUNTIME_PORT/v2/specialize -H 'Content-Type: application/json' -d '{"filepath": "./examples/hello.py", "functionName": "main"}' 36 | 37 | echo "-- Running user function" 38 | echo "-- GET request" 39 | curl -f -X GET http://localhost:$RUNTIME_PORT 40 | echo "-- POST request" 41 | curl -f -X POST http://localhost:$RUNTIME_PORT 42 | echo "-- PUT request" 43 | curl -f -X PUT http://localhost:$RUNTIME_PORT 44 | echo "-- DELETE request" 45 | curl -f -X DELETE http://localhost:$RUNTIME_PORT 46 | echo "-- OPTIONS request" 47 | curl -f -X OPTIONS http://localhost:$RUNTIME_PORT 48 | echo "-- HEAD request" 49 | # -I causes curl to make a HEAD request. 50 | curl -f -I http://localhost:$RUNTIME_PORT 51 | echo "-- Done running jobs" 52 | 53 | echo "-- Background jobs" 54 | jobs -------------------------------------------------------------------------------- /dotnet8/builder/defaultBuildCmd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | echo "Building .NET 8 project from ${SRC_PKG} to ${DEPLOY_PKG}" 5 | 6 | # Create destination directory 7 | mkdir -p ${DEPLOY_PKG} 8 | 9 | # Copy all source files to destination 10 | cp -r ${SRC_PKG}/* ${DEPLOY_PKG}/ 11 | 12 | # Copy Fission.DotNet.Common library 13 | cp /app/Fission.DotNet.Common.dll ${DEPLOY_PKG}/ 14 | cp /app/Fission.DotNet.Common.deps.json ${DEPLOY_PKG}/ 2>/dev/null || true 15 | 16 | # Find project file 17 | CSPROJ_FILE=$(find ${DEPLOY_PKG} -name "*.csproj" | head -1) 18 | 19 | if [ -n "$CSPROJ_FILE" ]; then 20 | echo "Found project file: $CSPROJ_FILE" 21 | PROJECT_DIR=$(dirname "$CSPROJ_FILE") 22 | 23 | # Ensure Fission.DotNet.Common.dll is in the project directory 24 | cp /app/Fission.DotNet.Common.dll ${PROJECT_DIR}/ 25 | 26 | cd ${PROJECT_DIR} 27 | 28 | # First restore packages 29 | dotnet restore 30 | 31 | # Then publish with restore (removing --no-restore flag) 32 | dotnet publish -c Release -o ${DEPLOY_PKG} 33 | else 34 | echo "No project file found, treating as single file deployment" 35 | # For single .cs files, they will be compiled at runtime 36 | fi 37 | 38 | echo "Build completed successfully" 39 | 40 | # Ensure Fission.DotNet.Common.dll is in the output directory 41 | cp /app/Fission.DotNet.Common.dll ${DEPLOY_PKG}/ 42 | 43 | # List the build output 44 | echo "Build output:" 45 | ls -la ${DEPLOY_PKG}/Fission.DotNet.Common.dll ${DEPLOY_PKG}/*.dll 2>/dev/null || true 46 | 47 | echo "Build complete" -------------------------------------------------------------------------------- /jvm/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Fission builder base image 2 | ARG BUILDER_IMAGE=fission/builder:latest 3 | FROM ${BUILDER_IMAGE} AS builder 4 | 5 | ## Use eclipse-temurin:22-jdk-alpine - (https://github.com/adoptium/containers/blob/07677395574f5d3462c3b6fdf5f6c4a0a350b683/22/jdk/alpine/Dockerfile) 6 | 7 | FROM eclipse-temurin:22-jdk-alpine 8 | 9 | ## Section copied from the Maven Dockerfile 10 | 11 | RUN apk add --no-cache bash procps curl tar openssh-client 12 | 13 | LABEL org.opencontainers.image.title="Apache Maven" 14 | LABEL org.opencontainers.image.source=https://github.com/carlossg/docker-maven 15 | LABEL org.opencontainers.image.url=https://github.com/carlossg/docker-maven 16 | LABEL org.opencontainers.image.description="Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information." 17 | 18 | ENV MAVEN_HOME=/usr/share/maven 19 | 20 | COPY --from=maven:3.9.9-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME} 21 | COPY --from=maven:3.9.9-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh 22 | COPY --from=maven:3.9.9-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml 23 | 24 | RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn 25 | 26 | ARG MAVEN_VERSION=3.9.9 27 | ARG USER_HOME_DIR="/root" 28 | ENV MAVEN_CONFIG="$USER_HOME_DIR/.m2" 29 | 30 | ## Fission builder specific section 31 | COPY --from=builder /builder /builder 32 | ADD build.sh /usr/local/bin/build 33 | EXPOSE 8001 34 | -------------------------------------------------------------------------------- /jvm-jersey/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Fission builder base image 2 | ARG BUILDER_IMAGE=fission/builder 3 | FROM ${BUILDER_IMAGE} AS builder 4 | 5 | ## From the eclipse-temurin:22-jdk-alpine - (https://github.com/adoptium/containers/blob/07677395574f5d3462c3b6fdf5f6c4a0a350b683/22/jdk/alpine/Dockerfile) 6 | 7 | FROM eclipse-temurin:22-jdk-alpine 8 | 9 | ## Section copied from the Maven Dockerfile 10 | 11 | RUN apk add --no-cache bash procps curl tar openssh-client 12 | 13 | LABEL org.opencontainers.image.title="Apache Maven" 14 | LABEL org.opencontainers.image.source=https://github.com/carlossg/docker-maven 15 | LABEL org.opencontainers.image.url=https://github.com/carlossg/docker-maven 16 | LABEL org.opencontainers.image.description="Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information." 17 | 18 | ENV MAVEN_HOME=/usr/share/maven 19 | 20 | COPY --from=maven:3.9.9-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME} 21 | COPY --from=maven:3.9.9-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh 22 | COPY --from=maven:3.9.9-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml 23 | 24 | RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn 25 | 26 | ARG MAVEN_VERSION=3.9.9 27 | ARG USER_HOME_DIR="/root" 28 | ENV MAVEN_CONFIG="$USER_HOME_DIR/.m2" 29 | 30 | ## Fission builder specific section 31 | COPY --from=builder /builder /builder 32 | ADD build.sh /usr/local/bin/build 33 | EXPOSE 8001 34 | -------------------------------------------------------------------------------- /php7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.3-alpine 2 | 3 | ENV PATH="/root/.composer/vendor/bin:${PATH}" \ 4 | COMPOSER_ALLOW_SUPERUSER=1 5 | 6 | RUN echo 'http://dl-4.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ 7 | && apk --no-cache add \ 8 | git \ 9 | curl \ 10 | curl-dev \ 11 | libcurl \ 12 | zlib-dev \ 13 | freetype-dev \ 14 | jpeg-dev \ 15 | libjpeg-turbo-dev \ 16 | postgresql-dev \ 17 | libmcrypt-dev \ 18 | libpng-dev \ 19 | icu-dev \ 20 | gettext-dev \ 21 | vim \ 22 | libxml2-dev \ 23 | freetype-dev \ 24 | libzip-dev \ 25 | unzip \ 26 | libc6-compat \ 27 | openssl \ 28 | gcc \ 29 | autoconf \ 30 | make \ 31 | libc-dev 32 | 33 | RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 34 | 35 | # Install useful extensions 36 | RUN docker-php-ext-install \ 37 | opcache \ 38 | bcmath \ 39 | ctype \ 40 | curl \ 41 | dom \ 42 | iconv \ 43 | fileinfo \ 44 | gd \ 45 | gettext \ 46 | intl \ 47 | json \ 48 | mysqli \ 49 | pgsql \ 50 | pcntl \ 51 | pdo \ 52 | ftp \ 53 | pdo_mysql \ 54 | pdo_pgsql \ 55 | phar \ 56 | simplexml \ 57 | xmlrpc \ 58 | zip 59 | 60 | RUN pecl install \ 61 | mcrypt-1.0.2 62 | RUN docker-php-ext-enable \ 63 | mcrypt 64 | 65 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 66 | 67 | COPY . /app 68 | WORKDIR /app 69 | 70 | RUN composer install 71 | 72 | EXPOSE 8888 73 | 74 | ENTRYPOINT ["php"] 75 | CMD ["server.php"] 76 | -------------------------------------------------------------------------------- /jvm/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.fission 8 | env-java 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 3.3.2 15 | 16 | 17 | 18 | 19 | org.springframework.boot 20 | spring-boot-starter-web 21 | 22 | 23 | io.fission 24 | fission-java-core 25 | 0.0.2-SNAPSHOT 26 | 27 | 28 | com.fasterxml.jackson.dataformat 29 | jackson-dataformat-xml 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-maven-plugin 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | fission-java-core 46 | fission-java-core-snapshot 47 | https://oss.sonatype.org/content/repositories/snapshots/ 48 | 49 | 50 | -------------------------------------------------------------------------------- /go/envconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "builder": "go-builder", 4 | "examples": "https://github.com/fission/environments/tree/master/go/examples", 5 | "icon": "./logo/go-logo-blue.svg", 6 | "image": "go-env", 7 | "kind": "environment", 8 | "maintainers": [ 9 | { 10 | "link": "https://github.com/sanketsudake", 11 | "name": "sanketsudake" 12 | }, 13 | { 14 | "link": "https://github.com/vishal-biyani", 15 | "name": "vishal-biyani" 16 | } 17 | ], 18 | "name": "Go Environment", 19 | "readme": "https://github.com/fission/environments/tree/master/go", 20 | "runtimeVersion": "1.22", 21 | "shortDescription": "Fission Go 1.22 environment, which uses dynamic loader based on Go plugins.", 22 | "status": "Stable", 23 | "version": "1.32.3" 24 | }, 25 | { 26 | "builder": "go-builder-1.23", 27 | "examples": "https://github.com/fission/environments/tree/master/go/examples", 28 | "icon": "./logo/go-logo-blue.svg", 29 | "image": "go-env-1.23", 30 | "kind": "environment", 31 | "maintainers": [ 32 | { 33 | "link": "https://github.com/sanketsudake", 34 | "name": "sanketsudake" 35 | }, 36 | { 37 | "link": "https://github.com/vishal-biyani", 38 | "name": "vishal-biyani" 39 | } 40 | ], 41 | "name": "Go Environment", 42 | "readme": "https://github.com/fission/environments/tree/master/go", 43 | "runtimeVersion": "1.23", 44 | "shortDescription": "Fission Go 1.23 environment, which uses dynamic loader based on Go plugins.", 45 | "status": "Stable", 46 | "version": "1.32.3" 47 | } 48 | ] -------------------------------------------------------------------------------- /php7/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILDER_IMAGE=fission/builder:latest 2 | FROM ${BUILDER_IMAGE} 3 | 4 | FROM php:7.3-alpine 5 | 6 | ENV PATH="/root/.composer/vendor/bin:${PATH}" \ 7 | COMPOSER_ALLOW_SUPERUSER=1 8 | 9 | RUN echo 'http://dl-4.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \ 10 | && apk --no-cache add \ 11 | git \ 12 | curl \ 13 | curl-dev \ 14 | libcurl \ 15 | zlib-dev \ 16 | freetype-dev \ 17 | jpeg-dev \ 18 | libjpeg-turbo-dev \ 19 | postgresql-dev \ 20 | libmcrypt-dev \ 21 | libpng-dev \ 22 | icu-dev \ 23 | gettext-dev \ 24 | vim \ 25 | libxml2-dev \ 26 | freetype-dev \ 27 | libzip-dev \ 28 | unzip \ 29 | libc6-compat \ 30 | openssl \ 31 | gcc \ 32 | autoconf \ 33 | make \ 34 | libc-dev 35 | 36 | RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 37 | 38 | # Install useful extensions 39 | RUN docker-php-ext-install \ 40 | opcache \ 41 | bcmath \ 42 | ctype \ 43 | curl \ 44 | dom \ 45 | iconv \ 46 | fileinfo \ 47 | gd \ 48 | gettext \ 49 | intl \ 50 | json \ 51 | mysqli \ 52 | pgsql \ 53 | pcntl \ 54 | pdo \ 55 | ftp \ 56 | pdo_mysql \ 57 | pdo_pgsql \ 58 | phar \ 59 | simplexml \ 60 | xmlrpc \ 61 | zip 62 | 63 | RUN pecl install \ 64 | mcrypt-1.0.2 65 | RUN docker-php-ext-enable \ 66 | mcrypt 67 | 68 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 69 | 70 | COPY --from=0 /builder /builder 71 | COPY defaultBuildCmd /usr/local/bin/build 72 | -------------------------------------------------------------------------------- /.github/actions/setup-cluster/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup Fission Environment' 2 | description: 'Sets up Helm, Kind cluster, Fission CLI, and completes base Fission setup' 3 | inputs: 4 | kind-node-image: 5 | description: 'Kind node image to use' 6 | required: false 7 | default: 'kindest/node:v1.27.16' 8 | kind-version: 9 | description: 'Kind version to use' 10 | required: false 11 | default: 'v0.23.0' 12 | helm-version: 13 | description: 'Helm version to use' 14 | required: false 15 | default: 'v3.18.4' 16 | kind-config: 17 | description: 'Kind config file' 18 | required: false 19 | default: 'kind.yaml' 20 | fission-cli-version: 21 | description: 'Fission CLI version to install' 22 | required: false 23 | default: 'v1.21.0' 24 | runs: 25 | using: "composite" 26 | steps: 27 | - name: Helm 28 | uses: Azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 29 | with: 30 | version: ${{ inputs.helm-version }} 31 | 32 | - name: Kind Cluster 33 | uses: engineerd/setup-kind@v0.5.0 34 | with: 35 | image: ${{ inputs.kind-node-image }} 36 | version: ${{ inputs.kind-version }} 37 | config: ${{ inputs.kind-config }} 38 | 39 | - name: Configuring and testing the Installation 40 | shell: bash 41 | run: | 42 | kubectl cluster-info --context kind-kind 43 | kind get kubeconfig >$HOME/.kube/config 44 | kubectl get nodes 45 | 46 | # Base Setup Steps (merged from fission-base-setup) 47 | - name: Base Setup 48 | shell: bash 49 | run: | 50 | make verify-kind-cluster 51 | make install-fission-cli 52 | make install-skaffold 53 | make create-crds 54 | -------------------------------------------------------------------------------- /go/builder/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eux 4 | 5 | srcDir=${GOPATH}/src/$(basename ${SRC_PKG}) 6 | 7 | trap "rm -rf ${srcDir}" EXIT 8 | 9 | # http://ask.xmodulo.com/compare-two-version-numbers.html 10 | version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } 11 | 12 | if [ -d ${SRC_PKG} ]; then 13 | echo "Building in directory ${srcDir}" 14 | ln -sf ${SRC_PKG} ${srcDir} 15 | elif [ -f ${SRC_PKG} ]; then 16 | echo "Building file ${SRC_PKG} in ${srcDir}" 17 | mkdir -p ${srcDir} 18 | cp ${SRC_PKG} ${srcDir}/function.go 19 | fi 20 | 21 | cd ${srcDir} 22 | 23 | if [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then 24 | if [ -f "go.mod" ]; then 25 | go mod download 26 | else 27 | # Since we're in GOPATH, we need to enable this 28 | export GO111MODULE="on" 29 | # still need to do this; otherwise, go will complain "cannot find main module". 30 | go mod init 31 | go mod tidy 32 | fi 33 | else # go version lower than go 1.12 34 | if [ -f "go.mod" ]; then 35 | echo "Please update fission/go-builder and fission/go-env image to the latest version to support go module" 36 | exit 1 37 | fi 38 | fi 39 | 40 | GOFLAGS="-buildmode=plugin" 41 | 42 | # use vendor mode if the vendor dir exists when go version is greater 43 | # than 1.12 (the version that fission started to support go module). 44 | if [ -d "vendor" ] && [ ! -z ${GOLANG_VERSION} ] && version_ge ${GOLANG_VERSION} "1.12"; then 45 | GOFLAGS="${GOFLAGS} -mod=vendor" 46 | fi 47 | 48 | # -i is deprecated in go 1.15+ 49 | if ! version_ge ${GOLANG_VERSION} "1.15"; then 50 | GOFLAGS="${GOFLAGS} -i" 51 | fi 52 | 53 | go build ${GOFLAGS} -o ${DEPLOY_PKG} . -------------------------------------------------------------------------------- /php7/README.md: -------------------------------------------------------------------------------- 1 | # Fission: PHP Environment 2 | 3 | This is the PHP environment for Fission. 4 | 5 | It's a Docker image containing a PHP 7.3 runtime. This image use php:7.3-cli base image with the built-in PHP server 6 | 7 | This environment does not force you to use a specific class or create a main function. 8 | 9 | A few common extensions are included : 10 | - curl 11 | - gd 12 | - json 13 | - mcrypt 14 | - PDO (pdo_mysql, pdo_pgsql, pdo_sqlite) 15 | - OPcache 16 | - ftp 17 | - iconv 18 | - phar 19 | - mysqli 20 | - pgsql 21 | - SimpleXML 22 | - xmlrpc 23 | - zip 24 | 25 | Looking for ready-to-run examples? See the [PHP examples directory](../../examples/php). 26 | 27 | ## Customizing this image 28 | 29 | To add other extensions or packages(composer.json) you need to edit the Dockerfile and rebuild this image (instructions below). 30 | 31 | ## Rebuilding and pushing the image 32 | 33 | You'll need access to a Docker registry to push the image: you can 34 | sign up for Docker hub at hub.docker.com, or use registries from 35 | gcr.io, quay.io, etc. Let's assume you're using a docker hub account 36 | called USER. Build and push the image to the the registry: 37 | 38 | ``` 39 | docker build -t USER/php7-env . && docker push USER/php7-env 40 | ``` 41 | 42 | ## Using the image in fission 43 | 44 | You can add this customized image to fission with "fission env 45 | create": 46 | 47 | ``` 48 | fission env create --name php7 --image USER/php7-env 49 | ``` 50 | 51 | Or, if you already have an environment, you can update its image: 52 | 53 | ``` 54 | fission env update --name php7 --image USER/php7-env 55 | ``` 56 | 57 | After this, fission functions that have the env parmeter set to the 58 | same environment name as this command will use this environment. 59 | -------------------------------------------------------------------------------- /php7/examples/multifile/README.md: -------------------------------------------------------------------------------- 1 | This is an example of creating a deployment package with multiple 2 | files including external libraries via composer. 3 | 4 | ### Create an environment 5 | 6 | ``` 7 | fission env create --name php --image fission/php-env:latest --builder fission/php-builder:latest --version 2 8 | ``` 9 | 10 | ### Create a zip file with all your files 11 | 12 | ``` 13 | zip -r multifile.zip . -i *.php *.txt composer.json 14 | ``` 15 | 16 | ### Create a package 17 | ``` 18 | fission package create --sourcearchive multifile.zip --env php 19 | ``` 20 | This command will print the created package. We will use it in the next step. 21 | 22 | 23 | ### Create a function 24 | 25 | Since there are multiple files, you have to specify an _entrypoint_ to 26 | for the function. Its format is `::`. In our 27 | example, that's `handlers/FileReader.php::execute`, to run function `execute` in `handlers/FileReader.php`. 28 | 29 | ``` 30 | fission function create --name multifile --env php --pkg --entrypoint "handlers/FileReader.php::execute" 31 | ``` 32 | 33 | ### Test it 34 | 35 | ``` 36 | fission function test --name multifile 37 | ``` 38 | 39 | You should see the "Hello, world" message. 40 | 41 | 42 | ## Updating the function 43 | 44 | ### Edit a file 45 | 46 | ``` 47 | echo "I said hellooooo!" > message.txt 48 | ``` 49 | 50 | ### Update the deployment package 51 | 52 | ``` 53 | zip -r multifile.zip . -i *.php *.txt composer.json 54 | ``` 55 | 56 | ### Update the package 57 | 58 | ``` 59 | fission package update --name --sourcearchive multifile.zip --env php 60 | ``` 61 | 62 | ### Test it 63 | 64 | ``` 65 | fission function test --name multifile 66 | ``` 67 | 68 | You should now see your new, edited message. 69 | 70 | -------------------------------------------------------------------------------- /.github/workflows/README.md: -------------------------------------------------------------------------------- 1 | # GitHub Actions Workflow for Fission Environments 2 | 3 | This directory contains the GitHub Actions workflow configuration for building and testing Fission environments. 4 | 5 | ## Structure 6 | 7 | - `environment.yaml`: Main workflow file that defines jobs for all environments 8 | - `actions/`: Directory containing reusable composite actions 9 | - `setup-cluster/`: Sets up Helm, Kind cluster, Fission CLI and runs the base Fission setup 10 | - `collect-fission-dump/`: Collects and archives Fission dumps 11 | - `filters/`: Contains path filters for detecting changes 12 | 13 | ## Composite Actions 14 | 15 | The workflow uses two main composite actions to reduce duplication: 16 | 17 | 1. **setup-cluster**: Sets up the complete infrastructure needed for testing (Helm, Kind, Fission CLI) and performs base Fission setup steps 18 | 2. **collect-fission-dump**: Collects and archives Fission dumps on failure 19 | 20 | ## Environment Variables 21 | 22 | All version pins are centralized in the `env` section of the main workflow file: 23 | 24 | - `KIND_NODE_IMAGE`: Kind node image version 25 | - `KIND_VERSION`: Kind tool version 26 | - `HELM_VERSION`: Helm version 27 | - `FISSION_CLI_VERSION`: Fission CLI version 28 | - `KIND_CONFIG`: Path to Kind configuration 29 | - `FISSION_VERSION`: Fission version 30 | 31 | ## Usage 32 | 33 | The workflow is triggered on pull requests to the `master` branch. It first runs a change detection job to determine which environments have been modified, then runs the relevant jobs for those environments. 34 | 35 | ### Adding a New Environment 36 | 37 | To add a new environment: 38 | 39 | 1. Add the environment to the `check` job's outputs 40 | 2. Create a new job for the environment following the existing patterns 41 | 3. Add the environment to the filters configuration 42 | -------------------------------------------------------------------------------- /jvm-jersey/src/main/java/io/fission/Main.java: -------------------------------------------------------------------------------- 1 | package io.fission; 2 | 3 | import org.eclipse.jetty.server.Server; 4 | import org.eclipse.jetty.servlet.ServletContextHandler; 5 | import org.eclipse.jetty.servlet.ServletHolder; 6 | import org.glassfish.jersey.jackson.JacksonFeature; 7 | import org.glassfish.jersey.server.ResourceConfig; 8 | import org.glassfish.jersey.servlet.ServletContainer; 9 | 10 | public class Main { 11 | 12 | private static final int DEFAULT_PORT = 8888; 13 | 14 | private final int serverPort; 15 | 16 | public Main(int serverPort) throws Exception { 17 | this.serverPort = serverPort; 18 | Server server = configureServer(); 19 | server.start(); 20 | server.join(); 21 | } 22 | 23 | private Server configureServer() { 24 | ResourceConfig resourceConfig = new ResourceConfig(); 25 | resourceConfig.packages(JerseyServer.class.getPackage().getName()); 26 | resourceConfig.register(JacksonFeature.class); 27 | ServletContainer servletContainer = new ServletContainer(resourceConfig); 28 | ServletHolder sh = new ServletHolder(servletContainer); 29 | Server server = new Server(serverPort); 30 | ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); 31 | context.setContextPath("/"); 32 | context.addServlet(sh, "/*"); 33 | server.setHandler(context); 34 | return server; 35 | } 36 | 37 | public static void main(String[] args) throws Exception { 38 | 39 | int serverPort = DEFAULT_PORT; 40 | 41 | if(args.length >= 1) { 42 | try { 43 | serverPort = Integer.parseInt(args[0]); 44 | } catch (NumberFormatException e) { 45 | e.printStackTrace(System.err); 46 | } 47 | } 48 | try { 49 | Main _ = new Main(serverPort); 50 | } catch (Exception e) { 51 | e.printStackTrace(System.err); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /php7/examples/stock.php: -------------------------------------------------------------------------------- 1 | withStatus(500); 8 | $response->getBody()->write($message); 9 | return $response; 10 | } 11 | 12 | function handler($context){ 13 | /** @var ResponseInterface $response */ 14 | $response = $context["response"]; 15 | /** @var ServerRequestInterface $request */ 16 | $request = $context["request"]; 17 | /** @var LoggerInterface $logger */ 18 | $logger = $context["logger"]; 19 | 20 | $logger->debug("Request : ",$request->getParsedBody()); 21 | if($request->getMethod() != "POST") 22 | return sendError($response,"You must use POST method"); 23 | 24 | $body = $request->getParsedBody(); 25 | if(!isset($body["currency"])) 26 | return sendError($response,"'currency' is not present in the POST request"); 27 | 28 | $allowedCurrency = ["ltc","btc"]; 29 | if(!in_array($body["currency"],$allowedCurrency)) 30 | return sendError($response,"'currency' is non allowed. Use one of them : ".implode(",",$allowedCurrency)); 31 | 32 | $curl = curl_init(); 33 | curl_setopt_array($curl, array( 34 | CURLOPT_RETURNTRANSFER => 1, 35 | CURLOPT_URL => 'https://api.cryptonator.com/api/ticker/'.$body["currency"].'-usd' 36 | )); 37 | $result = curl_exec($curl); 38 | curl_close($curl); 39 | 40 | $result = json_decode($result,true); 41 | if($result){ 42 | $logger->debug("Response API",$result); 43 | $response->getBody()->write(json_encode(array("text"=>sprintf("%s-USB = %02f",$body["currency"],$result["ticker"]["price"])))); 44 | }else 45 | return sendError($response,"Cryptonator API not available"); 46 | 47 | } 48 | --------------------------------------------------------------------------------