Compare commits

..

543 Commits

Author SHA1 Message Date
dependabot[bot]
c6a83484e1 Bump github.com/stretchr/testify from 1.6.1 to 1.8.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 21:07:09 +00:00
Abirdcfly
cc8c68e5fd delete minor unreachable code caused by log.Fatal (#664)
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-10 14:55:52 +08:00
dependabot[bot]
0d278f83ab Bump github.com/cheggaaa/pb/v3 from 3.0.5 to 3.1.0 (#662)
Bumps [github.com/cheggaaa/pb/v3](https://github.com/cheggaaa/pb) from 3.0.5 to 3.1.0.
- [Release notes](https://github.com/cheggaaa/pb/releases)
- [Commits](https://github.com/cheggaaa/pb/compare/v3.0.5...v3.1.0)

---
updated-dependencies:
- dependency-name: github.com/cheggaaa/pb/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-13 12:17:50 +08:00
Ahsan Nabi Dar
d91a7a09e3 Update README.md (#619)
fix file name in example
2021-06-10 18:43:14 +08:00
Minghe
bdece853f2 adopt new syntax (#616) 2021-06-09 09:53:21 +08:00
Minghe
416024b32e down grade the golang version to 1.15 (#615) 2021-06-08 23:47:52 +08:00
Minghe
525e19b4ac fix(Dockerfile):pack the static file into binary (#614)
* fix(Dockerfile): update the static file via go get -u github.com/gobuffalo/packr/v2/...
go get -u github.com/gobuffalo/packr/v2/packr2
packr2

* disable lint since it's out date

* bump version
2021-06-08 17:54:19 +08:00
dependabot[bot]
258f7bc2e0 Bump github.com/google/uuid from 1.1.4 to 1.2.0 (#596)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.4 to 1.2.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.1.4...v1.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 17:06:28 +08:00
dependabot-preview[bot]
a861685d19 Bump github.com/google/uuid from 1.1.3 to 1.1.4 (#589)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.3 to 1.1.4.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.1.3...v1.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-01-07 13:32:33 +08:00
dependabot-preview[bot]
01059aa9d1 Create Dependabot config file (#590)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-01-07 13:32:14 +08:00
dependabot-preview[bot]
5ec875215b Bump github.com/golang/protobuf from 1.3.3 to 1.4.3 (#574)
Bumps [github.com/golang/protobuf](https://github.com/golang/protobuf) from 1.3.3 to 1.4.3.
- [Release notes](https://github.com/golang/protobuf/releases)
- [Commits](https://github.com/golang/protobuf/compare/v1.3.3...v1.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2021-01-04 11:05:31 +08:00
dependabot-preview[bot]
c8507558d6 Bump github.com/urfave/cli from 1.22.4 to 1.22.5 (#578)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.4 to 1.22.5.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.4...v1.22.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2021-01-04 10:52:20 +08:00
dependabot-preview[bot]
4e3649cb93 Bump github.com/google/uuid from 1.1.2 to 1.1.3 (#587)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.1.2...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2021-01-04 10:42:13 +08:00
dependabot-preview[bot]
5f554b4b96 Bump github.com/otiai10/copy from 1.3.0 to 1.4.2 (#588)
Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.3.0 to 1.4.2.
- [Release notes](https://github.com/otiai10/copy/releases)
- [Commits](https://github.com/otiai10/copy/compare/v1.3.0...v1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-01-04 10:24:31 +08:00
dependabot-preview[bot]
7924f64eed Bump github.com/gobuffalo/packr/v2 from 2.8.0 to 2.8.1 (#580)
Bumps [github.com/gobuffalo/packr/v2](https://github.com/gobuffalo/packr) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/gobuffalo/packr/releases)
- [Changelog](https://github.com/gobuffalo/packr/blob/master/.goreleaser.yml)
- [Commits](https://github.com/gobuffalo/packr/compare/v2.8.0...v2.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-17 10:07:16 +08:00
dependabot-preview[bot]
1379ceb74c Bump google.golang.org/grpc from 1.32.0 to 1.34.0 (#581)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.32.0 to 1.34.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.32.0...v1.34.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-12-16 18:10:56 +08:00
dependabot-preview[bot]
0527e0f301 Bump github.com/otiai10/copy from 1.2.0 to 1.3.0 (#584)
Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/otiai10/copy/releases)
- [Commits](https://github.com/otiai10/copy/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-12-16 17:55:47 +08:00
kuaima
299e41da36 Update README.md (#582) 2020-12-11 19:55:31 +08:00
Minghe Huang
1af66e72c2 bump version 2020-11-02 13:34:37 +08:00
dependabot[bot]
5ee7dbe48d Bump node-fetch from 2.6.0 to 2.6.1 in /assets/dockerfiles/base/node (#569)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-10-15 13:52:12 +08:00
dependabot-preview[bot]
0ce73aea36 Bump google.golang.org/grpc from 1.21.0 to 1.32.0 (#573)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.21.0 to 1.32.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.21.0...v1.32.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-15 13:51:36 +08:00
dependabot-preview[bot]
13d22c7885 Bump github.com/google/uuid from 1.1.1 to 1.1.2 (#568)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.1.1...v1.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-10-13 17:34:34 +08:00
Minghe
9582c06a08 support php (#571)
* support php

* generate packr files
2020-10-13 17:11:20 +08:00
Minghe Huang
9e7de8be7a bump version 2020-08-31 11:37:17 +08:00
mvrilo
b668d7c397 feature: add support for Crystal programming language (#566) 2020-08-31 11:28:50 +08:00
dependabot-preview[bot]
6bcc471f4d Bump github.com/apex/log from 1.6.0 to 1.8.0 (#563)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.6.0 to 1.8.0.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.6.0...v1.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-07 14:43:04 +08:00
dependabot-preview[bot]
1e908e1cc1 Bump github.com/golang/mock from 1.4.3 to 1.4.4 (#561)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.3 to 1.4.4.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.3...v1.4.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-08-07 09:57:03 +08:00
dependabot-preview[bot]
aa6b2511ab Bump github.com/cheggaaa/pb/v3 from 3.0.4 to 3.0.5 (#564)
Bumps [github.com/cheggaaa/pb/v3](https://github.com/cheggaaa/pb) from 3.0.4 to 3.0.5.
- [Release notes](https://github.com/cheggaaa/pb/releases)
- [Commits](https://github.com/cheggaaa/pb/compare/v3.0.4...v3.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-08-07 08:38:51 +08:00
dependabot-preview[bot]
2123a0fec4 Bump github.com/apex/log from 1.3.0 to 1.6.0 (#558)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.3.0 to 1.6.0.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.3.0...v1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-14 08:33:11 +08:00
Minghe
9e9cdeb3ee enable timestamp on image (#556)
* enable timestamp on image

* fix name issue
2020-07-09 21:25:55 +08:00
Minghe Huang
c17434703e disable k8s relate unit test for now 2020-06-28 00:48:19 +08:00
Minghe Huang
0644eb285a disable k8s relate unit test for now 2020-06-28 00:38:34 +08:00
Minghe
0f4120c2c8 fix wrong way to take user and host from env (#552) 2020-06-28 00:27:54 +08:00
FrontMage
ba43561f40 Rust multistage build (#550)
* fix get request not accepted

* use mutli-stage docker build to minimize final image

Co-authored-by: Minghe <h.minghe@gmail.com>
2020-06-17 14:16:31 +08:00
Minghe Huang
046226b580 add vistors 2020-06-13 13:10:32 +08:00
dependabot-preview[bot]
cd391e63c1 Bump github.com/stretchr/testify from 1.6.0 to 1.6.1 (#546)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.0...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-06 21:14:10 +08:00
FrontMage
ed5fc4adaf fix get request not accepted (#547) 2020-06-06 21:13:48 +08:00
Viktor Barzin
eb5a1d4fc5 Fix typo (#545) 2020-06-01 17:58:04 -07:00
Viktor Barzin
4cd8bde604 Fix typo (#544) 2020-06-01 17:57:22 -07:00
dependabot-preview[bot]
c73aedb68d Bump github.com/stretchr/testify from 1.5.1 to 1.6.0 (#543)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.5.1...v1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-01 10:58:21 +08:00
dependabot-preview[bot]
e9ee8ec1f5 Bump github.com/apex/log from 1.1.4 to 1.3.0 (#541)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.1.4 to 1.3.0.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.1.4...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-27 16:24:58 +08:00
Minghe
fd6b1947a5 adopt the swagger-stats as API operation metrics collection tool. (#537)
* adopt the swagger-stats as API operation metrics collection tool.

FYI: https://github.com/slanatech/swagger-stats

* no need change

* naming

* fix test

* move deps to base

* bump version

* update
2020-05-27 16:24:42 +08:00
dependabot-preview[bot]
aeb373190a Bump github.com/otiai10/copy from 1.1.1 to 1.2.0 (#540)
Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/otiai10/copy/releases)
- [Commits](https://github.com/otiai10/copy/compare/v1.1.1...v1.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-26 11:42:42 +08:00
Minghe
a74b086219 when destroy container, should remove it also (#530) 2020-05-16 20:01:19 +08:00
Minghe
6214581ca8 Expose logs when container started but exited with errors (#527)
* expose the error message of start failure
* disable container auto-remove, only remove it when it fails to start
* call /containers/id/logs endpoint to get the logs
2020-05-16 18:11:02 +08:00
Minghe Huang
63bc06a993 add task name
replace spinner
2020-05-07 20:01:28 +08:00
Minghe Huang
833b7d06a3 bump version 2020-05-07 18:23:02 +08:00
dependabot-preview[bot]
1ae68f1076 Bump github.com/briandowns/spinner from 1.10.0 to 1.11.1 (#521)
Bumps [github.com/briandowns/spinner](https://github.com/briandowns/spinner) from 1.10.0 to 1.11.1.
- [Release notes](https://github.com/briandowns/spinner/releases)
- [Commits](https://github.com/briandowns/spinner/compare/v1.10.0...v1.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-05-07 16:53:04 +08:00
Minghe
5ce61ef200 Fix the wrong arch of target host (#524)
* Fix the wrong arch of target host,
* get the OS arch with `uname -a`
* refactor the SSHConnectionTimeout constant
* only provision on remote host
2020-05-07 16:52:45 +08:00
dependabot-preview[bot]
3923c3451f Bump github.com/gin-gonic/gin from 1.6.2 to 1.6.3 (#522)
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.6.2 to 1.6.3.
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gin-gonic/gin/compare/v1.6.2...v1.6.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 10:02:49 +08:00
Massimiliano Mirra
8741db25b6 use lighter-weight node image (#518) 2020-04-28 10:55:13 +08:00
Minghe
16d20b23a7 fix gosec issue (#519) 2020-04-28 10:43:04 +08:00
dependabot-preview[bot]
5028ba7694 Bump github.com/urfave/cli from 1.22.3 to 1.22.4 (#504)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.3 to 1.22.4.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.3...v1.22.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-04-23 12:10:59 +08:00
dependabot-preview[bot]
a324fab432 Bump github.com/apex/log from 1.1.2 to 1.1.4 (#516)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.1.2 to 1.1.4.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.1.2...v1.1.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-23 11:55:45 +08:00
Minghe Huang
275ec78ad0 disable rust 2020-04-10 19:34:24 +08:00
Minghe
2455eb215e commit packrd file (#513) 2020-04-10 19:10:47 +08:00
Minghe
3b3503de1e add missing (#511) 2020-04-10 18:29:47 +08:00
Minghe
7135633b60 should come back (#509) 2020-04-10 17:32:55 +08:00
Minghe
b69cf16250 should not exit with 0 when panic happens (#507) 2020-04-10 17:10:03 +08:00
dependabot-preview[bot]
4527da6251 Bump github.com/spf13/viper from 1.6.2 to 1.6.3 (#506)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.6.2 to 1.6.3.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.6.2...v1.6.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-10 09:38:35 +08:00
dependabot-preview[bot]
2a17ea6131 Bump github.com/gin-gonic/gin from 1.4.0 to 1.6.2 (#503)
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.4.0 to 1.6.2.
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gin-gonic/gin/compare/v1.4.0...v1.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-28 12:03:06 +08:00
dependabot-preview[bot]
5adca0dd2f Bump github.com/briandowns/spinner from 1.9.0 to 1.10.0 (#501)
Bumps [github.com/briandowns/spinner](https://github.com/briandowns/spinner) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/briandowns/spinner/releases)
- [Commits](https://github.com/briandowns/spinner/compare/v1.9.0...v1.10.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-26 10:16:58 +08:00
Minghe
521a9e64a2 update docs (#498) 2020-03-20 18:54:30 +08:00
Minghe Huang
bfe8dc4249 bump version 2020-03-19 22:15:06 +08:00
Minghe
b569820d3e Provisioners (#495)
* seperate privisioners by platforms
* refactor provisioner
* fix image build
2020-03-19 21:53:31 +08:00
dependabot-preview[bot]
99b3696b29 Bump github.com/golang/mock from 1.4.2 to 1.4.3 (#486)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.2...v1.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-19 17:51:22 +08:00
Minghe
779679a809 Remove 'fx call' and 'fx doctor' 2020-03-19 16:54:45 +08:00
Minghe
ec49f75717 update readme (#491) 2020-03-19 13:37:39 +08:00
Minghe
23598ce1c6 update docs (#490) 2020-03-19 13:30:28 +08:00
Minghe
2831949814 Refactor driver and privioner (#489) 2020-03-19 11:28:52 +08:00
Minghe
e712e3d0e2 Simplify fx infra (#485)
* add --host and --kubeconf to `fx up`
* remove `fx infra list` and `fx infra use`
* put assets into skip dir for golangci

* fix lint issue

* upgrade go-ssh-client to consume the 'Connectable' API, enable more
friendly SSH connection error message

* parse 'host' and 'kubeconf' for `fx list` and `fx down` also

* refactor parse

* clean infra stuff
2020-03-18 09:00:14 +08:00
Minghe
7df1c64740 name the box (#481) 2020-03-15 12:55:52 +08:00
Minghe
91325f9ca3 commit packr-ed files (#480) 2020-03-15 08:36:46 +08:00
Minghe Huang
7326325c19 release v0.9.3 2020-03-14 20:46:09 +08:00
dependabot-preview[bot]
59e195fa94 Bump github.com/golang/mock from 1.4.1 to 1.4.2 (#479)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.1...v1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-14 20:37:52 +08:00
dependabot-preview[bot]
5ed4f8795a Bump github.com/gobuffalo/packr/v2 from 2.5.1 to 2.8.0 (#476)
Bumps [github.com/gobuffalo/packr/v2](https://github.com/gobuffalo/packr) from 2.5.1 to 2.8.0.
- [Release notes](https://github.com/gobuffalo/packr/releases)
- [Changelog](https://github.com/gobuffalo/packr/blob/master/.goreleaser.yml)
- [Commits](https://github.com/gobuffalo/packr/compare/v2.5.1...v2.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-11 11:48:19 +08:00
dependabot-preview[bot]
a02e7e66af Bump github.com/urfave/cli from 1.22.2 to 1.22.3 (#477)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.2 to 1.22.3.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.2...v1.22.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-03-11 11:48:02 +08:00
dependabot-preview[bot]
9c1d093bb8 Bump github.com/otiai10/copy from 1.0.2 to 1.1.1 (#474)
Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.0.2 to 1.1.1.
- [Release notes](https://github.com/otiai10/copy/releases)
- [Commits](https://github.com/otiai10/copy/compare/v1.0.2...v1.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Minghe <h.minghe@gmail.com>
2020-03-11 09:12:51 +08:00
Minghe
302877d4b4 Fn and deps (#475) 2020-03-11 08:59:47 +08:00
Minghe
871bb29dbe Bundler (#473)
* refactor bundler
* enable unit test
2020-03-10 22:49:14 +08:00
Minghe Huang
3be144f644 clean up no need files 2020-03-10 10:18:07 +08:00
Minghe
2560dc23fc fix the wrong destination of copy issue (#466)
* fix the wrong destination of copy issue
* bump up version
2020-03-01 15:58:45 +08:00
dependabot-preview[bot]
3d6c3d10bf Bump github.com/golang/mock from 1.4.0 to 1.4.1 (#464)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/v1.4.0...v1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-28 09:27:02 +08:00
Minghe
5f811693f1 bump up version 2020-02-21 17:28:07 +08:00
Minghe
0068fb92eb support 'format' option in 'fx list' (#462) 2020-02-21 17:26:39 +08:00
dependabot-preview[bot]
71174ead45 Bump github.com/stretchr/testify from 1.4.0 to 1.5.1 (#459)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.4.0 to 1.5.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.4.0...v1.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-21 15:10:47 +08:00
dependabot-preview[bot]
43c18caceb Bump github.com/briandowns/spinner from 1.7.0 to 1.9.0 (#457)
Bumps [github.com/briandowns/spinner](https://github.com/briandowns/spinner) from 1.7.0 to 1.9.0.
- [Release notes](https://github.com/briandowns/spinner/releases)
- [Commits](https://github.com/briandowns/spinner/compare/v1.7.0...v1.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-18 11:03:24 +08:00
dependabot-preview[bot]
7b4c9c3154 Bump github.com/spf13/viper from 1.6.1 to 1.6.2 (#451)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.6.1...v1.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-11 20:46:02 +08:00
dependabot-preview[bot]
9d2649433d Bump github.com/golang/mock from 1.3.1 to 1.4.0 (#452)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.3.1 to 1.4.0.
- [Release notes](https://github.com/golang/mock/releases)
- [Changelog](https://github.com/golang/mock/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang/mock/compare/1.3.1...v1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: Minghe <h.minghe@gmail.com>
2020-02-11 20:44:41 +08:00
dependabot-preview[bot]
6353fa7dd3 Bump github.com/apex/log from 1.1.1 to 1.1.2 (#453)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.1.1...v1.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: Minghe <h.minghe@gmail.com>
2020-02-11 20:44:01 +08:00
Minghe
bfa837c88d release 0.9.0 (#456) 2020-02-11 20:29:46 +08:00
Minghe
bdc454e7e5 support before_build hook (#455) 2020-02-11 20:26:46 +08:00
dependabot-preview[bot]
9b3e85754c Bump github.com/pkg/errors from 0.9.0 to 0.9.1 (#450)
Bumps [github.com/pkg/errors](https://github.com/pkg/errors) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/pkg/errors/releases)
- [Commits](https://github.com/pkg/errors/compare/v0.9.0...v0.9.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-15 10:09:44 +08:00
dependabot-preview[bot]
af3dcc5f31 Bump github.com/pkg/errors from 0.8.1 to 0.9.0 (#449)
Bumps [github.com/pkg/errors](https://github.com/pkg/errors) from 0.8.1 to 0.9.0.
- [Release notes](https://github.com/pkg/errors/releases)
- [Commits](https://github.com/pkg/errors/compare/v0.8.1...v0.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-14 08:51:29 +08:00
Minghe
c375fb9eaf check if source file or directory is ready or not (#447) 2020-01-07 15:36:23 +08:00
Minghe
70c314229f add JSON to perl base image (#446) 2020-01-03 09:53:59 +08:00
Minghe
66e23ead00 update docs (#445) 2020-01-02 23:42:43 +08:00
Minghe Huang
2e5666c2b6 Squashed commit of the following:
commit 5a9c2b5942d16b3ff7b4ed7a02dafbf2c5462eae
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Thu Jan 2 17:40:23 2020 +0800

    bump version
2020-01-02 17:40:46 +08:00
Minghe
7675656a54 fix force option when deploy a function on Docker infra (#443)
* fix force option when deploy a function on Docker infra

* fix test
2020-01-02 17:13:10 +08:00
Minghe
3d7f7b0ad1 Configurable auto remove (#440)
* enable autoremove to be configurable

* bump version
2019-12-31 14:29:01 +08:00
Minghe
a1ccbd6cab Add not fetch fx node bas (#439)
* add node-fetch to fx-node-base image, then we can use 'fetch' in
JavaScript/Node function

* bump version
2019-12-31 13:34:48 +08:00
Minghe
33cb4ce63c verify deploy function to Google Kubernetes Engine and update Doc (#435)
* verify deploy function to Google Kubernetes Engine and update Doc
* bump version
2019-12-27 23:08:51 +08:00
Minghe
aefb4497e2 When check a file is handler or not, should take extension account, (#433)
otherewise it might be a directory, not a file
2019-12-26 20:40:57 +08:00
Minghe Huang
0047e66f10 bump version 2019-12-26 20:38:50 +08:00
Minghe Huang
6bae4254af When check a file is handler or not, should take extension account,
otherewise it might be a directory, not a file
2019-12-26 18:47:11 +08:00
Minghe
a9689993b0 Fix packr missing auto release (#431)
* install packr

* install packr

* commit generate packr file

* no need change
2019-12-24 18:30:44 +08:00
Minghe
8c0182b29f move some installation into base image (#427) 2019-12-24 11:13:10 +08:00
Minghe Huang
02d55c7143 bump version 2019-12-23 13:57:31 +08:00
Minghe
f343b537f1 upgrade go-ssh-client pkg (#426)
* upgrade go-ssh-client pkg

* bump version
2019-12-20 10:24:14 +08:00
Minghe
a84e7da65f When there is services deployed via k8s mode on Desktop Docker for Mac (#424)
with kubernetes single node cluster, "fx list" will crash since some
service has no names, but the code trying to access names at index 0

Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-19 16:05:40 +08:00
Minghe
f3b64387cb dependencies should be field of brew (#423) 2019-12-19 14:28:53 +08:00
Minghe
e132435ff8 add docker to dependency (#422)
* add docker to dependency

Signed-off-by: Minghe Huang <h.minghe@gmail.com>

* bump version
2019-12-19 13:41:26 +08:00
Minghe
fb492fa6f7 Merge pull request #415 from metrue/perl
Perl
2019-12-19 10:14:22 +08:00
Minghe Huang
159714491d add perl support,
fx up func.pl

Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 21:06:56 +08:00
Minghe Huang
64cbbc70bb Squashed commit of the following:
commit f4e3d78e516f889a0256c6ddf922922ec12bc757
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Wed Dec 18 21:02:43 2019 +0800

    check error when walk directory

    Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 21:03:05 +08:00
Minghe
d0559f627e simple and clean code (#420)
Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 20:56:26 +08:00
Minghe
0a6784e270 fix wrong cloud type issue (#419)
Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 20:22:03 +08:00
Minghe
b6fd3c7e98 add contributor badge (#418) 2019-12-18 17:29:16 +08:00
Minghe
1c05534071 fix KUBECONFIG no effect issue (#416)
Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 16:59:10 +08:00
Minghe
3627d5bb40 fix ci script (#414) 2019-12-18 11:20:32 +08:00
Minghe
1f7714c1e9 Refactor kubeconfig persist logic (#412)
* add Dir function to config

* clean up

* persist the kubeconf on the fly

Signed-off-by: Minghe Huang <h.minghe@gmail.com>

* fix test

Signed-off-by: Minghe Huang <h.minghe@gmail.com>

* simplicity the cloud config fetch

Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-18 10:58:34 +08:00
Minghe
d868ebf4a1 enable CI check (#410)
* enable CI check

Signed-off-by: Minghe Huang <h.minghe@gmail.com>

* lint

* clean up lint issue

* fix Makefile

* uncomment

* fix coverage

* check infrastructure during up command (#411)

* check infrastructure during up command

Signed-off-by: Minghe Huang <h.minghe@gmail.com>

* add unit test

Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-17 22:54:54 +08:00
Minghe
4640379b06 clean up no use deps (#408) 2019-12-16 18:02:45 +08:00
dependabot-preview[bot]
922120efbb Bump github.com/spf13/viper from 1.3.2 to 1.6.1 (#406)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.3.2 to 1.6.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.3.2...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-13 09:24:03 +08:00
Minghe
91fec99b00 remove debugging information (#405)
Signed-off-by: Minghe Huang <h.minghe@gmail.com>
2019-12-12 22:57:01 +08:00
Minghe
2f89c1fe1f Refactor provision layer (#403) 2019-12-12 19:24:49 +08:00
Minghe
2298f39cca k3s on docker (#401)
* since we do the image build in initialize container of pod, so we have to make sure the image built can be access from kubelet on same node, containerd could not support that
* update docs
* bump version
* clean up
2019-12-07 01:42:13 +08:00
Minghe
23d68bc27b Refactor packer (#399) 2019-12-06 20:16:05 +08:00
Minghe
74c0423f0d add docs for rust example (#398) 2019-12-06 14:58:30 +08:00
Minghe
06f87c4d8e fix deploy to aks issue, and update docs (#396)
* fix deploy to aks issue, and update docs
* update docs
2019-12-06 11:54:27 +08:00
Minghe
35262de828 release v0.8.7 (#394) 2019-12-06 10:04:40 +08:00
dependabot-preview[bot]
34a495984c Bump github.com/olekukonko/tablewriter from 0.0.3 to 0.0.4 (#393)
Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.3 to 0.0.4.
- [Release notes](https://github.com/olekukonko/tablewriter/releases)
- [Commits](https://github.com/olekukonko/tablewriter/compare/v0.0.3...v0.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-06 09:45:27 +08:00
Minghe
d7130c4e28 support a project with multiple files (#392)
* support a project with multiple files
* fix lint issue
* fix test
2019-12-05 17:57:39 +08:00
Minghe
c9630a53c3 should treat CICD code block seperately (#391)
* should treat CICD code block seperately

* auto provision when host is not health

* fix lint
2019-12-05 11:38:54 +08:00
Minghe
0522690472 merge provisioner and deployer into infra (#390) 2019-12-04 19:09:14 +08:00
Minghe
a8a0fbed32 add ping method to check infra is healthy or not (#388)
* add ping method to check infra is healthy or not
* merge k3s and k8s deployer (#389)
* fix typo
2019-12-04 17:28:03 +08:00
Minghe
26ae9585f6 move cli args parsing into middleware level (#387) 2019-12-04 11:56:07 +08:00
Minghe
b69bd699c8 combine coverage and unit test progres (#386) 2019-12-04 09:45:42 +08:00
Minghe
650ee5f63a move progress bar into deploy function (#385) 2019-12-04 08:43:49 +08:00
Minghe
e3c60cbb77 show the endpoint information when deployed successfully (#384) 2019-12-03 19:27:26 +08:00
Minghe
0daca43d10 release v0.8.6 (#383) 2019-12-03 17:18:11 +08:00
Minghe
d3c239dc54 clean up no use codes (#381) 2019-12-03 17:01:14 +08:00
Minghe
05ac2441da list service as table format (#382) 2019-12-03 15:41:03 +08:00
Minghe
c0009b1b64 request a port when not port given (#379)
* request a port when not port given
* make context an interface, for easy testing (#380)
2019-12-03 15:14:13 +08:00
dependabot-preview[bot]
82960824ef Bump github.com/urfave/cli from 1.22.1 to 1.22.2 (#370)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.22.1 to 1.22.2.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.22.1...v1.22.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-29 08:54:02 +08:00
dependabot-preview[bot]
64b63cbd0f Bump gopkg.in/yaml.v2 from 2.2.4 to 2.2.7 (#378)
Bumps [gopkg.in/yaml.v2](https://github.com/go-yaml/yaml) from 2.2.4 to 2.2.7.
- [Release notes](https://github.com/go-yaml/yaml/releases)
- [Commits](https://github.com/go-yaml/yaml/compare/v2.2.4...v2.2.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-28 08:41:26 +08:00
Minghe
05771fb07f read kubeconfig from .fx/config or env (#377) 2019-11-27 20:47:49 +08:00
Minghe
d1f680dacd auto load config (#376) 2019-11-27 18:09:06 +08:00
Minghe
14c9397b70 use ssh to install, no dependency on k3sup (#367) 2019-11-27 15:40:18 +08:00
Minghe
eb5e724899 disable aks ci since environment not ready (#362) 2019-11-17 13:07:23 +08:00
Minghe
80619bd800 release 0.8.4 (#361) 2019-11-17 12:17:58 +08:00
Minghe
8e2cdfc607 update docs (#360) 2019-11-17 11:29:08 +08:00
Minghe
58f416b7b2 support custom cluster setup by k3s (#359)
* support custom cluster setup by k3s
* clean up
* fix lint issue
2019-11-17 10:50:55 +08:00
Minghe
b6cf39e3e5 support k8s operator (#358) 2019-11-17 08:56:58 +08:00
Minghe
41bc98ab64 fx on k3s (#357) 2019-11-17 00:10:55 +08:00
Minghe
b007ac315a refactor output (#356) 2019-11-15 22:23:27 +08:00
Minghe
940f6b8f72 enable progress bar (#355)
* enable progress bar
* add spinner pkg
* fix lint
2019-11-15 21:17:38 +08:00
Minghe
f9690b74a5 auto startup fx agent during setup progress (#354)
* auto start fx agent during setup progress

* bump version
2019-11-15 19:41:17 +08:00
Minghe
f2c58d545a add document on ubunut (#352)
* add document on ubunut

* fix typo
2019-11-15 13:29:31 +08:00
Siddhesh Poyarekar
4732426629 Point to instructions to build from source for non-x86 targets (#350)
* Fix typos
* Point to instructions to build from source for non-x86 targets

Installation instructions do not specify clearly enough the fact that
they are supported only on x86. Make it clearer and point to the Build
and Test section in Contribute for instructions on building fx.
2019-11-14 15:22:25 +08:00
Minghe
d4af4f67b2 fix syntax error (#349) 2019-11-12 12:29:25 +08:00
Minghe
6420e8b6c6 add workflow graph (#348) 2019-11-12 12:26:33 +08:00
Minghe
15c59fa31f bump version and update README (#347) 2019-11-12 10:47:26 +08:00
Minghe
294131b48f use seperate script (#346) 2019-11-12 09:42:18 +08:00
Minghe
48413abaa1 add cov upload (#345) 2019-11-11 18:50:53 +08:00
Minghe
d36b2b935b fix lint 2019-11-11 18:15:55 +08:00
Minghe
f493749689 Better fx run remote docker host (#338) 2019-11-11 15:35:52 +08:00
dependabot-preview[bot]
9de10bc885 Bump github.com/spf13/viper from 1.4.0 to 1.5.0 (#339)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.4.0...v1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-02 08:45:15 +08:00
Minghe
2d5446686a fix docker workflow (#337) 2019-10-27 21:55:17 +08:00
Minghe
0d7d4f4a6a fix docker workflow (#336) 2019-10-19 08:02:42 +08:00
Minghe
23c4171ece update to up and down since we already merge them up (#335) 2019-10-18 09:56:22 +08:00
Minghe
d8a1868fce Merge "deploy" command to "up" command (#333) 2019-10-18 09:32:57 +08:00
Minghe Huang
d91a9959a8 bump version 2019-10-17 10:17:32 +08:00
Minghe
87e7c7d6ae fix the wrong binding when deploy function on Docker environment (#330) 2019-10-17 09:45:26 +08:00
Minghe
89c94daebc update contributors info (#329) 2019-10-16 23:57:42 +08:00
Minghe
047fac2a0a Docker image build in Cluster (#327)
* * image build in cluster now
  use InitContainer to do the image building inside pods, which invoke
  docker again node's docker daemon
* create a docker build image tool fx/contrib/docker_packer
* clean up no need env in GitHub action workflow
* bump version
2019-10-16 23:37:52 +08:00
Minghe
1cb68766f7 fix version parse (#324) 2019-10-14 20:39:47 +08:00
Minghe Huang
91fd5dc59f bump version 2019-10-14 16:49:29 +08:00
Changxin Miao
184235acb2 Automatically notify user of new release (#317)
* Automatically notify user of new release

Signed-off-by: Changxin Miao <mcx_221@foxmail.com>

* Update naming convention
2019-10-14 13:38:07 +08:00
Minghe
aa49a59feb * kuberntes has some limitation on naming,By convention, the names of Kubernetes resources should be up to maximum length of 253 characters and consist of lower case alphanumeric characters, -, and ., but certain resources have more specific restrictions. (#322)
* skip run deploy when KUBECONFIG, DOCKER_USERNAME, and DOCKER_PASSWORD is not ready
2019-10-14 13:21:27 +08:00
Minghe
c9d382d903 Skip test when no credentials ready (#320)
* Since fork PR build could not read secrets of GitHub action,
https://github.community/t5/GitHub-Actions/Allow-secrets-to-be-shared-with-trusted-Actions/td-p/34278
So skip test when its credentials are nod ready

* skip deploy test when no DOCKER_USERNAME and DOCKER_PASSWORD found
2019-10-14 12:37:06 +08:00
Changxin Miao
81e18e5b0d Deployment selector should be immutable (#316)
Signed-off-by: Changxin Miao <mcx_221@foxmail.com>
2019-10-14 11:55:08 +08:00
Minghe
3882f843bf fix lint issue (#319) 2019-10-14 10:20:12 +08:00
Minghe
293481f081 release 0.7.3 (#311) 2019-10-12 21:41:49 +08:00
Minghe
c12d967ced fix typo (#310) 2019-10-12 21:09:06 +08:00
Minghe
b2a62cbd94 * create a deployment instead of create a pod directly (#308)
* remove host port expose to fix the port ocuppied issue
2019-10-12 20:41:02 +08:00
Minghe
536b757602 fix branch match issue (#306) 2019-10-10 19:51:07 +08:00
Minghe
ddff53fff2 improve installation script (#304)
* improve installation script and enable installation test in CI
* disable mac installation check
2019-10-10 14:31:58 +08:00
Minghe
ae87215cfb Auto release by goreleaser (#303) 2019-10-10 13:10:18 +08:00
Minghe
90d7ec88f0 disable julia in test, since the HttpParser is not in registry (#301)
* disable julia in test, since the HttpParser is not in registry

* fix typo
2019-10-09 17:24:50 +08:00
Minghe
697277e1bb longger timeout for golang linter (#300) 2019-10-09 10:53:00 +08:00
Minghe
a17126c713 fix typo 2019-10-09 01:26:17 +08:00
Minghe
2c35262b9e fix workflow 2019-10-09 01:23:31 +08:00
Minghe
017a34c13c fix typo 2019-10-09 01:05:33 +08:00
Minghe
bf8885e91a bump version and add depend on jobs (#299) 2019-10-09 01:02:02 +08:00
Minghe
e04ed119a6 fix missing env 2019-10-09 00:45:21 +08:00
Minghe
551e4986d3 fix typo 2019-10-09 00:39:33 +08:00
Minghe
fa05603599 use go 1.12.0 (#298) 2019-10-09 00:24:26 +08:00
Minghe
4826726d65 fix typo (#297) 2019-10-09 00:14:40 +08:00
Minghe
f33b3560ce fix typo (#296) 2019-10-09 00:07:42 +08:00
Minghe
2e6ec2f8a2 simple (#295) 2019-10-09 00:03:20 +08:00
Minghe
d821b46744 add releaser (#294) 2019-10-08 23:50:12 +08:00
Minghe
dab52aae5a no need to commit (#293) 2019-10-08 23:35:14 +08:00
Minghe
89ebf19859 use https://github.com/goreleaser/goreleaser-action/blob/master/.github/workflows/release.yml as refer (#292) 2019-10-08 23:24:12 +08:00
Minghe
d3d1a684cb update readme (#288) 2019-10-08 23:13:41 +08:00
Minghe
2f1ed88dc6 add releaser (#290) 2019-10-08 23:12:51 +08:00
Minghe
a7cfa99643 move docker HTTP client code into container_runtimes folder (#289) 2019-10-08 23:00:53 +08:00
Minghe
3454ec0fdb Deploy function on bare docker. (#286) 2019-10-08 11:08:01 +08:00
Minghe
f70ef1c406 fx on k8s (#278) 2019-10-05 18:49:25 +08:00
Sebastian Hafner
a5db158fe5 exclude markdown file extraction from install script (#283) 2019-10-01 18:25:46 +08:00
Minghe
a4d44a4fc0 add service api 2019-09-28 15:42:51 +08:00
Minghe
6b25cac002 add pod delete api (#270) 2019-09-28 14:28:42 +08:00
Minghe
af28f4d345 simplify ci workflow (#272) 2019-09-28 14:09:25 +08:00
Minghe
c540163e5f skip images assert (#271) 2019-09-28 11:37:48 +08:00
Minghe
ae3d76868d init k8s client (#268) 2019-09-27 18:50:33 +08:00
Minghe
bea48d26b3 setup kind and k8s (#269) 2019-09-27 17:36:43 +08:00
Minghe
0196c11793 bump version 2019-09-26 09:05:49 +08:00
Minghe
ab127a36ff support image operation, (#266)
* fx image build, build a function into a image which a API service handle with function
* fx image export, export service into a directory, for easy debug, we
  can just go the directory to do everything with Docker cli
2019-09-25 20:06:49 +08:00
Minghe
24a9fb1c35 enable default network fx-net (#262) 2019-09-22 21:41:52 +08:00
Minghe
9c2f14ce27 add network api (#261) 2019-09-22 20:26:07 +08:00
Vadim
ffa37ac77b Fix typo (Rust -> JavaScript) (#258) 2019-09-17 08:28:33 +08:00
Minghe
d21e3cfb4a check if port is in valid range (#257) 2019-09-14 15:03:52 +08:00
Minghe
199339bdfa show error message of container start issue (#256) 2019-09-14 14:24:56 +08:00
dependabot-preview[bot]
0d01728e20 Bump github.com/urfave/cli from 1.21.0 to 1.22.1 (#254)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.21.0 to 1.22.1.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.21.0...v1.22.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-13 11:28:44 +08:00
Minghe
e1b752407e disable autorelease since it's not working as expected, and i have no time to check (#252) 2019-08-31 19:03:35 +08:00
Minghe
73f3a3853f move up handle to handlers (#247)
* * done move handle codes to handlers pkg
* support force deploy a function

* fix remote host issue
2019-08-31 18:55:58 +08:00
Russtopia
2b7176201e Updated README.md for 0.5.4 (#251)
Instructions here didn't work with latest pull (0.5.4).
2019-08-31 10:01:21 +08:00
Minghe
37b2733dcf fix container naming missing issue (#250)
* fix container naming missing issue

* bump version
2019-08-30 22:58:23 +08:00
dependabot-preview[bot]
33943c83f1 Bump github.com/stretchr/testify from 1.3.0 to 1.4.0 (#248)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.3.0...v1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-18 09:00:39 +08:00
Minghe
7d3cc8f8d0 Setup CI via GitHub actions (#241)
* Update go.yml

* provision docker

* fix use

* fix use

* migration to workflows

* fix dep

* refactor workflows

* setup golang env

* fix path issue

* fix path issue

* Fix

* clean up

* provision docker

* start fx agent

* check

* check

* Squashed commit of the following:

commit c7f50a3256164573f1f7910c4b79729c91f77af7
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Mon Aug 12 08:13:54 2019 +0800

    update

commit e5ba0ea5af
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Sun Aug 11 23:53:38 2019 +0800

    test

commit aec09957f9
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Sun Aug 11 23:38:37 2019 +0800

    add unit test

commit 59ac78a112
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Sun Aug 11 22:52:51 2019 +0800

    refactor api

* Squashed commit of the following:

commit caa7e06fee72f345c6fad742f30a740f1c3de04d
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Mon Aug 12 13:42:54 2019 +0800

    refactor api

commit a384c6c023325da36fa54818c1c69673c439f8af
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Mon Aug 12 09:58:21 2019 +0800

    move packer

* disable test

* manage dep
2019-08-12 23:17:14 +08:00
Minghe
278652559a Enable health check for service (#242) 2019-08-11 12:09:11 +08:00
Minghe
87831d23f8 upgrade go-ssh-client to include latest fix (#239) 2019-08-10 14:59:41 +08:00
Minghe
4ace1d285f update readme (#238) 2019-08-10 13:47:55 +08:00
Minghe
d1191c2c85 update README (#237) 2019-08-10 13:39:55 +08:00
Minghe
2f238e9ce0 manage infrastructure (currently only suport host management) of fx (#233) 2019-08-10 11:54:40 +08:00
dependabot-preview[bot]
8fe146dabb Bump github.com/apex/log from 1.1.0 to 1.1.1 (#234)
Bumps [github.com/apex/log](https://github.com/apex/log) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/apex/log/releases)
- [Changelog](https://github.com/apex/log/blob/master/History.md)
- [Commits](https://github.com/apex/log/compare/v1.1.0...v1.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-09 19:13:03 +08:00
dependabot-preview[bot]
5c83a05054 Bump github.com/golang/mock from 1.2.0 to 1.3.1 (#235)
Bumps [github.com/golang/mock](https://github.com/golang/mock) from 1.2.0 to 1.3.1.
- [Release notes](https://github.com/golang/mock/releases)
- [Commits](https://github.com/golang/mock/compare/v1.2.0...1.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-09 19:12:09 +08:00
dependabot-preview[bot]
f0c4a8f159 Bump github.com/urfave/cli from 1.20.0 to 1.21.0 (#236)
Bumps [github.com/urfave/cli](https://github.com/urfave/cli) from 1.20.0 to 1.21.0.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v1.20.0...v1.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-09 18:09:57 +08:00
Minghe Huang
edb6bbc585 Squashed commit of the following:
commit 44fee6b8cfb231c16bafaa9c39228aafc8a74e5d
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Fri Aug 9 10:56:03 2019 +0800

    add PR template
2019-08-09 10:56:21 +08:00
Minghe
e301d2d54f context of fx function (#223) 2019-08-09 09:10:49 +08:00
Minghe Huang
474cb26920 Squashed commit of the following:
commit 2f4d229b1ebabc3839fc1fbbe5444498fd929c80
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Sun Aug 4 22:51:03 2019 +0800

    output log when debug
2019-08-04 22:51:18 +08:00
Minghe
8c962bf31a add redis (#222) 2019-08-04 21:45:43 +08:00
Minghe
c8c4d69b57 release v0.4.0 (#220) 2019-07-29 09:31:47 +08:00
Minghe
61c151ef11 enable remote host provision and deploy (#216)
* 1. support provision a remote host
2. support deploy function to a remote host
3. support hosts management now

features:
* fx provision - provision on default host
* fx host - manage hosts
2019-07-29 09:27:34 +08:00
Minghe Huang
7d709d8f19 Squashed commit of the following:
commit 9b7cf0af05a0a248b6c200aef20a597ca212b88a
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Mon Jul 22 22:24:59 2019 +0800

    use github default token
2019-07-22 22:25:28 +08:00
Minghe
9f14931d1f multiple workflow in one source file (#214) 2019-07-22 21:14:34 +08:00
Minghe
6a7d7b2353 move goreleaser to github action(#213) 2019-07-22 14:26:51 +08:00
Minghe
52ffb3ef25 vendor deps (#212) 2019-07-22 11:11:20 +08:00
Minghe
33ca880d73 build first before release (#211) 2019-07-22 10:31:36 +08:00
Minghe Huang
8b13442a15 Squashed commit of the following:
commit afe4a1291624b0110519f4f6b3b79a057a10762b
Author: Minghe Huang <h.minghe@gmail.com>
Date:   Mon Jul 22 00:28:32 2019 +0800

    bump version
2019-07-22 00:28:55 +08:00
Minghe
efe7ad5b00 run test concurrency (#208)
* run test concurrency

* enable cli test in PR
2019-07-22 00:26:59 +08:00
Minghe
b9cf6c9a07 add fx-golang-base (#207)
* * Create fx-go-base image
* Use func(ctx *gin.Context) as handle function

* enable pull golang base image
2019-07-21 22:39:11 +08:00
Minghe
7da8695b1b fix docker proxy startup init issue (#205) 2019-07-21 20:51:27 +08:00
Minghe
6c569458a1 enable golangci-lint (#204)
* enable golangci-lint

* add golangci config

* enable lint and fix lint issues
2019-07-21 18:38:59 +08:00
Minghe
fef6580134 replace dep with go mod (#203) 2019-07-21 17:52:46 +08:00
Minghe
fdae35cb37 fix rust build (#201) 2019-07-21 14:06:14 +08:00
Minghe
6180c62d31 fetch and context for handle function (#199)
* Add `node-fetch` to node base image
* Pass `koa` context as the second parameter for node handler function
* bump version
2019-07-21 13:21:28 +08:00
Minghe
295745b3d6 docs(naming): fix install cmd (#192) 2019-03-27 19:23:09 +08:00
Minghe
32f4fab154 docs(*): update readme (#190)
* docs(*): update readme

* feat(svg): update docs

* feat(svg): update docs

* docs(*): clean up

* docs(*): clean up
2019-03-23 11:48:04 +08:00
Minghe
7859f57150 feat(port): support customize running port (#188) 2019-03-22 17:47:49 +08:00
Minghe
d9e132e49b fix(cc): fix circleci config (#186) 2019-03-22 10:19:45 +08:00
Minghe
4366f5cbca fix(sytax): all assets are vendored (#185)
* fix(sytax): all assets are vendored

* chore(*): add more
2019-03-22 09:45:13 +08:00
Minghe
30133c534c fix(init): init before up (#183) 2019-03-21 23:54:27 +08:00
Minghe
77f7ee3092 chore(*): bump version to release rust support (#181) 2019-03-21 23:51:14 +08:00
Minghe
bff8fdaf95 chore(timeout): longer build timeout (#180)
* docs(readme): update readme

* feat(timeout): longer timeout
2019-03-21 23:49:18 +08:00
Minghe
14c5e841a9 feat(rust): support rust (#179)
* feat(rust): support rust now

* chore(test): test for rust

* fix(test): commit missing rust example func

* chore(*): only test cli before release
2019-03-21 23:32:45 +08:00
Minghe
05f755ed64 fix(typo): update readme (#178) 2019-03-21 16:55:44 +08:00
Minghe
0605ac2716 feat(up): should show the service endpoint when up done (#177) 2019-03-21 16:50:50 +08:00
Minghe
d54a4c23c8 fix(env): when no proxy created, should run one (#176)
* chore(git): update vendor

* fix(env): should run proxy when no proxy created
2019-03-21 16:50:32 +08:00
Minghe
778c718282 doc(readme): update readme (#175)
* doc(readme): update readme

* doc(wiki): remove wiki

* chore(*): bump version
2019-03-20 20:54:58 +08:00
Minghe
f04bbd2403 feat(refactor): * (#173)
* 1. user docker remote api instead of docker golang sdk to do stuff
2. remote gRPC code
3. simplify command

* fix(dep): remove private import

* chore(*): clean up

* chore(*): clean up

* chore(*): commit source

* fix(test): *

* fix(env): enable docker remote api

* fix(env): enable docker remote api

* chore(*): clean up

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* fix(ci): use machine to do build

* feat(timeout): longger timeout

* fix(test): *

* fix(typo): flag is name

* chore(*): debug

* chore(*): debug

* chore(*): decrease test time

* fix(type): disable call test since not well design yet

* fix(typo): remove,

* feat(images): pull images

* fix(Pkg): using Pkg first

* fix(Pkg): using Pkg first

* feat(julia): fix version

* chore(*): clean up

* fix(file): ensure file exist

* feat(http): remote http test

* fix(circleci): fix deploy job

* chore(*): update info

* feat(init): update script

* doc(architect): update readme

* refactor(api): refactor api code

* refacot(api): seperate version

* refactor(build): service build as single file

* feat(concurrent): down concurrent

* refactor(api): refactor API

* fix(endpoint): valid endpoint

* fix(path): path change

* feat(release): fix release script

* fix(path): correct path

* feat(api): seperate service run

* fix(release): install goreleaser

* fix(cc): fix cc

* fix(releaser): install releaser from script outside of circleci config

* fix(env): init logic move env

* fix(cli): fix init

* fix(env): avoid conflict

* chore(*): update output

* test(stop): add test for stop

* feat(label):apply default label

* doc(readme): update workflow graph

* fix(init): should just start when container exist

* feat(state): update container by state
2019-03-20 17:06:52 +08:00
Minghe
21ec74b03b feat(architect): architecture refactor (#170)
* refactor(*): move service from api

* fix(import): fix paht

* chore(*): update vendor
2019-02-18 20:54:43 +08:00
FrontMage
1be99b5b25 Add rust base image for Rust (#169)
Add rust base image for Rust
2019-01-02 17:35:01 +08:00
Minghe Huang
cf7bf9e71c clean code and fix version issue 2018-08-03 17:49:00 +08:00
Minghe Huang
9d35b29ff5 clean code 2018-08-03 15:54:03 +08:00
Minghe Huang
56afefb143 fix typo 2018-08-03 00:59:00 +08:00
Minghe Huang
f208d7c8d2 fix test 2018-08-03 00:49:05 +08:00
Minghe Huang
3ac61fea2d bump version 2018-08-03 00:43:22 +08:00
Minghe
884fb65432 Remove path (#162)
* clean up

* remove Path

* fix typo

* add more test

* fix typo

* fix permission issue

* fix server not started issue

* clean up
2018-08-03 00:41:33 +08:00
Minghe
24f9b53e76 remove container after 'fx call' end (#161)
* call by grpc client

* add test

* clean code
2018-08-02 20:19:41 +08:00
Minghe
61e153b59a Merge branch 'production' into master 2018-07-28 15:44:18 +08:00
Minghe
3105fe1b5a Fix remote addr (#159)
* use remote url since fx call will call on a remote server

* bump version
2018-07-28 15:42:40 +08:00
Minghe
584e1a67fc Doc (#158)
* update doc and setup wiki

* update README

* update README
2018-07-27 17:34:13 +08:00
Minghe
cc3d3a8d9f deploy (#156)
* fix typo

* fix output issue on call

* bump version

* Add/call service (#154)

add '/call' endpoint

* Add/call service (#155)

* add call endpoint

* remove debug code

* add Call method to FxService

* bump version
2018-07-22 22:40:06 +08:00
Minghe
303c75e9cb Merge branch 'production' into master 2018-07-22 22:39:23 +08:00
Minghe Huang
e775331f23 bump version 2018-07-22 22:38:09 +08:00
Minghe
8dfc5b947f Add/call service (#155)
* add call endpoint

* remove debug code

* add Call method to FxService
2018-07-22 22:36:41 +08:00
Minghe
fb55abb6b5 Add/call service (#154)
add '/call' endpoint
2018-07-22 22:34:58 +08:00
Minghe
c338d28498 deploy (#153)
* fix typo

* fix output issue on call

* bump version
2018-07-16 23:47:02 +08:00
Minghe Huang
26ef3c6027 bump version 2018-07-16 23:46:28 +08:00
Minghe Huang
843df76eb1 fix output issue on call 2018-07-16 23:46:05 +08:00
Minghe Huang
71f95067f8 fix typo 2018-07-16 23:46:05 +08:00
Minghe
95d36fc1f0 deploy (#152)
* fix typo

* WIP: Call (#151)

* bump version

* init a docker image to support run script

* a docker to run different script langs

* -d on Linux platform

* improve usage message (#149)

* fix typo

* Add Call command

* workflow connected, but params parsing needed

* feat(*): support fx call now

* noneed change

* bump version
2018-07-16 22:58:04 +08:00
Minghe
dbf6ee77fc fix typo (#150) 2018-06-25 17:35:10 +08:00
Minghe
aa68702476 improve usage message (#149) 2018-06-25 17:14:56 +08:00
Minghe
b36b9979d8 bump version (#147) 2018-06-24 23:06:57 +08:00
Minghe
9ed073a4f6 fix use not working issue (#146) 2018-06-24 23:03:11 +08:00
Minghe
ab90fe4cde Release (#144)
* refactor config (#140) (#141)

* refactor config

* fix uri issue

* release (#142)

* refactor config (#140)

* refactor config

* fix uri issue

* bump version

* release 0.0.7
2018-06-24 20:54:52 +08:00
Minghe
55d0dbeca9 Status (#143) 2018-06-24 20:54:52 +08:00
Minghe
e22d371722 release (#142)
* refactor config (#140)

* refactor config

* fix uri issue

* bump version
2018-06-24 00:53:25 +08:00
Minghe
5b9685a5b5 refactor config (#140) (#141)
* refactor config

* fix uri issue
2018-06-24 00:40:22 +08:00
Minghe Huang
cd017b2e1e bump version 2018-06-23 19:56:26 +08:00
Minghe Huang
fef248849c bump version 2018-06-23 19:55:05 +08:00
Minghe Huang
50bdf6e31c bump version 2018-06-23 19:40:13 +08:00
Minghe
d495a1d7f1 Add use (#134) 2018-06-23 19:39:15 +08:00
Minghe Huang
850b186592 update README 2018-06-23 16:30:06 +08:00
Minghe
b0df98600e Clean code (#132) 2018-06-23 16:14:14 +08:00
Minghe Huang
d325753bb7 fix typo 2018-06-20 17:25:07 +08:00
Minghe Huang
7b4a6a37c8 Add version file 2018-06-20 17:07:17 +08:00
Minghe Huang
e51d6d86f8 Add release 2018-06-20 16:55:58 +08:00
Minghe Huang
d73afe8666 short commit id 2018-06-20 16:37:19 +08:00
Minghe
950c65d2c6 Deploy (#130)
* setup ci

* run all test

* fix build

* disable test

* remove build step since release step will do build

* add missing deps

* update version

* auto tag

* set name and email
2018-06-20 16:35:44 +08:00
Minghe Huang
56967bf689 fix test 2018-06-20 11:35:35 +08:00
Minghe
d66eadb710 Refactor flag parsing code (#129) 2018-06-20 10:50:02 +08:00
Minghe Huang
77a97c1689 fix(*): verbose undefined 2018-06-19 22:00:16 +08:00
Minghe
2d7af0ea27 add test (#128) 2018-06-19 21:55:16 +08:00
Minghe Huang
60efd92527 fix wrong task name issue 2018-06-19 16:25:56 +08:00
Minghe Huang
5b172708e8 update circleci config 2018-06-19 16:22:14 +08:00
Minghe Huang
ce88cacfb5 Fix go get met no Go file issue 2018-06-19 16:04:35 +08:00
Minghe Huang
aedba3ee7c add submode update step 2018-06-19 15:59:17 +08:00
Minghe Huang
a224c4add4 clean up 2018-06-19 15:57:33 +08:00
Minghe Huang
21a51d289c clean up 2018-06-19 15:56:07 +08:00
Minghe Huang
1f7c8ce5a2 clean up 2018-06-19 15:56:00 +08:00
Minghe Huang
1287ab8743 fix path issue 2018-06-19 15:43:46 +08:00
Minghe Huang
ed5ac21613 clean up 2018-06-17 01:29:24 +08:00
Minghe Huang
bdbc558470 clean up 2018-06-17 01:25:21 +08:00
Minghe Huang
fb39606933 clean code 2018-06-17 01:12:28 +08:00
Minghe
06bd14fb45 Refactor (#126) 2018-06-17 01:05:51 +08:00
Minghe
0df6eb71e0 circleci workflow 2018-06-15 23:48:23 +08:00
Minghe Huang
241e680302 add new contributor 2018-01-31 13:29:36 +08:00
Minghe Huang
7ada940f0a Merge branch 'master' of https://github.com/metrue/fx 2018-01-31 13:27:47 +08:00
Minghe
c156f68ea0 Merge pull request #123 from steventhanna/master
Added syntax highlighting for code snippets
2018-01-26 08:06:09 +08:00
Steven Hanna
5b93ecd834 Added syntax highlighting for code snippets
Added syntax highlighting for code snippets in the `README.md`
2018-01-25 11:06:39 -05:00
Minghe Huang
104a5705b9 update README 2018-01-21 20:51:45 +08:00
Minghe
1f5244e087 Merge pull request #122 from andre2007/master
Added D to list of supported languages
2018-01-21 11:34:23 +08:00
=
6b3cddf847 Added D to list of supported languages 2018-01-20 21:10:40 +01:00
Minghe Huang
c2750e776f update port 2018-01-13 13:44:52 +08:00
Minghe
173a4207a9 Merge pull request #120 from metrue/fix/monitor-base-image-pull
Fix/monitor base image pull
2018-01-07 16:12:29 +08:00
Minghe Huang
b62026c692 disable api/service coverage test 2018-01-07 16:05:11 +08:00
Minghe Huang
9d1c6f6b60 use make build 2018-01-07 15:54:54 +08:00
Minghe Huang
af2e67e301 refactor testing 2018-01-07 15:49:47 +08:00
Minghe Huang
8a2ba8172c enable test of api/service 2018-01-07 15:33:33 +08:00
Minghe Huang
e050770473 friendly message 2018-01-07 15:32:44 +08:00
Minghe Huang
1aebe626af use channel to monitor base image pull task 2018-01-07 15:27:32 +08:00
Minghe Huang
3c24781d36 temp disable api/service test to green the build 2018-01-07 12:18:58 +08:00
Minghe Huang
b57d7f79e9 friendly message when env is not ready 2018-01-06 17:38:56 +08:00
Minghe
dce74a9b57 Merge pull request #119 from metrue/improve/output
Improve/output
2018-01-06 16:58:48 +08:00
Minghe Huang
391c1a9fa8 use ASCII table lib to process output 2018-01-06 16:56:57 +08:00
Minghe Huang
7de6f7db9d use ASCII table lib to process output 2018-01-06 16:56:51 +08:00
Minghe Huang
24661a6fa5 longer waiting time to make sure server ready before testing up 2018-01-06 16:13:25 +08:00
Minghe
6d2c682d4b Merge pull request #118 from metrue/error-handler
use global error handler
2018-01-06 16:06:01 +08:00
Minghe Huang
db4a0026a2 use global error handler 2018-01-06 15:56:43 +08:00
Minghe Huang
9524de1e9e add development status section 2017-12-31 16:17:05 +08:00
Minghe
a0d69eb61f fix circleci failure 2017-12-21 04:59:11 +00:00
Minghe Huang
0e11e453dc fix warning since use array 2017-12-17 13:20:03 +08:00
Minghe
3ebcd2a857 Merge pull request #106 from muka/fixalldown
added back support for `fx down *`
2017-12-17 13:13:00 +08:00
Minghe
a8c60ad9f7 update the bin path also 2017-12-17 05:07:26 +00:00
Minghe
11a0d21c0d Merge pull request #111 from muka/fixgen
review install-deps and gen.sh to use local refs
2017-12-17 12:58:29 +08:00
Luca Capra
96e0403dad review install-deps and gen.sh to use local refs 2017-12-16 22:02:35 +01:00
Luca Capra
8bedb38eb9 Merge branch 'fixalldown' of github.com:muka/fx into fixalldown 2017-12-16 19:00:13 +01:00
Luca Capra
f386c007eb review formatter output 2017-12-16 18:58:28 +01:00
Luca Capra
d8c616b2d3 Merge branch 'master' of https://github.com/metrue/fx into fixalldown 2017-12-16 18:58:16 +01:00
Minghe Huang
5d57c5df51 fix typo 2017-12-17 01:44:53 +08:00
Minghe Huang
8d89e63b14 add more contributtors 2017-12-17 01:42:46 +08:00
Minghe Huang
ce290dcb3b fix wrong file name 2017-12-17 01:36:07 +08:00
Minghe Huang
cae4f3e3f7 fix wrong file name 2017-12-17 01:36:05 +08:00
Minghe Huang
1fc9ba1594 add .gitattribute 2017-12-17 01:33:59 +08:00
Minghe Huang
92f1ba2bf0 auto bundle asset into binary with go-bindata 2017-12-17 01:28:03 +08:00
Minghe
0fdebbd05b Merge branch 'master' into fixalldown 2017-12-17 01:13:18 +08:00
Luca Capra
63fa802e63 Merge branch 'master' into fixalldown 2017-12-16 18:08:46 +01:00
Minghe
70fd259ca6 Merge pull request #105 from andre2007/master
Initial D support
2017-12-17 01:06:39 +08:00
Minghe
37ace80123 add d language stuff 2017-12-16 17:02:11 +00:00
Minghe
3128421b6b fix some syntax issue 2017-12-17 00:39:48 +08:00
Minghe Huang
7c6a22461c add api/google into gitignore 2017-12-17 00:10:26 +08:00
=
3371549c0b Review comments 2017-12-16 16:50:43 +01:00
Luca Capra
7aad3c6319 review List handler to return running container only 2017-12-16 14:50:24 +01:00
Luca Capra
b8b1432ba3 apply * logic to down only 2017-12-16 13:10:42 +01:00
Luca Capra
ba3047b6f3 review start stop service in test 2017-12-16 10:21:20 +01:00
Luca Capra
e5c60c933c ign coverage.txt 2017-12-16 10:13:48 +01:00
Luca Capra
ef2bd66bb1 wait for service to start 2017-12-16 10:07:04 +01:00
Luca Capra
327dbc2251 review verbose for pull 2017-12-16 10:01:40 +01:00
Luca Capra
bce63388f2 added back support for 2017-12-16 08:02:29 +01:00
=
665ffae490 Merge remote-tracking branch 'upstream/master' 2017-12-15 20:40:55 +01:00
=
8df9cd658a Initial D support 2017-12-15 20:29:50 +01:00
Minghe Huang
5b233491f0 install googleapis which needed by api/ 2017-12-14 23:32:12 +08:00
Minghe Huang
599eeca2c2 clean code 2017-12-14 22:54:33 +08:00
Minghe
e660a64c36 Update README.md 2017-12-14 12:26:08 +08:00
Minghe
656a20b259 Rename NEW_LANGUAGE_SUPPORT to NEW_LANGUAGE_SUPPORT.md 2017-12-14 12:22:48 +08:00
Minghe
1862756282 Create NEW_LANGUAGE_SUPPORT 2017-12-14 12:22:30 +08:00
Minghe
15001efc39 Merge pull request #102 from metrue/provision-tools
WIP: add protoc installation script
2017-12-14 12:17:54 +08:00
Minghe Huang
e62adc99fa download and install protoc locally 2017-12-14 02:51:58 +00:00
Minghe Huang
5c8be67a57 add protoc installation script 2017-12-13 23:25:27 +08:00
Minghe
7eb6124dad Merge pull request #100 from muka/grpc
Use gRPC over websocket
2017-12-13 22:40:15 +08:00
Luca Capra
3c57e130b9 merge master 2017-12-13 06:41:29 +01:00
Minghe Huang
0b93e7379b update .gitignore 2017-12-13 13:27:58 +08:00
Luca Capra
2396fec147 avoid duplicate header in coverage output 2017-12-12 21:35:24 +01:00
Luca Capra
744308cf5b added protoc setup example 2017-12-12 21:16:44 +01:00
Luca Capra
747273dad5 use same package to have correct coverage assesment 2017-12-12 21:04:56 +01:00
Luca Capra
68b630aaeb add comments to address codecov checks 2017-12-12 20:21:32 +01:00
Luca Capra
4afbdbc83c remove variable from test command 2017-12-12 20:06:43 +01:00
Luca Capra
b1b2ae5a15 refactor with tests 2017-12-12 08:06:57 +01:00
Luca Capra
f816bd9539 Merge branch 'grpc' of github.com:muka/fx into grpc 2017-12-12 06:54:41 +01:00
Luca Capra
4a81e90469 handle errors concurrently 2017-12-12 06:54:30 +01:00
lcapra
9025464369 remove dangling message reference 2017-12-11 12:13:25 +01:00
lcapra
3317b936e3 fix context reference 2017-12-11 12:10:46 +01:00
lcapra
98c1f65b66 ensure dep 2017-12-11 11:59:57 +01:00
lcapra
a556e50d11 fix dep name 2017-12-11 11:58:29 +01:00
lcapra
d02ed1d748 review dep requirements 2017-12-11 11:57:00 +01:00
Luca Capra
976deaad53 handle errors explicitly 2017-12-11 07:15:32 +01:00
Luca Capra
21ea85f33a service test 2017-12-11 06:51:00 +01:00
Luca Capra
484455d850 fix pointers 2017-12-10 16:18:58 +01:00
Luca Capra
f911d34767 avoid struct transformation 2017-12-10 16:15:56 +01:00
Luca Capra
ed4d1c87d8 remove redundant struct 2017-12-10 16:13:26 +01:00
Luca Capra
cebcfaaffd remove redundant structs in message 2017-12-10 16:11:24 +01:00
Luca Capra
4c70089cde refactor api -> api/service 2017-12-10 16:06:31 +01:00
Luca Capra
d1ff152bfe Merge branch 'master' of https://github.com/metrue/fx 2017-12-10 15:38:57 +01:00
Luca Capra
202ed7d1df initial client-server integration 2017-12-10 12:53:45 +01:00
Luca Capra
2219c3f1c9 refactor commands to use grpc 2017-12-10 12:17:21 +01:00
Luca Capra
2616229307 refactor to use grp exposed service as default 2017-12-10 11:35:57 +01:00
Minghe
05a0372672 Merge pull request #99 from metrue/develop
Develop
2017-12-10 18:28:18 +08:00
Minghe Huang
501965fffc Add coverage badge 2017-12-10 18:27:37 +08:00
Minghe Huang
174607546f add coverage 2017-12-10 18:24:33 +08:00
Minghe Huang
599966aea5 clean up after test run 2017-12-10 18:04:28 +08:00
Luca Capra
6dba9a4ef2 added initial gRPC service 2017-12-10 10:12:19 +01:00
Luca Capra
3cc9694c69 rename package api to docker 2017-12-10 09:30:19 +01:00
Minghe
e53edb20cf Merge pull request #97 from metrue/develop
should check environment if ok
2017-12-09 16:34:31 +08:00
Minghe Huang
dcf2d1e38f should check environment if ok 2017-12-09 13:58:12 +08:00
Minghe Huang
727963bb14 update README 2017-12-09 11:15:56 +08:00
Minghe Huang
b13ac2943b update README 2017-12-09 11:10:58 +08:00
Minghe
4e2a5ff260 Merge pull request #95 from metrue/develop
Develop
2017-12-09 11:08:55 +08:00
Minghe Huang
b77e8a6cd1 upgrade 2017-12-09 02:58:32 +00:00
Minghe Huang
ed082eea49 clean up 2017-12-09 10:53:52 +08:00
Minghe Huang
e92a2ca4a0 update README 2017-12-09 10:53:21 +08:00
Minghe Huang
612d83c8e2 Merge branch 'develop' 2017-12-09 10:36:53 +08:00
Minghe Huang
7ee48f56b2 install.sh works now 2017-12-09 02:14:09 +00:00
Minghe Huang
84b8778ddf add install script 2017-12-09 09:47:31 +08:00
Minghe
db739c1209 Merge pull request #93 from metrue/develop
Develop
2017-12-09 09:04:00 +08:00
Minghe Huang
a0e9bae89b excape - 2017-12-09 08:57:23 +08:00
Minghe Huang
317f00ea5b add unit test 2017-12-09 08:53:34 +08:00
Minghe Huang
c93eada317 fix test 2017-12-09 08:49:28 +08:00
Minghe Huang
384c192c04 format up message 2017-12-09 01:33:37 +08:00
Minghe Huang
e72e0d5efa refractor up 2017-12-09 01:25:09 +08:00
Minghe Huang
3735ec2260 format down result message 2017-12-09 00:06:53 +08:00
Minghe Huang
8bf60ff016 fx no depend on zsh and git 2017-12-08 22:24:30 +08:00
Minghe Huang
cefcd77192 trying format message 2017-12-08 22:00:53 +08:00
Minghe Huang
b95db62561 update 2017-12-08 07:09:44 +00:00
Minghe
2872f64a12 Merge pull request #91 from xwjdsh/master
Optimizing code
2017-12-08 14:41:39 +08:00
Wendell Sun
07845db5ae Optimizing code 2017-12-08 12:41:06 +08:00
Minghe
2c450fa549 Merge pull request #90 from metrue/develop
Refine dir/module
2017-12-08 12:13:42 +08:00
Minghe Huang
93ee7d868e Refine dir/module 2017-12-08 12:08:43 +08:00
Minghe
775afd0d2b Merge pull request #89 from metrue/remove-download-images
Remove download images
2017-12-08 12:01:12 +08:00
Minghe Huang
27a3dc92fb fix Java build 2017-12-08 11:53:30 +08:00
Minghe Huang
18ee51ff07 java is use Uppercase for public class 2017-12-08 11:47:35 +08:00
Minghe Huang
dfb372c42f no need to download the preset image from github 2017-12-08 11:35:16 +08:00
Minghe Huang
06a79c3fa1 Clean up 2017-12-08 11:28:39 +08:00
Minghe Huang
e50fd6b799 fix typo 2017-12-08 11:26:54 +08:00
Minghe Huang
8ec1d29cec no need to use old image preparing step anymore 2017-12-08 11:22:37 +08:00
Minghe Huang
768232d625 the first TDD golang in 2017-12-08 10:57:16 +08:00
Minghe Huang
599e9a596f fix test a little 2017-12-08 10:45:40 +08:00
Minghe Huang
e31f6605dd fix some test issue 2017-12-08 10:08:03 +08:00
Minghe Huang
09ced6210d Merge branch 'remove-download-images' of https://github.com/metrue/fx into remove-download-images 2017-12-07 17:37:10 +08:00
Minghe Huang
c077cb55d5 add image module 2017-12-07 17:31:12 +08:00
Minghe Huang
2f96dfefec update since dir refined 2017-12-07 11:02:15 +08:00
Minghe Huang
61113c5404 refine dir 2017-12-07 10:52:46 +08:00
Minghe Huang
1c56ae5037 clean up 2017-12-07 10:14:39 +08:00
Minghe Huang
998be24c84 prof go-bindata works 2017-12-07 09:58:10 +08:00
Minghe Huang
c2d8545e15 add asset module 2017-12-06 18:21:04 +08:00
Minghe Huang
10df127f55 yes, go-binddata works 2017-12-06 06:43:28 +00:00
Minghe Huang
f7ed3cc681 use go-bindata to include file stuff 2017-12-05 01:52:17 +00:00
Minghe
27a02c8a74 Merge pull request #82 from metrue/develop
add verbose option to fx serve
2017-12-04 23:45:13 +08:00
Minghe Huang
225e8723ba add verbose option to fx serve 2017-12-04 23:40:21 +08:00
Minghe
e50e144346 Merge pull request #81 from metrue/develop
clean up
2017-12-04 20:44:58 +08:00
Minghe Huang
a836b9c9c9 clean up 2017-12-04 20:39:59 +08:00
Minghe Huang
61b82d28b6 Clean up 2017-12-04 20:38:51 +08:00
Minghe
e7b5d3f745 Merge pull request #77 from xwjdsh/master
Remove build image when executing fx down
2017-12-04 20:11:32 +08:00
Wendell Sun
d5fae747f7 Remove build image when executing fx down 2017-12-04 17:49:37 +08:00
Minghe Huang
62379a410f fix deps stuff 2017-12-04 04:28:32 +00:00
Minghe
8ed8fac9e9 Merge pull request #76 from metrue/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2017-12-04 12:20:07 +08:00
Minghe
fe54495f4d Create CODE_OF_CONDUCT.md 2017-12-04 12:19:48 +08:00
Minghe Huang
d945634de4 add @xwjdsh to contributors list 2017-12-04 12:14:19 +08:00
Minghe
fb2c8d109b Merge pull request #75 from xwjdsh/master
Shows all-state container and display state column
2017-12-04 12:09:11 +08:00
Wendell Sun
59053bf626 Shows all-state container and display state column 2017-12-04 11:45:46 +08:00
Minghe
3fa4d1cbb6 Merge pull request #74 from metrue/develop
Develop
2017-12-04 10:29:10 +08:00
Minghe
6c3af11fd9 Merge pull request #72 from metrue/refactor-up
Refactor up
2017-12-04 09:59:51 +08:00
Minghe Huang
9f18f5f315 should use path.Join to combine path 2017-12-04 09:38:44 +08:00
Minghe
29a0745aea Merge pull request #69 from xwjdsh/master
Remove container when execute fx down
2017-12-04 09:32:24 +08:00
Minghe
30a60d3ade Merge pull request #70 from xwjdsh/fix-40
Cleanup temp file when build image was done
2017-12-04 09:31:33 +08:00
Minghe
ed5d57a32f Merge pull request #71 from xwjdsh/list-fx-only
Set fx label when building images and filter by it after
2017-12-04 09:30:35 +08:00
Wendell Sun
b78012485f Set fx label when building images and filter by it after 2017-12-04 01:55:17 +08:00
Wendell Sun
0ef5debd91 Invoke cleanup with defer 2017-12-04 01:00:42 +08:00
Wendell Sun
f3a2e99c24 Cleanup temp file when build image was done 2017-12-04 00:09:23 +08:00
Wendell Sun
8742f1c23d Remove container when execute fx down 2017-12-03 23:06:38 +08:00
Minghe
149006ee79 Merge pull request #68 from xwjdsh/master
Fix print error
2017-12-03 22:20:21 +08:00
Wendell Sun
bf28762e0d Fix print error 2017-12-03 21:25:17 +08:00
Minghe Huang
12822414f8 move get language from file name ext to utils 2017-12-03 18:44:44 +08:00
Minghe Huang
16a0538c6d refactor worker 2017-12-03 18:15:21 +08:00
Minghe Huang
549a0f2896 use FunctionMeta struct 2017-12-03 13:02:09 +08:00
Minghe Huang
88d91d630b fix typo 2017-12-02 14:23:27 +00:00
Minghe Huang
66e906ce96 update circleci config 2017-12-02 22:16:12 +08:00
Minghe Huang
57bfd50c85 then install 2017-12-02 22:12:10 +08:00
Minghe Huang
4bd92a88d1 use workable commit 2017-12-02 22:01:36 +08:00
Minghe Huang
50b37a72bd use * 2017-12-02 21:51:28 +08:00
Minghe Huang
fb2d1e14ee always up-to-date 2017-12-02 21:45:43 +08:00
Minghe Huang
f918878f6a updated deps 2017-12-02 13:33:43 +00:00
Minghe Huang
5d8bcac543 Refractor a little 2017-12-02 21:25:07 +08:00
Minghe Huang
da6b5795ee async pull image task 2017-12-02 21:11:27 +08:00
Minghe Huang
8c7a5bf6e4 fix typo 2017-12-02 18:09:09 +08:00
Minghe
9d8df70e80 Merge pull request #66 from metrue/fix/faster-deployment
Fix/faster deployment
2017-12-01 23:56:48 +08:00
Minghe Huang
f1655d81cb auto pull base image when serve start 2017-12-01 23:55:21 +08:00
Minghe Huang
6b26c46e23 add missing 2017-12-01 16:47:19 +08:00
Minghe Huang
23932e1ded pull image when init env 2017-12-01 16:44:31 +08:00
Minghe Huang
20b2fadf14 new release 2017-12-01 12:22:56 +08:00
Minghe Huang
e9c39b4703 clean up 2017-12-01 12:22:11 +08:00
Minghe
a80d98e6c0 Merge pull request #65 from metrue/dockerfile-refactor
Dockerfile refactor
2017-12-01 11:54:45 +08:00
Minghe Huang
f11b06e6d9 refactor java base image 2017-12-01 11:05:22 +08:00
Minghe Huang
e81032bd46 refactor to python base image 2017-12-01 09:26:53 +08:00
Minghe Huang
b8620b71af refractor some jenkinsfile 2017-12-01 00:14:55 +08:00
Minghe Huang
f066e841e8 Refactor node base image to base dockerfile 2017-12-01 00:06:46 +08:00
Minghe Huang
4bb67a9514 refractor Dockerfile base to base image 2017-11-30 23:47:19 +08:00
Minghe Huang
bef5250cfb add java test 2017-11-30 14:18:33 +08:00
Minghe Huang
e50ddaf004 fix typo 2017-11-30 10:36:42 +08:00
Minghe Huang
a45151c8e5 add zip images command 2017-11-30 10:29:53 +08:00
Minghe Huang
2313d41e6c fix wrong zip issue 2017-11-30 10:27:37 +08:00
Minghe Huang
5390e74365 Add example function for java 2017-11-30 10:24:08 +08:00
Minghe Huang
c9793cda30 release java support 2017-11-30 10:20:36 +08:00
Minghe Huang
0840644f69 fix case issue in file name 2017-11-30 02:16:39 +00:00
Minghe Huang
315ff33cf7 add missing file 2017-11-30 10:11:26 +08:00
Minghe Huang
268d308e1b upodate READEME 2017-11-30 10:06:26 +08:00
Minghe Huang
bcf6dbd1a4 support java 2017-11-30 09:55:33 +08:00
Minghe
34df47d010 Merge pull request #64 from chlins/master
Fix unclosed channel
2017-11-29 17:46:46 +08:00
chlins
4dc7cc17c3 Fix unclosed channel 2017-11-29 17:19:01 +08:00
Minghe Huang
1ef791cd6e java support basically proved 2017-11-29 16:46:24 +08:00
Minghe Huang
768be125cd clean code 2017-11-29 16:23:39 +08:00
Minghe Huang
5816870074 naming 2017-11-29 16:21:54 +08:00
Minghe Huang
fa191b35b8 java basically work 2017-11-29 16:17:34 +08:00
Minghe Huang
d961614d79 update README 2017-11-26 00:15:37 +08:00
Minghe Huang
1ccd323d1c fix typo 2017-11-25 19:30:26 +08:00
Minghe
2b1bd16510 Merge pull request #63 from chlins/master
Fix a bug
2017-11-25 16:20:24 +08:00
chlins
ca6493527e Fix a bug 2017-11-25 15:54:00 +08:00
Minghe
88adb68bb4 Merge pull request #62 from chlins/master
Move logger to outer
2017-11-25 14:59:37 +08:00
chlins
dd90aa09c1 Move logger to outer 2017-11-25 14:07:42 +08:00
Chenyu Zhang
81a58223c5 Merge pull request #3 from metrue/master
Merge
2017-11-22 16:36:52 +08:00
Chenyu Zhang
dfa8adf3ac Merge pull request #2 from metrue/master
update
2017-11-20 09:34:03 +08:00
908 changed files with 20113 additions and 70098 deletions

View File

@@ -1,56 +0,0 @@
version: 2
machine:
services:
- docker
dependencies:
override:
- sudo add-apt-repository ppa:masterminds/glide -y
- sudo apt-get update
- sudo apt-get install glide -y
jobs:
build:
docker:
- image: circleci/golang:1.8
working_directory: /go/src/github.com/metrue/fx
steps:
- checkout
- setup_remote_docker
- run:
name: Install tools
command: |
go get github.com/golang/dep
cd $GOPATH/src/github.com/golang/dep
go install ./...
- run:
name: Build and Install
command: |
dep ensure
go install ./
- run:
name: Test
command: |
fx serve > server_output.log 2>&1 &
sleep 20
touch deploy.log
fx up examples/functions/func.js >> deploy.log
fx up examples/functions/func.rb >> deploy.log
fx up examples/functions/func.py >> deploy.log
fx up examples/functions/func.go >> deploy.log
fx up examples/functions/func.php >> deploy.log
fx up examples/functions/func.jl >> deploy.log
fx up examples/functions/func.R >> deploy.log
cat server_output.log
cat deploy.log;
cat deploy.log | grep 'Succed: 1' | wc -l | grep 7
deployment:
production:
branch: master
commands:
- echo "Not Ready Yet"

View File

@@ -1,37 +0,0 @@
version: 2
dependencies:
override:
- sudo add-apt-repository ppa:masterminds/glide -y
- sudo apt-get update
- sudo apt-get install glide -y
jobs:
build:
docker:
- image: circleci/golang:1.8
working_directory: /go/src/github.com/metrue/fx
steps:
- checkout
- run:
name: Install tools
command: |
wget "https://github.com/Masterminds/glide/releases/download/0.10.2/glide-0.10.2-linux-amd64.tar.gz"
mkdir -p $HOME/bin
tar -vxz -C $HOME/bin --strip=1 -f glide-0.10.2-linux-amd64.tar.gz
export PATH="$HOME/bin:$PATH"
- run:
name: Build client
command: |
export PATH="$HOME/bin:$PATH"
cd client && make install-deps && make clean && make build
- run:
name: Build server
command: |
export PATH="$HOME/bin:$PATH"
cd server && make install-deps && make clean && make build
deployment:
production:
branch: master
commands:
- echo "Not Ready Yet"

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
assets/**/* linguist-vendored
api/assets/**/* linguist-vendored
examples/**/* linguist-vendored
packer/images/**/* linguist-vendored
*.md linguist-documentation

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
ko_fi: metrue

8
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10

9
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,9 @@
Issue: <url to the issue to fix>
Summary: <a brief summary of PR purpose>
The checklist before PR is ready for review:
- [ ] has unit testing for new added codes
- [ ] has functional testing for new added features
- [ ] has checked the lint or style issues
- [ ] README updated if need

95
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,95 @@
on: [push, pull_request]
name: ci
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: setup Go 1.12
uses: actions/setup-go@v1
with:
go-version: 1.12
id: go
- name: check out
uses: actions/checkout@master
- name: kind create a k8s cluster
run: |
kind create cluster
# - name: lint
# run: |
# make lint
- name: unit test
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
# export KUBECONFIG="$(kind get kubeconfig-path)"
make unit-test
bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
- name: build fx
run: |
make build
- name: test fx-docker
run: |
cd ./contrib/docker_packer
make linux-build
make docker-build
make test
# make docker-publish #TODO in release workflow
- name: test fx cli
env:
REMOTE_HOST_ADDR: ${{secrets.DOCKER_REMOTE_HOST_ADDR}}
REMOTE_HOST_USER: ${{secrets.DOCKER_REMOTE_HOST_USER}}
REMOTE_HOST_PASSWORD: ${{secrets.DOCKER_REMOTE_HOST_PASSWORD}}
run: |
echo $KUBECONFIG
unset KUBECONFIG
make cli-test-ci
- name: test AKS
env:
AKS_KUBECONFIG: ${{ secrets.AKS_KUBECONFIG }}
run: |
echo "skip since aks environment not ready yet"
# export KUBECONFIG=${HOME}/.kube/aks
# echo ${AKS_KUBECONFIG} | base64 -d > $KUBECONFIG
# if [[ -z "$AKS_KUBECONFIG" ]];then
# echo "skip deploy test since no valid KUBECONFIG"
# else
# DEBUG=true ./build/fx up -n hello -p 12345 examples/functions/JavaScript/func.js
# ./build/fx down hello
# rm ${KUBECONFIG}
# fi
Installation:
runs-on: ${{ matrix.os }}
needs: [Test]
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
# TODO enable window and mac
# - macOS-latest
# - windows-latest
version:
- latest
- v0.117.0
steps:
- name: Checkout
uses: actions/checkout@v1
- name: install fx
run: |
# install with non-root user
bash ./scripts/install.sh
./fx -v
# install with root
sudo bash ./scripts/install.sh
./fx -v

82
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
on: [push]
# schedule:
# - cron: '0 12 * * *'
name: docker
jobs:
Docker:
runs-on: ubuntu-latest
strategy:
matrix:
docker_version:
- 18.09
# - 19.03
# - 19.09
docker_channel:
- stable
# - test
steps:
- uses: actions/checkout@master
- name: setup docker
uses: docker-practice/actions-setup-docker@master
with:
docker_version: ${{ matrix.docker_version }}
docker_channel: ${{ matrix.docker_channel }}
- name: login docker hub
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- name: build and publish fx d image
if: always()
run: |
docker build -t metrue/fx-d-base:latest -f ./assets/dockerfiles/base/d/Dockerfile ./assets/dockerfiles/base/d
docker push metrue/fx-d-base:latest
- name: build and publish fx go image
run: |
docker build -t metrue/fx-go-base:latest -f ./assets/dockerfiles/base/go/Dockerfile ./assets/dockerfiles/base/go
docker push metrue/fx-go-base:latest
- name: build and publish fx node image
if: always()
run: |
docker build -t metrue/fx-node-base:latest -f ./assets/dockerfiles/base/node/Dockerfile ./assets/dockerfiles/base/node
docker push metrue/fx-node-base:latest
- name: build and publish fx python image
if: always()
run: |
docker build -t metrue/fx-python-base:latest -f ./assets/dockerfiles/base/python/Dockerfile ./assets/dockerfiles/base/python
- name: publish fx python image
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
docker push metrue/fx-python-base:latest
- name: build and publish fx perl image
if: always()
run: |
docker build -t metrue/fx-perl-base:latest -f ./assets/dockerfiles/base/perl/Dockerfile ./assets/dockerfiles/base/perl
docker push metrue/fx-perl-base:latest
- name: build and publish fx julia image
if: always()
run: |
docker build -t metrue/fx-julia-base:latest -f ./assets/dockerfiles/base/julia/Dockerfile ./assets/dockerfiles/base/julia
docker push metrue/fx-julia-base:latest
- name: build and publish fx crystal image
if: always()
run: |
docker build -t metrue/fx-crystal-base:latest -f ./assets/dockerfiles/base/crystal/Dockerfile ./assets/dockerfiles/base/crystal
docker push metrue/fx-crystal-base:latest
- name: build and publish fx php image
if: always()
run: |
docker build -t metrue/fx-php-base:latest -f ./assets/dockerfiles/base/php/Dockerfile ./assets/dockerfiles/base/php
docker push metrue/fx-php-base:latest

105
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,105 @@
on:
push:
branches:
- '*--auto-release'
- master
- production
name: release
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: setup Go 1.12
uses: actions/setup-go@v1
with:
go-version: 1.12
id: go
- name: check out
uses: actions/checkout@master
- name: kind create a k8s cluster
run: |
kind create cluster
# - name: lint
# run: |
# docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint \
# golangci-lint run -v
- name: unit test
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
# export KUBECONFIG="$(kind get kubeconfig-path)"
make unit-test
- name: build fx
run: |
make build
- name: test fx cli
run: |
echo $KUBECONFIG
unset KUBECONFIG
make cli-test
- name: test AKS
env:
AKS_KUBECONFIG: ${{ secrets.AKS_KUBECONFIG }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "skip since aks environment not ready yet"
# export KUBECONFIG=${HOME}/.kube/aks
# echo ${AKS_KUBECONFIG} | base64 -d > $KUBECONFIG
# DEBUG=true ./build/fx up -n hello -p 12345 examples/functions/JavaScript/func.js
# ./build/fx down hello
# rm ${KUBECONFIG}
Release:
runs-on: ${{ matrix.os }}
needs: [Test]
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - macOS-latest
# - windows-latest
version:
- latest
# - v0.117.0
steps:
- name: setup Go
uses: actions/setup-go@v1
with:
go-version: '1.12'
- name: checkout
uses: actions/checkout@v1
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
run: |
git config --global user.email "h.minghe@gmail.com"
git config --global user.name "Minghe Huang"
commit=$(git rev-parse --short HEAD)
version=$(cat fx.go| grep 'const version' | awk -F'"' '{print $2}')
echo "workflow is running on branch ${GITHUB_REF}"
if [[ ${GITHUB_REF} == "refs/heads/master" ]];then
version=${version}-alpha.${commit}
echo "alpha release $version"
elif [[ "${GITHUB_REF}" == *--auto-release ]];then
version=${version}-alpha.${commit}
echo "alpha release $version"
elif [[ ${GITHUB_REF} == "refs/heads/production" ]];then
echo "official release $version"
else
echo "skip release on $GITHUB_REF"
exit 0
fi
git tag -a ${version} -m "auto release"
curl -sL https://git.io/goreleaser | bash -s -- --skip-validate

8
.gitignore vendored
View File

@@ -3,4 +3,10 @@ vendor/
dist/
build/
*.pyc
fx
*.swp
/fx
/tmp
/api/google
/api/fx.pb.gw.go
/api/fx.pb.go
/coverage.txt

32
.golangci.yml Normal file
View File

@@ -0,0 +1,32 @@
run:
deadline: 20m
timeout: 20m
issues-exit-code: 1
tests: true
skip-dirs:
- examples
- api/images
- test/functions
- assets/
- bundler/go/assets
linters:
enable:
- goimports
- stylecheck
- gosec
- interfacer
- unconvert
- goconst
- gocyclo
- misspell
- unparam
issues:
exclude-rules:
- path: _test\.go
linters:
- gocyclo
- goconst
- errcheck
- dupl
- gosec

View File

@@ -1,3 +1,6 @@
---
env:
- GO111MODULE=on
builds:
- main: fx.go
binary: fx
@@ -8,26 +11,24 @@ builds:
goarch:
- amd64
# Archive customization
archive:
format: tar.gz
replacements:
amd64: 64-bit
darwin: macOS
linux: Tux
files:
- README.md
brew:
github:
owner: metrue
name: homebrew-fx
commit_author:
name: metrue
email: h.minghe@gmail.com
folder: Formula
caveats: ""
homepage: "https://github.com/metrue/fx"
description: "fx, a simple but powerful Function as a Service build tools"
dependencies:
- git
- zsh
archives:
-
format: tar.gz
replacements:
amd64: 64-bit
darwin: macOS
linux: Tux
files:
- README.md
brews:
- homepage: "https://github.com/metrue/fx"
description: "fx, a simple but powerful Function as a Service build tools"
folder: Formula
commit_author:
name: metrue
email: h.minghe@gmail.com
tap:
owner: metrue
name: homebrew-fx
dependencies:
- docker

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at H.Minghe@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

81
Gopkg.lock generated
View File

@@ -1,81 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/Microsoft/go-winio"
packages = ["."]
revision = "78439966b38d69bf38227fbf57ac8a6fee70f69a"
version = "v0.4.5"
[[projects]]
name = "github.com/docker/distribution"
packages = ["digest","reference"]
revision = "48294d928ced5dd9b378f7fd7c6f5da3ff3f2c89"
version = "v2.6.2"
[[projects]]
name = "github.com/docker/docker"
packages = ["api/types","api/types/blkiodev","api/types/container","api/types/events","api/types/filters","api/types/mount","api/types/network","api/types/reference","api/types/registry","api/types/strslice","api/types/swarm","api/types/time","api/types/versions","api/types/volume","client","pkg/tlsconfig"]
revision = "092cba3727bb9b4a2f0e922cd6c0f93ea270e363"
version = "v1.13.1"
[[projects]]
name = "github.com/docker/go-connections"
packages = ["nat","sockets","tlsconfig"]
revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d"
version = "v0.3.0"
[[projects]]
name = "github.com/docker/go-units"
packages = ["."]
revision = "0dadbb0345b35ec7ef35e228dabb8de89a65bf52"
version = "v0.3.2"
[[projects]]
name = "github.com/gorilla/websocket"
packages = ["."]
revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
version = "v1.2.0"
[[projects]]
branch = "master"
name = "github.com/jhoonb/archivex"
packages = ["."]
revision = "be4efa7ec0c38ab76d56037014c90d48d6b13037"
[[projects]]
name = "github.com/phayes/freeport"
packages = ["."]
revision = "b8543db493a5ed890c5499e935e2cad7504f3a04"
version = "1.0.2"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]]
name = "github.com/rs/xid"
packages = ["."]
revision = "02dd45c33376f85d1064355dc790dcc4850596b1"
version = "v1.1"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = ["context","context/ctxhttp","proxy"]
revision = "9dfe39835686865bff950a07b394c12a98ddc811"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["windows"]
revision = "0ac51a24ef1c37380f98ba8b98f56e3bffd59850"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "f39bdc99a6e57f902cb0bbb772098222008d68464eac29614370e04d9080c8b0"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -1,43 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
[[constraint]]
name = "github.com/docker/docker"
[[constraint]]
name = "github.com/docker/go-connections"
[[constraint]]
name = "github.com/gorilla/websocket"
[[constraint]]
name = "github.com/jhoonb/archivex"
[[constraint]]
name = "github.com/metrue/fx"
[[constraint]]
name = "github.com/phayes/freeport"
[[constraint]]
name = "github.com/rs/xid"

View File

@@ -1,15 +1,69 @@
OUTPUT_DIR=./build
DIST_DIR=./dist
OUTPUT_DIR ?=./build
DIST_DIR ?=./dist
DOCKER_REMOTE_HOST_ADDR ?= "127.0.0.1"
DOCKER_REMOTE_HOST_USER ?= $(whoami)
lint:
docker pull golangci/golangci-lint
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint golangci-lint run -v
generate:
go get -u github.com/gobuffalo/packr/v2/...
go get -u github.com/gobuffalo/packr/v2/packr2
packr2
b:
go build -ldflags="-s -w" -o ${OUTPUT_DIR}/fx fx.go
install-deps:
@dep ensure
build:
go build -o ${OUTPUT_DIR}/fx fx.go
cross:
go build -ldflags="-s -w" -o ${OUTPUT_DIR}/fx fx.go
pull:
./scripts/pull.sh
cross: generate
goreleaser --snapshot --skip-publish --skip-validate
release:
goreleaser --skip-validate
clean:
rm -rf ${OUTPUT_DIR}
rm -rf ${DIST_DIR}
.PHONY: test build start list clean
unit-test:
./scripts/coverage.sh
cli-test-ci:
./scripts/test_cli.sh 'js'
cli-test:
./scripts/test_cli.sh 'js rb py go java d pl php'
http-test:
./scripts/http_test.sh
zip:
zip -r images.zip images/
.PHONY: test build start list clean generate
start_docker_infra:
docker build -t fx-docker-infra -f test/Dockerfile ./test
docker run --rm --name fx-docker-infra -p 2222:22 -v /var/run/docker.sock:/var/run/docker.sock -d fx-docker-infra
test_docker_infra:
CICD=true SSH_PORT=2222 SSH_KEY_FILE=./test/id_rsa ./build/fx infra create --name docker-local -t docker --host root@127.0.0.1
stop_docker_infra:
docker stop fx-docker-infra
start_k3s_infra:
multipass launch --name k3s-master --cpus 1 --mem 512M --disk 3G --cloud-init ./test/k3s/ssh-cloud-init.yaml
multipass launch --name k3s-worker1 --cpus 1 --mem 512M --disk 3G --cloud-init ./test/k3s/ssh-cloud-init.yaml
multipass launch --name k3s-worker2 --cpus 1 --mem 512M --disk 3G --cloud-init ./test/k3s/ssh-cloud-init.yaml
test_k3s_infra:
./scripts/test_k3s_infra.sh
stop_k3s_infra:
multipass delete k3s-master
multipass delete k3s-worker1
multipass delete k3s-worker2
multipass purge

323
README.md
View File

@@ -3,148 +3,222 @@ fx
Poor man's function as a service.
<br/>
![build](https://circleci.com/gh/metrue/fx.svg?style=svg&circle-token=bd62abac47802f8504faa4cf8db43e4f117e7cd7)
![CI](https://github.com/metrue/fx/workflows/ci/badge.svg)
![GitHub contributors](https://img.shields.io/github/contributors/metrue/fx)
[![CodeCov](https://codecov.io/gh/metrue/fx/branch/master/graph/badge.svg)](https://codecov.io/gh/metrue/fx)
[![Go Report Card](https://goreportcard.com/badge/github.com/metrue/fx?style=flat-square)](https://goreportcard.com/report/github.com/metrue/fx)
[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/metrue/fx)
![](https://img.shields.io/github/license/metrue/fx.svg)
![visitors](https://visitor-badge.glitch.me/badge?page_id=https://github.com/metrue/fx)
![liscense](https://img.shields.io/github/license/metrue/fx.svg)
[![Release](https://img.shields.io/github/release/metrue/fx.svg?style=flat-square)](https://github.com/metrue/fx/releases/latest)
### Introduction
## Table of Contents
- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
fx is a tool to help you do Function as a Service on your own server. fx can make your stateless function a service in seconds. The most exciting thing is that you can write your functions with most programming languages.
## Introduction
| Language | Status | Contributor |
| ------------- |:-------------:|:-------------:|
| Go | Supported | fx |
| Node | Supported | fx |
| Python | Supported | fx |
| Ruby | Supported | fx |
| PHP | Supported | [@chlins](https://github.com/chlins)|
| Julia | Supported | [@mbesancon](https://github.com/mbesancon)|
| Java | No | |
| Scala | No | |
| Perl | Working on | |
| .Net | Working on | |
| R | Working on | |
| Rust | Working on | |
fx is a tool to help you do Function as a Service on your own server, fx can make your stateless function a service in seconds, both Docker host and Kubernetes cluster supported. The most exciting thing is that you can write your functions with most programming languages.
tweet [@_metrue](https://twitter.com/_metrue) or issue is welcome.
Feel free hacking fx to support the languages not listed. Welcome to tweet me [@_metrue](https://twitter.com/_metrue) on Twitter, [@metrue](https://www.weibo.com/u/2165714507) on Weibo.
### Usage
##### Requirements
* Docker: make sure [Docker](https://docs.docker.com/engine/installation/) installed and running on your server.
* dep: fx project uses [dep](https://github.com/golang/dep) to do the golang dependency management.
| Language | Status | Contributor | Example |
| ------------- |:-------------:|:-------------:| :-------------:|
| Go | Supported | fx | [/examples/Golang](https://github.com/metrue/fx/tree/master/examples/functions/Golang) |
| Rust | Supported | [@FrontMage](https://github.com/FrontMage)| [/examples/Rust](https://github.com/metrue/fx/tree/master/examples/functions/Rust) |
| Node | Supported | fx | [/examples/JavaScript](https://github.com/metrue/fx/tree/master/examples/functions/JavaScript) |
| Python | Supported | fx | [/examples/Python](https://github.com/metrue/fx/tree/master/examples/functions/Python) |
| Ruby | Supported | fx | [/examples/Ruby](https://github.com/metrue/fx/tree/master/examples/functions/Ruby) |
| Java | Supported | fx | [/examples/Java](https://github.com/metrue/fx/tree/master/examples/functions/Java) |
| PHP | Supported | [@chlins](https://github.com/chlins)| [/examples/PHP](https://github.com/metrue/fx/tree/master/examples/functions/PHP) |
| Julia | Supported | [@matbesancon](https://github.com/matbesancon)| [/examples/Julia](https://github.com/metrue/fx/tree/master/examples/functions/Julia) |
| D | Supported | [@andre2007](https://github.com/andre2007)| [/examples/D](https://github.com/metrue/fx/tree/master/examples/functions/D) |
| Perl | Supported | fx | [/examples/Perl](https://github.com/metrue/fx/tree/master/examples/functions/Perl) |
| Crystal | Supported | [@mvrilo](https://github.com/mvrilo) | [/examples/Crystal](https://github.com/metrue/fx/tree/master/examples/functions/Crystal) |
| R | Working on [need your help](https://github.com/metrue/fx/issues/31) | ||
##### Build and Run
# Installation
Binaries are available for Windows, MacOS and Linux/Unix on x86. For other architectures and platforms, follow instructions to [build fx from source](#buildtest).
* MacOS
```
$ git clone https://github.com/metrue/fx.git
$ cd fx
$ dep ensure
$ go install ./
brew tap metrue/homebrew-fx
brew install metrue/fx/fx
```
* start server
* Linux/Unix
```
fx serve
via cURL
```shell
# Install to local directory
curl -o- https://raw.githubusercontent.com/metrue/fx/master/scripts/install.sh | bash
# Install to /usr/local/bin/
curl -o- https://raw.githubusercontent.com/metrue/fx/master/scripts/install.sh | sudo bash
```
now you can make a function to service in a second.
fx will be installed into /usr/local/bin, sometimes you may need `source ~/.zshrc` or `source ~/.bashrc` to make fx available in `$PATH`.
* Windows
You can go the release page to [download](https://github.com/metrue/fx/releases) fx manually;
## Usage
```
fx up ./examples/functions/func.js
NAME:
fx - makes function as a service
USAGE:
fx [global options] command [command options] [arguments...]
COMMANDS:
up deploy a function
down destroy a service
list, ls list deployed services
image manage image of service
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
```
the function defined in *examples/functions/func.js* is quite simple, it calculates the sum of two numbers then returns:
### Deploy function
#### Local Docker environment
By default, function will be deployed on localhost make sure [Docker](https://docs.docker.com/engine/installation/) installed and running on your server first. then type `fx -h` on your terminal to check out basic help.
```
module.exports = (input) => {
return parseInt(input.a, 10) + parseInt(input.b, 10)
}
$ fx up --name hello ./examples/functions/JavaScript/func.js
+------------------------------------------------------------------+-----------+---------------+
| ID | NAME | ENDPOINT |
+------------------------------------------------------------------+-----------+---------------+
| 5b24d36608ee392c937a61a530805f74551ddec304aea3aca2ffa0fabcf98cf3 | /hello | 0.0.0.0:58328 |
+------------------------------------------------------------------+-----------+---------------+
```
#### Remote host
Use `--host` to specify the target host for your function, or you can just set it to `FX_HOST` environment variable.
```shell
$ fx up --host roo@<your host> --name hello ./examples/functions/JavaScript/func.js
+------------------------------------------------------------------+-----------+---------------+
| ID | NAME | ENDPOINT |
+------------------------------------------------------------------+-----------+---------------+
| 5b24d36608ee392c937a61a530805f74551ddec304aea3aca2ffa0fabcf98cf3 | /hello | 0.0.0.0:58345 |
+------------------------------------------------------------------+-----------+---------------+
```
#### Kubernetes
```
$ FX_KUBECONF=~/.kube/config fx up examples/functions/JavaScript/func.js --name hello
+-------------------------------+------+----------------+
| ID | NAME | ENDPOINT |
+----+--------------------------+-----------------------+
| 5b24d36608ee392c937a | hello-fx | 10.0.242.75:80 |
+------------------------+-------------+----------------+
```
### Test service
then you can test your service:
```
curl -X POST <service url> -H "Content-Type: application/json" -d '{"a": 1, "b": 1}'
```shell
$ curl -v 0.0.0.0:58328
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: 0.0.0.0:10001
User-Agent: HTTPie/1.0.2
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Sat, 10 Aug 2019 05:28:03 GMT
hello world
```
of course you can do more.
```
Usage:
$ fx serve start f(x) server
$ fx up func1.js func2.py func3.go ... deploy a function or a group of functions
$ fx down [service ID] ... destroy a function or a group of functions
$ fx list list deployed services
$ fx --version show current version of f(x)
## Use Public Cloud Kubernetes Service as infrastructure to run your functions
* Azure Kubernetes Service (AKS)
You should create a Kubernetes cluster if you don't have one on AKS, detail document can found [here](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough).
```shell
$ az group create --name <myResourceGroup> --location eastus
$ az aks create --resource-group <myResourceGroup> --name myAKSCluster --node-count <count>
$ az aks get-credentials --resource-group <myResourceGroup> --name <myAKSCluster>
```
#### How to write your function
Then you can verify it with `kubectl`,
functions example with Go, Ruby, Python, Node, PHP.
```shell
$ kubectl get nodes
* Go
```
package main
type Input struct {
A int32
B int32
}
type Output struct {
Sum int32
}
func Fx(input *Input) (output *Output) {
output = &Output{
Sum: input.A + input.B,
}
return
}
NAME STATUS ROLES AGE VERSION
aks-nodepool1-31718369-0 Ready agent 6m44s v1.12.8
```
* Ruby
```
def fx(input)
return input['a'] + input['b']
end
Since AKS's config will be merged into `~/.kube/config` and set to be current context after you run `az aks get-credentials` command, so you can just set KUBECONFIG to default config also,
```shell
$ export FX_KUBECONF=~/.kube/config # then fx will take the config to deloy function
```
* Python
```
def fx(input):
return input['a'] + input['b']
But we would suggest you run `kubectl config current-context` to check if the current context is what you want.
* Amazon Elastic Kubernetes Service (EKS)
TODO
* Google Kubernetes Engine (GKE)
First you should create a Kubernetes cluster in your GKE, then make sure your KUBECONFIG is ready in `~/.kube/config`, if not, you can run following commands,
``` shell
$ gcloud auth login
$ gcloud container clusters get-credentials <your cluster> --zone <zone> --project <project>
```
* Node
```
module.exports = (input) => {
return parseInt(input.a, 10) + parseInt(input.b, 10)
}
Then make sure you current context is GKE cluster, you can check it with command,
``` shell
$ kubectl config current-context
```
* PHP
```
<?php
function Fx($input) {
return $input["a"]+$input["b"];
}
Then you can deploy your function onto GKE cluster with,
```shell
$ FX_KUBECONF=~/.kube/config fx up examples/functions/JavaScript/func.js --name hellojs
```
* Julia
```
struct Input
a::Number
b::Number
end
* Setup your own Kubernetes cluster
fx = function(input::Input)
return input.a + input.b
end
```shell
fx infra create --type k3s --name fx-cluster-1 --master root@123.11.2.3 --agents 'root@1.1.1.1,root@2.2.2.2'
```
### Contributors
## Contributors
Thank you to all the people who already contributed to fx!
@@ -154,25 +228,54 @@ Thank you to all the people who already contributed to fx!
<a href="https://github.com/metrue" target="_blank">
<img alt="metrue" src="https://avatars2.githubusercontent.com/u/1001246?v=4&s=50" width="50">
</a>
<a href="https://github.com/muka" target="_blank">
<img alt="muka" src="https://avatars2.githubusercontent.com/u/1021269?v=4&s=50" width="50">
</a>
<a href="https://github.com/pplam" target="_blank">
<img alt="pplam" src="https://avatars2.githubusercontent.com/u/12783579?v=4&s=50" width="50">
</a>
<a href="https://github.com/mbesancon" target="_blank">
<img alt="mbesancon" src="https://avatars2.githubusercontent.com/u/7623090?v=4&s=50" width="50">
</a>
<a href="https://github.com/avelino" target="_blank">
<img alt="avelino" src="https://avatars2.githubusercontent.com/u/31996?v=4&s=50" width="50">
</a>
<a href="https://github.com/DaidoujiChen" target="_blank">
<img alt="DaidoujiChen" src="https://avatars0.githubusercontent.com/u/670441?v=4&s=50" width="50">
<a href="https://github.com/matbesancon" target="_blank">
<img alt="mbesancon" src="https://avatars2.githubusercontent.com/u/7623090?s=60&v=4" width="50">
</a>
<a href="https://github.com/chlins" target="_blank">
<img alt="chlins" src="https://avatars2.githubusercontent.com/u/31262637?v=4&s=50" width="50">
</a>
<a href="https://github.com/xwjdsh" target="_blank">
<img alt="xwjdsh" src="https://avatars2.githubusercontent.com/u/11025519?v=4&s=50" width="50">
</a>
<a href="https://github.com/DaidoujiChen" target="_blank">
<img alt="DaidoujiChen" src="https://avatars0.githubusercontent.com/u/670441?v=4&s=50" width="50">
</a>
<a href="https://github.com/avelino" target="_blank">
<img alt="avelino" src="https://avatars2.githubusercontent.com/u/31996?v=4&s=50" width="50">
</a>
<a href="https://github.com/andre2007" target="_blank">
<img alt="andre2007" src="https://avatars1.githubusercontent.com/u/1451047?s=50&v=4" width="50">
</a>
<a href="https://github.com/polyrabbit" target="_blank">
<img alt="polyrabbit" src="https://avatars0.githubusercontent.com/u/2657334?s=60&v=4" width="50">
</a>
<a href="https://github.com/johnlunney" target="_blank">
<img alt="johnlunney" src="https://avatars3.githubusercontent.com/u/536947?s=60&v=4" width="50">
</a>
<a href="https://github.com/tbrand" target="_blank">
<img alt="tbrand" src="https://avatars0.githubusercontent.com/u/3483230?s=60&v=4" width="50">
</a>
<a href="https://github.com/steventhanna" target="_blank">
<img alt="andre2007" src="https://avatars1.githubusercontent.com/u/2541678?s=50&v=4" width="50">
</a>
<a href="https://github.com/border-radius" target="_blank">
<img alt="border-radius" src="https://avatars0.githubusercontent.com/u/3204785?s=60&v=4" width="50">
</a>
<a href="https://github.com/Russtopia" target="_blank">
<img alt="Russtopia" src="https://avatars1.githubusercontent.com/u/2966177?s=60&v=4<Paste>" width="50">
</a>
<a href="https://github.com/FrontMage" target="_blank">
<img alt="FrontMage" src="https://avatars2.githubusercontent.com/u/17007026?s=60&v=4" width="50">
</a>
<a href="https://github.com/DropNib" target="_blank">
<img alt="DropNib" src="https://avatars0.githubusercontent.com/u/32019589?s=60&v=4" width="50">
</a>
</tr>
</tbody>
</table>
### LICENSE
MIT

View File

@@ -0,0 +1,7 @@
FROM crystallang/crystal:latest
WORKDIR /fx
COPY . /fx
RUN shards install

View File

@@ -0,0 +1,18 @@
version: 2.0
shards:
exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.1.4
kemal:
git: https://github.com/kemalcr/kemal.git
version: 0.26.1
kilt:
git: https://github.com/jeromegn/kilt.git
version: 0.4.0
radix:
git: https://github.com/luislavena/radix.git
version: 0.3.9

View File

@@ -0,0 +1,6 @@
name: fx-crystal-base
version: 0.1.0
dependencies:
kemal:
github: kemalcr/kemal
commit: a819d4792bbc63d993d6dd2b15f9af5efb0c2d8c

5
assets/dockerfiles/base/d/Dockerfile vendored Normal file
View File

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

4
assets/dockerfiles/base/go/Dockerfile vendored Normal file
View File

@@ -0,0 +1,4 @@
FROM golang:1.15
# dependency management
RUN go get github.com/gin-gonic/gin

12
assets/dockerfiles/base/java/Dockerfile vendored Normal file
View File

@@ -0,0 +1,12 @@
FROM java:8
# Install maven
RUN apt-get update
RUN apt-get install -y maven
WORKDIR /code
# Prepare by downloading dependencies
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]

3
assets/dockerfiles/base/java/Makefile vendored Normal file
View File

@@ -0,0 +1,3 @@
build:
docker build -t metrue/fx-java-base:latest .
docker push metrue/fx-java-base

51
assets/dockerfiles/base/java/pom.xml vendored Normal file
View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>fx-app-java</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>fx.app</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,3 @@
FROM julia:latest
RUN apt-get update && apt-get install -y gcc apt-utils unzip make libhttp-parser-dev

View File

@@ -0,0 +1,3 @@
build:
docker build -t metrue/fx-julia-base:latest .
docker push metrue/fx-julia-base

View File

@@ -0,0 +1,4 @@
FROM node:alpine
COPY . .
RUN npm install

836
assets/dockerfiles/base/node/package-lock.json generated vendored Normal file
View File

@@ -0,0 +1,836 @@
{
"name": "fx-node-base",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@koa/cors": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@koa/cors/-/cors-2.2.3.tgz",
"integrity": "sha512-tCVVXa39ETsit5kGBtEWWimjLn1sDaeu8+0phgb8kT3GmBDZOykkI3ZO8nMjV2p3MGkJI4K5P+bxR8Ztq0bwsA==",
"requires": {
"vary": "^1.1.2"
}
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"ajv": {
"version": "6.12.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
"integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8="
},
"asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
"requires": {
"safer-buffer": "~2.1.0"
}
},
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
},
"aws4": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz",
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
},
"basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
"requires": {
"safe-buffer": "5.1.2"
}
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
"requires": {
"tweetnacl": "^0.14.3"
}
},
"bintrees": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.1.tgz",
"integrity": "sha1-DmVcm5wkNeqraL9AJyJtK1WjRSQ="
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"cache-content-type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz",
"integrity": "sha512-IKufZ1o4Ut42YUrZSo8+qnMTrFuKkvyoLXUywKz9GJ5BrhOFGhLdkx9sG4KAnVvbY6kEcSFjLQul+DVmBm2bgA==",
"requires": {
"mime-types": "^2.1.18",
"ylru": "^1.2.0"
}
},
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
},
"co-body": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/co-body/-/co-body-6.0.0.tgz",
"integrity": "sha512-9ZIcixguuuKIptnY8yemEOuhb71L/lLf+Rl5JfJEUiDNJk0e02MBt7BPxR2GEh5mw8dPthQYR4jPI/BnS1MQgw==",
"requires": {
"inflation": "^2.0.0",
"qs": "^6.5.2",
"raw-body": "^2.3.3",
"type-is": "^1.6.16"
}
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"requires": {
"safe-buffer": "5.1.2"
}
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookies": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz",
"integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==",
"requires": {
"depd": "~2.0.0",
"keygrip": "~1.1.0"
}
},
"copy-to": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz",
"integrity": "sha1-JoD7uAaKSNCGVrYJgJK9r8kG9KU="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"requires": {
"assert-plus": "^1.0.0"
}
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"deep-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
},
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
"requires": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express-to-koa": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/express-to-koa/-/express-to-koa-2.0.0.tgz",
"integrity": "sha512-71zECby9NZHFGQ+kD+cJ5VaNUdCUw3oXkSC6PCmKxxfyVA11mVQCfwQqb7VjBmQbIJ2WNeiAeTOj7M5EqrMlOQ=="
},
"extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA=="
},
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"get-port": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz",
"integrity": "sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw="
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"requires": {
"assert-plus": "^1.0.0"
}
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
},
"har-validator": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
"requires": {
"ajv": "^6.5.5",
"har-schema": "^2.0.0"
}
},
"http-assert": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/http-assert/-/http-assert-1.4.1.tgz",
"integrity": "sha512-rdw7q6GTlibqVVbXr0CKelfV5iY8G2HqEUkhSk297BMbSpSL8crXC+9rjKoMcZZEsksX30le6f/4ul4E28gegw==",
"requires": {
"deep-equal": "~1.0.1",
"http-errors": "~1.7.2"
}
},
"http-errors": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
"integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
},
"dependencies": {
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
}
}
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"requires": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inflation": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz",
"integrity": "sha1-i0F+R8KPklpFEz2RTKH9OJEH8w8="
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"is-generator-function": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz",
"integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw=="
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"keygrip": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz",
"integrity": "sha512-iYSchDJ+liQ8iwbSI2QqsQOvqv58eJCEanyJPJi+Khyu8smkcKSFUCbPwzFcL7YVtZ6eONjqRX/38caJ7QjRAQ==",
"requires": {
"tsscmp": "1.0.6"
}
},
"koa": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/koa/-/koa-2.13.0.tgz",
"integrity": "sha512-i/XJVOfPw7npbMv67+bOeXr3gPqOAw6uh5wFyNs3QvJ47tUx3M3V9rIE0//WytY42MKz4l/MXKyGkQ2LQTfLUQ==",
"requires": {
"accepts": "^1.3.5",
"cache-content-type": "^1.0.0",
"content-disposition": "~0.5.2",
"content-type": "^1.0.4",
"cookies": "~0.8.0",
"debug": "~3.1.0",
"delegates": "^1.0.0",
"depd": "^1.1.2",
"destroy": "^1.0.4",
"encodeurl": "^1.0.2",
"escape-html": "^1.0.3",
"fresh": "~0.5.2",
"http-assert": "^1.3.0",
"http-errors": "^1.6.3",
"is-generator-function": "^1.0.7",
"koa-compose": "^4.1.0",
"koa-convert": "^1.2.0",
"on-finished": "^2.3.0",
"only": "~0.0.2",
"parseurl": "^1.3.2",
"statuses": "^1.5.0",
"type-is": "^1.6.16",
"vary": "^1.1.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"koa-bodyparser": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-4.3.0.tgz",
"integrity": "sha512-uyV8G29KAGwZc4q/0WUAjH+Tsmuv9ImfBUF2oZVyZtaeo0husInagyn/JH85xMSxM0hEk/mbCII5ubLDuqW/Rw==",
"requires": {
"co-body": "^6.0.0",
"copy-to": "^2.0.1"
}
},
"koa-compose": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz",
"integrity": "sha512-8ODW8TrDuMYvXRwra/Kh7/rJo9BtOfPc6qO8eAfC80CnCvSjSl0bkRM24X6/XBBEyj0v1nRUQ1LyOy3dbqOWXw=="
},
"koa-convert": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/koa-convert/-/koa-convert-1.2.0.tgz",
"integrity": "sha1-2kCHXfSd4FOQmNFwC1CCDOvNIdA=",
"requires": {
"co": "^4.6.0",
"koa-compose": "^3.0.0"
},
"dependencies": {
"koa-compose": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-3.2.1.tgz",
"integrity": "sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=",
"requires": {
"any-promise": "^1.1.0"
}
}
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.44.0"
}
},
"moment": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.26.0.tgz",
"integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"only": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/only/-/only-0.0.2.tgz",
"integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path-to-regexp": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.1.0.tgz",
"integrity": "sha512-h9DqehX3zZZDCEm+xbfU0ZmwCGFCAAraPJWMXJ4+v32NjZJilVg3k1TcKsRgIb8IQ/izZSaydDc1OhJCZvs2Dw=="
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"prom-client": {
"version": "11.5.3",
"resolved": "https://registry.npmjs.org/prom-client/-/prom-client-11.5.3.tgz",
"integrity": "sha512-iz22FmTbtkyL2vt0MdDFY+kWof+S9UB/NACxSn2aJcewtw+EERsen0urSkZ2WrHseNdydsvcxCTAnPcSMZZv4Q==",
"requires": {
"tdigest": "^0.1.1"
}
},
"psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"qs": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
},
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raw-body": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz",
"integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==",
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.3",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
},
"dependencies": {
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
"requires": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
}
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"swagger-stats": {
"version": "0.95.17",
"resolved": "https://registry.npmjs.org/swagger-stats/-/swagger-stats-0.95.17.tgz",
"integrity": "sha512-3p+sWzWpxWES5SAM6GeKa6jWrMvh5gmczKdscdmOl4e6n9e4gfz0HioBZQqRgdLKgRR2ZeSR4f7+e3mMjqcEhQ==",
"requires": {
"basic-auth": "^2.0.1",
"cookies": "^0.8.0",
"debug": "^4.1.1",
"moment": "^2.24.0",
"path-to-regexp": "^6.1.0",
"prom-client": "^11.5.3",
"qs": "^6.9.1",
"request": "^2.88.0",
"send": "^0.17.1",
"uuid": "^3.4.0"
}
},
"tdigest": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz",
"integrity": "sha1-Ljyyw56kSeVdHmzZEReszKRYgCE=",
"requires": {
"bintrees": "1.0.1"
}
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"requires": {
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
},
"tsscmp": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz",
"integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA=="
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "^5.0.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"requires": {
"punycode": "^2.1.0"
}
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"requires": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
},
"ylru": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz",
"integrity": "sha512-faQrqNMzcPCHGVC2aaOINk13K+aaBDUPjGWl0teOXywElLjyVAB6Oe2jj62jHYtwsU49jXhScYbvPENK+6zAvQ=="
}
}
}

View File

@@ -0,0 +1,22 @@
{
"name": "fx-node-base",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@koa/cors": "^2.2.3",
"express-to-koa": "^2.0.0",
"get-port": "^3.2.0",
"is-generator-function": "^1.0.6",
"koa": "^2.3.0",
"koa-bodyparser": "^4.2.0",
"node-fetch": "^2.6.1",
"swagger-stats": "^0.95.17"
}
}

10
assets/dockerfiles/base/perl/Dockerfile vendored Normal file
View File

@@ -0,0 +1,10 @@
FROM alpine:3.4
MAINTAINER Mojolicious
ADD . .
COPY cpanfile /
ENV EV_EXTRA_DEFS -DEV_NO_ATFORK
RUN apk update && \
apk add perl perl-io-socket-ssl perl-dbd-pg perl-dev g++ make wget curl && \
curl -L https://cpanmin.us | perl - App::cpanminus && cpanm --installdeps . -M https://cpan.metacpan.org

3
assets/dockerfiles/base/perl/cpanfile vendored Normal file
View File

@@ -0,0 +1,3 @@
requires "EV";
requires "JSON";
requires "Mojolicious::Lite";

View File

@@ -0,0 +1 @@
FROM php:latest

View File

@@ -3,6 +3,3 @@ FROM python:3
RUN pip install flask
ENV FLASK_APP=app.py
COPY . .
EXPOSE 3000
CMD flask run -h 0.0.0.0 -p 3000

View File

@@ -0,0 +1,3 @@
FROM ruby:latest
RUN gem install sinatra

1262
assets/dockerfiles/base/rust/Cargo.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

13
assets/dockerfiles/base/rust/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,13 @@
[package]
name = "rust"
version = "0.1.0"
authors = ["FrontMage <xbgxwh@outlook.com>"]
edition = "2018"
[dependencies]
rocket = "0.4.5"
rocket_contrib = "0.4.5"
serde_json = "1.0"
serde_derive = "1.0.70"
serde = "1.0.70"

12
assets/dockerfiles/base/rust/Dockerfile vendored Normal file
View File

@@ -0,0 +1,12 @@
FROM clux/muslrust:nightly AS builder
WORKDIR /build
COPY . .
RUN ln -s /usr/bin/g++ /usr/bin/musl-g++ && cargo build --release
FROM scratch
WORKDIR /usr/src/myapp
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/rust /usr/src/myapp/
COPY ./Rocket.toml /usr/src/myapp/
EXPOSE 3000
ENV ROCKET_ENV=prod
CMD ["/usr/src/myapp/rust"]

View File

@@ -0,0 +1,23 @@
[development]
address = "localhost"
port = 3000
workers = 8
keep_alive = 5
log = "normal"
limits = { forms = 32768 }
[staging]
address = "0.0.0.0"
port = 3000
workers = 8
keep_alive = 5
log = "normal"
limits = { forms = 32768 }
[production]
address = "0.0.0.0"
port = 3000
workers = 8
keep_alive = 5
log = "critical"
limits = { forms = 32768 }

6
assets/dockerfiles/base/rust/config vendored Normal file
View File

@@ -0,0 +1,6 @@
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

View File

@@ -0,0 +1,18 @@
pub mod fns {
#[derive(Serialize)]
pub struct Response {
pub result: i32,
}
#[derive(Deserialize, FromForm)]
pub struct Request {
pub a: i32,
pub b: i32,
}
pub fn func(req: Request) -> Response {
Response {
result: req.a + req.b,
}
}
}

View File

@@ -0,0 +1,28 @@
#![feature(proc_macro_hygiene, decl_macro, plugin)]
#[macro_use]
extern crate rocket;
extern crate rocket_contrib;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
mod fns;
use rocket::request::Form;
use rocket_contrib::json::Json;
#[get("/?<req..>")]
fn get(req: Form<fns::fns::Request>) -> Json<fns::fns::Response> {
Json(fns::fns::func(req.0))
}
#[post("/", format = "application/json", data = "<req>")]
fn post(req: Json<fns::fns::Request>) -> Json<fns::fns::Response> {
Json(fns::fns::func(req.0))
}
fn main() {
rocket::ignite().mount("/", routes![get, post]).launch();
}

50
bundle/bundle.go Normal file
View File

@@ -0,0 +1,50 @@
package bundle
import (
"fmt"
"github.com/metrue/fx/bundler"
"github.com/metrue/fx/bundler/crystal"
"github.com/metrue/fx/bundler/d"
golang "github.com/metrue/fx/bundler/go"
"github.com/metrue/fx/bundler/java"
"github.com/metrue/fx/bundler/julia"
"github.com/metrue/fx/bundler/node"
"github.com/metrue/fx/bundler/perl"
"github.com/metrue/fx/bundler/php"
"github.com/metrue/fx/bundler/python"
"github.com/metrue/fx/bundler/ruby"
"github.com/metrue/fx/bundler/rust"
)
// Bundle function to project
func Bundle(workdir string, language string, fn string, deps ...string) error {
var bundler bundler.Bundler
switch language {
case "d":
bundler = d.New()
case "node":
bundler = node.New()
case "go":
bundler = golang.New()
case "java":
bundler = java.New()
case "julia":
bundler = julia.New()
case "perl":
bundler = perl.New()
case "python":
bundler = python.New()
case "ruby":
bundler = ruby.New()
case "rust":
bundler = rust.New()
case "crystal":
bundler = crystal.New()
case "php":
bundler = php.New()
default:
return fmt.Errorf("%s not suppported yet", language)
}
return bundler.Bundle(workdir, fn, deps...)
}

117
bundle/bundler_test.go Normal file
View File

@@ -0,0 +1,117 @@
package bundle
import (
"io/ioutil"
"os"
"testing"
)
func createFn(content string, t *testing.T) string {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
return fd.Name()
}
func TestBundle(t *testing.T) {
workdir, err := ioutil.TempDir("", "fx-test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(workdir)
cases := []struct {
workdir string
language string
fn string
deps []string
}{
{
workdir: workdir,
language: "d",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "go",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "java",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "julia",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "perl",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "python",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "ruby",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
{
workdir: workdir,
language: "rust",
fn: `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}
`,
},
}
for _, c := range cases {
fn := createFn(c.fn, t)
defer os.Remove(fn)
if err := Bundle(c.workdir, c.language, fn, c.deps...); err != nil {
t.Fatal(err)
}
}
}

63
bundler/README.md Normal file
View File

@@ -0,0 +1,63 @@
The only thing `fx` does is to make a single function to be an HTTP service, `fx` takes two steps to finish the process,
* Wraps the function into a web server project and make it be the handler function of the HTTP request.
* Builds the bundled web server to be Docker image, then run it as a Docker container and expose the service port.
`bundler` is the component responsible for step 1: wrap a single function (and its dependencies) into a web server. Take a Node web service as an example, the project looks like this,
```
helloworld
├── Dockerfile
├── app.js
└── fx.js
```
And the codes is pretty simple,
**app.js**
```javascript
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const cors = require('@koa/cors');
const fx = require('./fx');
const app = new Koa();
app.use(cors({
origin: '*',
}));
app.use(bodyParser());
app.use(fx);
app.listen(3000);
```
**fx.js**
```javascript
module.exports = (ctx) => {
ctx.body = 'hello world'
}
```
**Dockerfile**
```dockerfile
FROM metrue/fx-node-base
COPY . .
EXPOSE 3000
CMD ["node", "app.js"]
```
You can see that it's a web service built with `Koa`, the request handler function defined in `fx.js` to response plain text `hello world`, so to make a general JavaScript/Node function to be a web service, we only have to put it into `fx.js` above, then build and run it with Docker and that's it.
To support different programming languages, `fx` needs to implement different `bundlers`, the reasons are,
* The way to set up a web service is different in different languages
* The way to manage dependency is different in different languages.
So there will be (are) different `bundlers` in `fx`.
```
go-bundler: based on Gin
ruby-bundler: based on Sinatra
node-bundler: based on Koa
python-bundler: based on flask
...
```

88
bundler/bundler.go Normal file
View File

@@ -0,0 +1,88 @@
package bundler
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/gobuffalo/packd"
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/constants"
"github.com/metrue/fx/utils"
)
// Bundler defines interface
type Bundler interface {
Scaffold(output string) error
Bundle(output string, fn string, deps ...string) error
}
// IsHandler check if it's handle file
func IsHandler(name string, lang string) bool {
basename := filepath.Base(name)
nameWithoutExt := strings.TrimSuffix(basename, filepath.Ext(basename))
if constants.ExtLangMapping[filepath.Ext(basename)] != lang {
return false
}
return (nameWithoutExt == "fx" ||
// Fx is for Java
nameWithoutExt == "Fx" ||
// mod.rs is for Rust)
nameWithoutExt == "mod")
}
// Restore directory from packr box
func Restore(box *packr.Box, output string) error {
if err := box.Walk(func(name string, fd packd.File) error {
content, err := box.Find(name)
if err != nil {
return err
}
dest := filepath.Join(output, name)
if err := utils.EnsureFile(dest); err != nil {
return err
}
if err := ioutil.WriteFile(dest, content, 0600); err != nil {
return err
}
return nil
}); err != nil {
return err
}
return nil
}
// Bundle bundle a function
func Bundle(box *packr.Box, output string, language string, fn string, deps ...string) error {
if err := Restore(box, output); err != nil {
return err
}
if err := utils.Merge(output, deps...); err != nil {
return err
}
// Replace the default handler source file with given function source file
if err := filepath.Walk(output, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if IsHandler(path, language) {
if err := utils.CopyFile(fn, path); err != nil {
return err
}
}
return nil
}); err != nil {
return err
}
return nil
}

51
bundler/bundler_test.go Normal file
View File

@@ -0,0 +1,51 @@
package bundler
import (
"io/ioutil"
"log"
"os"
"testing"
"github.com/gobuffalo/packr/v2"
)
func TestBundler(t *testing.T) {
t.Run("Restore", func(t *testing.T) {
box := packr.New("", "./node/assets")
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(outputDir)
if err := Restore(box, outputDir); err != nil {
t.Fatal(err)
}
})
t.Run("Bundle", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}`
if err = ioutil.WriteFile(fd.Name(), []byte(content), 0666); err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
box := packr.New("", "./node/assets")
if err := Bundle(box, outputDir, "node", fd.Name()); err != nil {
t.Fatal(err)
}
})
}

View File

@@ -0,0 +1,13 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package crystal
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("crystal", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtY3J5c3RhbC1iYXNlCgpFWFBPU0UgMzAwMAoKQ09QWSAuIC4KClJVTiBjcnlzdGFsIGJ1aWxkIC0tdmVyYm9zZSAgLW8gLi9meGNyIC4vKi5jcgoKQ01EIFsiLi9meGNyIl0K\&#34;")
_ = packr.PackJSONBytes("crystal", "app.cr", "\&#34;cmVxdWlyZSAia2VtYWwiCnJlcXVpcmUgImd6aXAiCnJlcXVpcmUgImpzb24iCnJlcXVpcmUgIi4vZngiCgpwb3N0ICIvIiBkbyB8Y3R4fAogICAgZnggY3R4CmVuZAoKZ2V0ICIvIiBkbyB8Y3R4fAogICAgZnggY3R4CmVuZAoKS2VtYWwucnVuCg==\&#34;")
_ = packr.PackJSONBytes("crystal", "fx.cr", "\&#34;ZGVmIGZ4KGN0eCkKICAiaGVsbG8gd29ybGQiCmVuZAo=\&#34;")
}

View File

@@ -0,0 +1,9 @@
FROM metrue/fx-crystal-base
EXPOSE 3000
COPY . .
RUN crystal build --verbose -o ./fxcr ./*.cr
CMD ["./fxcr"]

View File

@@ -0,0 +1,14 @@
require "kemal"
require "gzip"
require "json"
require "./fx"
post "/" do |ctx|
fx ctx
end
get "/" do |ctx|
fx ctx
end
Kemal.run

View File

@@ -0,0 +1,3 @@
def fx(ctx)
"hello world"
end

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package crystal
import _ "github.com/metrue/fx/packrd"

View File

@@ -0,0 +1,32 @@
package crystal
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Crystal defines crystal bundler
type Crystal struct {
assets *packr.Box
}
// New a crystal bundler
func New() *Crystal {
return &Crystal{
assets: packr.New("crystal", "./assets"),
}
}
// Scaffold a crystal/kemal app
func (k *Crystal) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a kemal project
func (k *Crystal) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, "crystal", fn, deps...)
}
var (
_ bundler.Bundler = &Crystal{}
)

View File

@@ -0,0 +1,143 @@
package crystal
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestCrystalBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_crystal")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
crystal := New()
if err := crystal.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.crystal")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `def fx(ctx)
"hello world"
end`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_crystal")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
crystal := New()
if err := crystal.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle function should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/fx.cr")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.cr")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/fx.cr")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `def fx(a, b)
a + b
end
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.cr")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_crystal")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
crystal := New()
if err := crystal.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle function should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

File diff suppressed because one or more lines are too long

View File

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

16
bundler/d/assets/app.d Normal file
View File

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

4071
bundler/d/assets/arsd/cgi.d Normal file

File diff suppressed because it is too large Load Diff

6
bundler/d/assets/fx.d Normal file
View File

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

8
bundler/d/d-packr.go Normal file
View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package d
import _ "github.com/metrue/fx/packrd"

32
bundler/d/d.go Normal file
View File

@@ -0,0 +1,32 @@
package d
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// D defines d bundler
type D struct {
assets *packr.Box
}
// New a koa bundler
func New() *D {
return &D{
assets: packr.New("d", "./assets"),
}
}
// Scaffold a koa app
func (d *D) Scaffold(output string) error {
return bundler.Restore(d.assets, output)
}
// Bundle a function into a koa project
func (d *D) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(d.assets, output, "d", fn, deps...)
}
var (
_ bundler.Bundler = &D{}
)

View File

@@ -0,0 +1,13 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package golang
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("go", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtZ28tYmFzZQoKQ09QWSAuIC9nby9zcmMvZ2l0aHViLmNvbS9tZXRydWUvZngKV09SS0RJUiAvZ28vc3JjL2dpdGh1Yi5jb20vbWV0cnVlL2Z4CgpSVU4gZ28gYnVpbGQgLWxkZmxhZ3MgIi13IC1zIiAtbyBmeCBmeC5nbyBhcHAuZ28KCkVYUE9TRSAzMDAwCgpDTUQgWyIuL2Z4Il0K\&#34;")
_ = packr.PackJSONBytes("go", "app.go", "\&#34;cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImdpdGh1Yi5jb20vZ2luLWdvbmljL2dpbiIKKQoKZnVuYyBtYWluKCkgewoJciA6PSBnaW4uRGVmYXVsdCgpCglyLkdFVCgiLyIsIGZ4KQoJci5QT1NUKCIvIiwgZngpCglpZiBlcnIgOj0gci5SdW4oIjozMDAwIik7IGVyciAhPSBuaWwgewoJCXBhbmljKGVycikKCX0KfQo=\&#34;")
_ = packr.PackJSONBytes("go", "fx.go", "\&#34;cGFja2FnZSBtYWluCgppbXBvcnQgImdpdGh1Yi5jb20vZ2luLWdvbmljL2dpbiIKCmZ1bmMgZngoY3R4ICpnaW4uQ29udGV4dCkgewoJY3R4LkpTT04oMjAwLCBnaW4uSHsKCQkibWVzc2FnZSI6ICJoZWxsbyB3b3JsZCIsCgl9KQp9Cg==\&#34;")
}

View File

@@ -0,0 +1,10 @@
FROM metrue/fx-go-base
COPY . /go/src/github.com/metrue/fx
WORKDIR /go/src/github.com/metrue/fx
RUN go build -ldflags "-w -s" -o fx fx.go app.go
EXPOSE 3000
CMD ["./fx"]

14
bundler/go/assets/app.go Normal file
View File

@@ -0,0 +1,14 @@
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/", fx)
r.POST("/", fx)
if err := r.Run(":3000"); err != nil {
panic(err)
}
}

9
bundler/go/assets/fx.go Normal file
View File

@@ -0,0 +1,9 @@
package main
import "github.com/gin-gonic/gin"
func fx(ctx *gin.Context) {
ctx.JSON(200, gin.H{
"message": "hello world",
})
}

32
bundler/go/go.go Normal file
View File

@@ -0,0 +1,32 @@
package golang
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Gin defines javascript bundler
type Gin struct {
assets *packr.Box
}
// New a koa bundler
func New() *Gin {
return &Gin{
assets: packr.New("go", "./assets"),
}
}
// Scaffold a koa app
func (g *Gin) Scaffold(output string) error {
return bundler.Restore(g.assets, output)
}
// Bundle a function into a koa project
func (g *Gin) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(g.assets, output, "go", fn, deps...)
}
var (
_ bundler.Bundler = &Gin{}
)

143
bundler/go/go_test.go Normal file
View File

@@ -0,0 +1,143 @@
package golang
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestKoaBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/fx.go")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/fx.go")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `
module.exports = (a, b) => a+b
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package golang
import _ "github.com/metrue/fx/packrd"

View File

@@ -0,0 +1,14 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package java
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("java", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtamF2YS1iYXNlCgojIEFkZGluZyBzb3VyY2UsIGNvbXBpbGUgYW5kIHBhY2thZ2UgaW50byBhIGZhdCBqYXIKQUREIHNyYyAvY29kZS9zcmMKUlVOIFsibXZuIiwgInBhY2thZ2UiXQoKRVhQT1NFIDMwMDAKQ01EIFsiL3Vzci9saWIvanZtL2phdmEtOC1vcGVuamRrLWFtZDY0L2Jpbi9qYXZhIiwgIi1qYXIiLCAidGFyZ2V0L2Z4LWFwcC1qYXZhLTAuMS4wLmphciJdCg==\&#34;")
_ = packr.PackJSONBytes("java", "pom.xml", "\&#34;PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHByb2plY3QgeG1sbnM9Imh0dHA6Ly9tYXZlbi5hcGFjaGUub3JnL1BPTS80LjAuMCIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIKICAgIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL21hdmVuLmFwYWNoZS5vcmcvUE9NLzQuMC4wIGh0dHA6Ly9tYXZlbi5hcGFjaGUub3JnL21hdmVuLXY0XzBfMC54c2QiPgogICAgPG1vZGVsVmVyc2lvbj40LjAuMDwvbW9kZWxWZXJzaW9uPgogICAgPGdyb3VwSWQ&#43;b3JnLnNwcmluZ2ZyYW1ld29yazwvZ3JvdXBJZD4KICAgIDxhcnRpZmFjdElkPmZ4LWFwcC1qYXZhPC9hcnRpZmFjdElkPgogICAgPHBhY2thZ2luZz5qYXI8L3BhY2thZ2luZz4KICAgIDx2ZXJzaW9uPjAuMS4wPC92ZXJzaW9uPgoKICAgIDxidWlsZD4KICAgICAgICA8cGx1Z2lucz4KICAgICAgICAgICAgPHBsdWdpbj4KICAgICAgICAgICAgICAgIDxncm91cElkPm9yZy5hcGFjaGUubWF2ZW4ucGx1Z2luczwvZ3JvdXBJZD4KICAgICAgICAgICAgICAgIDxhcnRpZmFjdElkPm1hdmVuLXNoYWRlLXBsdWdpbjwvYXJ0aWZhY3RJZD4KICAgICAgICAgICAgICAgIDx2ZXJzaW9uPjIuMTwvdmVyc2lvbj4KICAgICAgICAgICAgICAgIDxleGVjdXRpb25zPgogICAgICAgICAgICAgICAgICAgIDxleGVjdXRpb24&#43;CiAgICAgICAgICAgICAgICAgICAgICAgIDxwaGFzZT5wYWNrYWdlPC9waGFzZT4KICAgICAgICAgICAgICAgICAgICAgICAgPGdvYWxzPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGdvYWw&#43;c2hhZGU8L2dvYWw&#43;CiAgICAgICAgICAgICAgICAgICAgICAgIDwvZ29hbHM&#43;CiAgICAgICAgICAgICAgICAgICAgICAgIDxjb25maWd1cmF0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRyYW5zZm9ybWVycz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dHJhbnNmb3JtZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1wbGVtZW50YXRpb249Im9yZy5hcGFjaGUubWF2ZW4ucGx1Z2lucy5zaGFkZS5yZXNvdXJjZS5NYW5pZmVzdFJlc291cmNlVHJhbnNmb3JtZXIiPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8bWFpbkNsYXNzPmZ4LmFwcDwvbWFpbkNsYXNzPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdHJhbnNmb3JtZXI&#43;CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3RyYW5zZm9ybWVycz4KICAgICAgICAgICAgICAgICAgICAgICAgPC9jb25maWd1cmF0aW9uPgogICAgICAgICAgICAgICAgICAgIDwvZXhlY3V0aW9uPgogICAgICAgICAgICAgICAgPC9leGVjdXRpb25zPgogICAgICAgICAgICA8L3BsdWdpbj4KICAgICAgICA8L3BsdWdpbnM&#43;CiAgICA8L2J1aWxkPgogICAgPHByb3BlcnRpZXM&#43;CiAgICAgICAgPG1hdmVuLmNvbXBpbGVyLnNvdXJjZT44PC9tYXZlbi5jb21waWxlci5zb3VyY2U&#43;CiAgICAgICAgPG1hdmVuLmNvbXBpbGVyLnRhcmdldD44PC9tYXZlbi5jb21waWxlci50YXJnZXQ&#43;CiAgPC9wcm9wZXJ0aWVzPgogIDxkZXBlbmRlbmNpZXM&#43;CiAgPGRlcGVuZGVuY3k&#43;CiAgICA8Z3JvdXBJZD5pby5qYXZhbGluPC9ncm91cElkPgogICAgPGFydGlmYWN0SWQ&#43;amF2YWxpbjwvYXJ0aWZhY3RJZD4KICAgIDx2ZXJzaW9uPjEuMS4xPC92ZXJzaW9uPgogIDwvZGVwZW5kZW5jeT4KICA8ZGVwZW5kZW5jeT4KICAgIDxncm91cElkPm9yZy5qc29uPC9ncm91cElkPgogICAgPGFydGlmYWN0SWQ&#43;anNvbjwvYXJ0aWZhY3RJZD4KICAgIDx2ZXJzaW9uPjIwMTcxMDE4PC92ZXJzaW9uPgogIDwvZGVwZW5kZW5jeT4KICA8L2RlcGVuZGVuY2llcz4KPC9wcm9qZWN0Pgo=\&#34;")
_ = packr.PackJSONBytes("java", "src/main/java/fx/Fx.java", "\&#34;cGFja2FnZSBmeDsKCmltcG9ydCBvcmcuanNvbi5KU09OT2JqZWN0OwoKcHVibGljIGNsYXNzIEZ4IHsKICAgIHB1YmxpYyBpbnQgaGFuZGxlKEpTT05PYmplY3QgaW5wdXQpIHsKICAgICAgICBTdHJpbmcgYSA9IGlucHV0LmdldCgiYSIpLnRvU3RyaW5nKCk7CiAgICAgICAgU3RyaW5nIGIgPSBpbnB1dC5nZXQoImIiKS50b1N0cmluZygpOwogICAgICAgIHJldHVybiBJbnRlZ2VyLnBhcnNlSW50KGEpICsgSW50ZWdlci5wYXJzZUludChiKTsKICAgIH0KfQo=\&#34;")
_ = packr.PackJSONBytes("java", "src/main/java/fx/app.java", "\&#34;cGFja2FnZSBmeDsKCmltcG9ydCBpby5qYXZhbGluLkphdmFsaW47CmltcG9ydCBvcmcuanNvbi5KU09OT2JqZWN0OwoKcHVibGljIGNsYXNzIGFwcCB7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgSmF2YWxpbiBhcHAgPSBKYXZhbGluLnN0YXJ0KDMwMDApOwogICAgICAgIEZ4IGhhbmRsZXIgPSBuZXcgRngoKTsKICAgICAgICBhcHAucG9zdCgiLyIsIGN0eCAtPiB7CiAgICAgICAgICAgIEpTT05PYmplY3Qgb2JqID0gbmV3IEpTT05PYmplY3QoY3R4LmJvZHkoKSk7CiAgICAgICAgICAgIGN0eC5yZXN1bHQoIiIraGFuZGxlci5oYW5kbGUob2JqKSk7CiAgICAgICAgfSk7CiAgICB9Cn0K\&#34;")
}

View File

@@ -0,0 +1,8 @@
FROM metrue/fx-java-base
# Adding source, compile and package into a fat jar
ADD src /code/src
RUN ["mvn", "package"]
EXPOSE 3000
CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "target/fx-app-java-0.1.0.jar"]

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>fx-app-java</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>fx.app</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,11 @@
package fx;
import org.json.JSONObject;
public class Fx {
public int handle(JSONObject input) {
String a = input.get("a").toString();
String b = input.get("b").toString();
return Integer.parseInt(a) + Integer.parseInt(b);
}
}

View File

@@ -0,0 +1,15 @@
package fx;
import io.javalin.Javalin;
import org.json.JSONObject;
public class app {
public static void main(String[] args) {
Javalin app = Javalin.start(3000);
Fx handler = new Fx();
app.post("/", ctx -> {
JSONObject obj = new JSONObject(ctx.body());
ctx.result(""+handler.handle(obj));
});
}
}

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package java
import _ "github.com/metrue/fx/packrd"

32
bundler/java/java.go Normal file
View File

@@ -0,0 +1,32 @@
package java
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Java defines javascript bundler
type Java struct {
assets *packr.Box
}
// New a koa bundler
func New() *Java {
return &Java{
assets: packr.New("java", "./assets"),
}
}
// Scaffold a koa app
func (k *Java) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a koa project
func (k *Java) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, "java", fn, deps...)
}
var (
_ bundler.Bundler = &Java{}
)

155
bundler/java/java_test.go Normal file
View File

@@ -0,0 +1,155 @@
package java
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestJavaBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_java")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
java := New()
if err := java.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.java")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `package fx;
import io.javalin.Javalin;
import org.json.JSONObject;
public class app {
public static void main(String[] args) {
Javalin app = Javalin.start(3000);
Fx handler = new Fx();
app.post("/", ctx -> {
JSONObject obj = new JSONObject(ctx.body());
ctx.result(""+handler.handle(obj));
});
}
}
`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_java")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
java := New()
if err := java.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/src/main/java/fx/Fx.java")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/src/main/java/fx/Fx.java")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `
module.exports = (a, b) => a+b
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_java")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
java := New()
if err := java.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

View File

@@ -0,0 +1,15 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package julia
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("julia", "Dockerfile", "\&#34;RlJPTSBqdWxpYTowLjcKCkNPUFkgLiAvYXBwCgpSVU4gYXB0LWdldCB1cGRhdGUgJiYgYXB0LWdldCBpbnN0YWxsIC15IGdjYyBhcHQtdXRpbHMgdW56aXAgbWFrZSBsaWJodHRwLXBhcnNlci1kZXYKUlVOIGp1bGlhIC9hcHAvZGVwcy5qbAoKQ01EIGp1bGlhIC9hcHAvYXBwLmpsCkVYUE9TRSAzMDAwCg==\&#34;")
_ = packr.PackJSONBytes("julia", "REQUIRE", "\&#34;SHR0cFBhcnNlcgpIdHRwU2VydmVyCkpTT04KVW5tYXJzaGFs\&#34;")
_ = packr.PackJSONBytes("julia", "app.jl", "\&#34;dXNpbmcgSHR0cFNlcnZlcgppbXBvcnQgSlNPTgppbXBvcnQgVW5tYXJzaGFsCgppbmNsdWRlKCJmeC5qbCIpCgpzcnYgPSBTZXJ2ZXIoKSBkbyByZXE6OlJlcXVlc3QsIHJlczo6UmVzcG9uc2UKICAgIGlmIGxlbmd0aChyZXEuZGF0YSkgPT0gMAogICAgICAgIHJlcy5zdGF0dXMgPSA0MDAKICAgIGVsc2UKICAgICAgICBwYXJzZWRfZGF0YSA9IEpTT04uUGFyc2VyLnBhcnNlKGpvaW4oW0NoYXIodikgZm9yIHYgaW4gcmVxLmRhdGFdKSkKICAgICAgICBkYXRhID0gVW5tYXJzaGFsLnVubWFyc2hhbChJbnB1dCwgcGFyc2VkX2RhdGEpCiAgICAgICAgc3RyaW5nKGZ4KGRhdGEpKQogICAgZW5kCmVuZAoKcnVuKHNydiwgMzAwMCkK\&#34;")
_ = packr.PackJSONBytes("julia", "deps.jl", "\&#34;b3BlbigiL2FwcC9SRVFVSVJFIikgZG8gZgoJZGVwcyA9IHJlYWRsaW5lcyhmKQoJZm9yIGQgaW4gZGVwcwoJCVBrZy5hZGQoZCkKCWVuZAplbmQKUGtnLmJ1aWxkKCJIdHRwUGFyc2VyIikK\&#34;")
_ = packr.PackJSONBytes("julia", "fx.jl", "\&#34;c3RydWN0IElucHV0CiAgICBhOjpOdW1iZXIKICAgIGI6Ok51bWJlcgplbmQKCmZ4ID0gZnVuY3Rpb24oaW5wdXQ6OklucHV0KQogICAgcmV0dXJuIGlucHV0LmEgKyBpbnB1dC5iCmVuZAo=\&#34;")
}

View File

@@ -1,4 +1,4 @@
FROM julia:latest
FROM julia:0.7
COPY . /app
@@ -6,4 +6,4 @@ RUN apt-get update && apt-get install -y gcc apt-utils unzip make libhttp-parser
RUN julia /app/deps.jl
CMD julia /app/app.jl
EXPOSE 3000
EXPOSE 3000

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package julia
import _ "github.com/metrue/fx/packrd"

32
bundler/julia/julia.go Normal file
View File

@@ -0,0 +1,32 @@
package julia
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Julia defines javascript bundler
type Julia struct {
assets *packr.Box
}
// New a koa bundler
func New() *Julia {
return &Julia{
assets: packr.New("julia", "./assets"),
}
}
// Scaffold a koa app
func (k *Julia) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a koa project
func (k *Julia) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, "julia", fn, deps...)
}
var (
_ bundler.Bundler = &Julia{}
)

148
bundler/julia/julia_test.go Normal file
View File

@@ -0,0 +1,148 @@
package julia
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestJuliaBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.julia")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `struct Input
a::Number
b::Number
end
fx = function(input::Input)
return input.a + input.b
end
`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle function should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/fx.jl")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/fx.jl")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `
module.exports = (a, b) => a+b
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

View File

@@ -0,0 +1,13 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package node
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("node", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtbm9kZS1iYXNlCgpDT1BZIC4gLgpFWFBPU0UgMzAwMApDTUQgWyJub2RlIiwgImFwcC5qcyJdCg==\&#34;")
_ = packr.PackJSONBytes("node", "app.js", "\&#34;Y29uc3QgS29hID0gcmVxdWlyZSgna29hJyk7CmNvbnN0IGJvZHlQYXJzZXIgPSByZXF1aXJlKCdrb2EtYm9keXBhcnNlcicpOwpjb25zdCBjb3JzID0gcmVxdWlyZSgnQGtvYS9jb3JzJyk7CmNvbnN0IHN3U3RhdHMgPSByZXF1aXJlKCdzd2FnZ2VyLXN0YXRzJyk7CmNvbnN0IGUyayA9IHJlcXVpcmUoJ2V4cHJlc3MtdG8ta29hJyk7CmNvbnN0IGZ4ID0gcmVxdWlyZSgnLi9meCcpOwoKY29uc3QgYXBwID0gbmV3IEtvYSgpOwoKYXBwLnVzZShlMmsoc3dTdGF0cy5nZXRNaWRkbGV3YXJlKHt9KSkpOwphcHAudXNlKGNvcnMoewogIG9yaWdpbjogJyonLAp9KSk7CmFwcC51c2UoYm9keVBhcnNlcigpKTsKYXBwLnVzZShmeCk7CgphcHAubGlzdGVuKDMwMDApOwo=\&#34;")
_ = packr.PackJSONBytes("node", "fx.js", "\&#34;bW9kdWxlLmV4cG9ydHMgPSAoY3R4KSA9PiB7CiAgY3R4LmJvZHkgPSAnaGVsbG8gd29ybGQnCn0K\&#34;")
}

View File

@@ -1,4 +1,4 @@
FROM node:latest
FROM metrue/fx-node-base
COPY . .
EXPOSE 3000

View File

@@ -0,0 +1,17 @@
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const cors = require('@koa/cors');
const swStats = require('swagger-stats');
const e2k = require('express-to-koa');
const fx = require('./fx');
const app = new Koa();
app.use(e2k(swStats.getMiddleware({})));
app.use(cors({
origin: '*',
}));
app.use(bodyParser());
app.use(fx);
app.listen(3000);

View File

@@ -0,0 +1,3 @@
module.exports = (ctx) => {
ctx.body = 'hello world'
}

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package node
import _ "github.com/metrue/fx/packrd"

34
bundler/node/node.go Normal file
View File

@@ -0,0 +1,34 @@
package node
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
const language = "node"
// Node defines node bundler
type Node struct {
assets *packr.Box
}
// New a koa bundler
func New() *Node {
return &Node{
assets: packr.New("node", "./assets"),
}
}
// Scaffold a koa app
func (k *Node) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a koa project
func (k *Node) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, language, fn, deps...)
}
var (
_ bundler.Bundler = &Node{}
)

143
bundler/node/node_test.go Normal file
View File

@@ -0,0 +1,143 @@
package node
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestNodeBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `
module.exports = (ctx) => {
ctx.body = 'hello fx'
}`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/fx.js")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/fx.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `
module.exports = (a, b) => a+b
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_koa")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
koa := New()
if err := koa.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

View File

@@ -0,0 +1,13 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package perl
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("perl", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtcGVybC1iYXNlCgpBREQgLiAuCgpFWFBPU0UgMzAwMApDTUQgWyJwZXJsIiwgImFwcC5wbCIsICJkYWVtb24iXQo=\&#34;")
_ = packr.PackJSONBytes("perl", "app.pl", "\&#34;dXNlIE1vam9saWNpb3VzOjpMaXRlOwoKcmVxdWlyZSAiLi9meC5wbCI7CgpnZXQgJy8nID0&#43;IHN1YiB7CiAgbXkgJGN0eCA9IHNoaWZ0OwogIG15ICRyZXMgPSBmeCgkY3R4KTsKICAkY3R4LT5yZW5kZXIoanNvbiA9PiAkcmVzKTsKfTsKCnBvc3QgJy8nID0&#43;IHN1YiB7CiAgbXkgJGN0eCA9IHNoaWZ0OwogIG15ICRyZXMgPSBmeCgkY3R4KTsKICAkY3R4LT5yZW5kZXIoanNvbiA9PiAkcmVzKTsKfTsKCmFwcC0&#43;c3RhcnQ7Cg==\&#34;")
_ = packr.PackJSONBytes("perl", "fx.pl", "\&#34;c3ViIGZ4IHsKICBteSAkY3R4ID0gc2hpZnQ7CiAgcmV0dXJuICdoZWxsbyBmeCcKfQoKMTsK\&#34;")
}

View File

@@ -0,0 +1,6 @@
FROM metrue/fx-perl-base
ADD . .
EXPOSE 3000
CMD ["perl", "app.pl", "daemon"]

View File

@@ -0,0 +1,17 @@
use Mojolicious::Lite;
require "./fx.pl";
get '/' => sub {
my $ctx = shift;
my $res = fx($ctx);
$ctx->render(json => $res);
};
post '/' => sub {
my $ctx = shift;
my $res = fx($ctx);
$ctx->render(json => $res);
};
app->start;

View File

@@ -0,0 +1,6 @@
sub fx {
my $ctx = shift;
return 'hello fx'
}
1;

View File

@@ -0,0 +1,8 @@
// +build !skippackr
// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT.
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
package perl
import _ "github.com/metrue/fx/packrd"

32
bundler/perl/perl.go Normal file
View File

@@ -0,0 +1,32 @@
package perl
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Julia defines javascript bundler
type Julia struct {
assets *packr.Box
}
// New a koa bundler
func New() *Julia {
return &Julia{
assets: packr.New("perl", "./assets"),
}
}
// Scaffold a koa app
func (k *Julia) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a koa project
func (k *Julia) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, "perl", fn, deps...)
}
var (
_ bundler.Bundler = &Julia{}
)

148
bundler/perl/perl_test.go Normal file
View File

@@ -0,0 +1,148 @@
package perl
import (
"io/ioutil"
"log"
"os"
"reflect"
"testing"
"github.com/metrue/fx/utils"
)
func TestJuliaBundler(t *testing.T) {
t.Run("Scaffold", func(t *testing.T) {
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Scaffold(outputDir); err != nil {
t.Fatal(err)
}
diff, _, _, err := utils.Diff(outputDir, "./assets")
if err != nil {
t.Fatal(err)
}
if diff {
t.Fatalf("%s is not equal with %s", outputDir, "./assets")
}
})
t.Run("BundleSingleFunc", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.julia")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content := `struct Input
a::Number
b::Number
end
fx = function(input::Input)
return input.a + input.b
end
`
err = ioutil.WriteFile(fd.Name(), []byte(content), 0666)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Bundle(outputDir, fd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle function should be changed")
}
if !reflect.DeepEqual(cur, []byte(content)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
preHandleFunc, err := ioutil.ReadFile("./assets/fx.pl")
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(pre, preHandleFunc) {
{
}
t.Fatalf("it should get %s but got %s", preHandleFunc, pre)
}
})
t.Run("BundleFuncAndDeps", func(t *testing.T) {
fd, err := ioutil.TempFile("", "fx_func_*.js")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fd.Name())
content, err := ioutil.ReadFile("./assets/fx.pl")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(fd.Name(), content, 0666)
if err != nil {
t.Fatal(err)
}
addFunc := `
module.exports = (a, b) => a+b
`
addFd, err := ioutil.TempFile("", "fx_add_func_*.js")
if err != nil {
t.Fatal(err)
}
err = ioutil.WriteFile(addFd.Name(), []byte(addFunc), 0644)
if err != nil {
t.Fatal(err)
}
outputDir, err := ioutil.TempDir("", "fx_julia")
if err != nil {
log.Fatal(err)
}
defer os.RemoveAll(outputDir)
julia := New()
if err := julia.Bundle(outputDir, fd.Name(), addFd.Name()); err != nil {
t.Fatal(err)
}
diff, pre, cur, err := utils.Diff("./assets", outputDir)
if err != nil {
t.Fatal(err)
}
if !diff {
t.Fatalf("handle functino should be changed")
}
if !reflect.DeepEqual(cur, []byte(addFunc)) {
t.Fatalf("it should be %s but got %s", content, cur)
}
if pre != nil {
t.Fatal(pre)
}
})
}

View File

@@ -0,0 +1,13 @@
// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
package php
import "github.com/gobuffalo/packr"
// You can use the "packr clean" command to clean up this,
// and any other packr generated files.
func init() {
_ = packr.PackJSONBytes("php", "Dockerfile", "\&#34;RlJPTSBtZXRydWUvZngtcGhwLWJhc2UKCkNPUFkgLiAuCgpFWFBPU0UgMzAwMAoKQ01EIHBocCAtUyAwLjAuMC4wOjMwMDAK\&#34;")
_ = packr.PackJSONBytes("php", "app.php", "\&#34;PD9waHAKICAgIGluY2x1ZGUoImZ4LnBocCIpOwogICAgJGRhdGEgPSBmaWxlX2dldF9jb250ZW50cygicGhwOi8vaW5wdXQiKTsKICAgICRyZXMgPSBqc29uX2RlY29kZSgkZGF0YSx0cnVlKTsKICAgICR2ID0gRngoJHJlc1siYSJdLCRyZXNbImIiXSk7CiAgICBlY2hvICR2Owo=\&#34;")
_ = packr.PackJSONBytes("php", "fx.php", "\&#34;PD9waHAKICAgIGZ1bmN0aW9uIEZ4KCRhLCRiKSB7CiAgICAgICAgcmV0dXJuICRhKyRiOwogICAgfQo=\&#34;")
}

Some files were not shown because too many files have changed in this diff Show More