faastruby / faastruby-cli Goto Github PK
View Code? Open in Web Editor NEWThis repository has moved to https://gitlab.com/faastruby/cli
This repository has moved to https://gitlab.com/faastruby/cli
As a developer, i'd like a tool that can calculate how many runners I need for my app based on function size, so that I can estimate my costs.
Extracted from the idea of issue #6
The idea is to allow initializing a function folder from a local or remote template.
~$ faastruby new FUNCTION_NAME --template /path/to_template
~$ faastruby new FUNCTION_NAME --template [email protected]:user/repo.git
~$ faastruby new FUNCTION_NAME --template github:user/repo
I'd like to be able to delete my own account.
Here's a suggestion:
$ faastruby destroy-account
The above command will prompt for confirmation. When I say yes, the command will wait for a secret token.
An email will be sent to me with this secret token that I must paste in the terminal prompt. The CLI then sends the request to the server to destroy the account with that confirmation token and the account gets deleted.
With the templates feature, you can initialize a function from a Git repository.
This enhancement would allow users to use folders inside a Git repo as the source template, instead of having multiple repositories.
Examples:
~$ faastruby new FUNCTION_NAME --template github:user/repo/folder/subfolder
# or
~$ faastruby new FUNCTION_NAME --template git:[email protected]:/user/repo.git/folder/subfolder
I'd like to be able to reset my password.
Here's a suggestion:
$ faastruby update-account --reset-password
The above command will send me an email with a confirmation token and prompt me for this token. Once I paste it in, I will be asked for the new password and a password confirmation. The CLI will then send the request to the server with this token and the password will be changed.
If the operation was successful, the CLI will ask "Do you wish to force logout from all machines and invalidate all current API credentials?". If I respond yes, the CLI will exec "faastruby logout --all"
.
Then I can perform a faastruby login
with my new password.
As you start building different things and use different environments, it gets hard to keep track of what you have deployed to the cloud platform.
Users should be able to list all workspaces associated with their accounts. Something like:
# This should return a list of all workspaces associated with the account
$ faastruby ls
WORKSPACE FUNCTIONS RUNNERS
myworkspace-stage-89292d 2 3
myworkspace-prod-89292d 2 3
myworkspace-feat-89292d 2 3
# Then allow listing the functions from a workspace using the same syntax
$ faastruby ls myworkspace-feat-89292d
FUNCTION ENDPOINT
catch-all https://myworkspace-feat-89292d.tor1.faast.cloud/catch-all
root https://myworkspace-feat-89292d.tor1.faast.cloud/
The first example requires the creation of a new API endpoint.
A user should be able to list commands to be executed locally before building the deployment package.
The purpose is to allow things like asset compilation, or any pre-processing required prior to bundling the files on a ZIP package.
The idea is to create a template for the command faastruby new
that would initialize a folder with a function already prepared to serve Javascript and CSS.
The command could be, for example:
~$ faastruby new FUNCTION_NAME --template assets
Note that we must have templates for all the supported runtimes (--runtime).
The resulting folder could look like this:
function_folder
├── assets
│ ├── javascript
│ │ └── application.js
│ └── stylesheets
│ └── application.css
├── spec
│ ├── handler_spec.rb
│ └── spec_helper.rb
├── Gemfile
└── handler.rb
Example requests:
/workspace-name/function-name?css=application.css
/workspace-name/function-name?js=application.js
And an example Ruby function could be like:
def handler(event)
return render(css: File.read("assets/stylesheets/#{event.query_params['css']}")) if event.query_params.has_key?('css')
return render(js: File.read("assets/javascript/#{event.query_params['js']}")) if event.query_params.has_key?('js')
end
There's also the need for sanitizing the input. For example, we don't want to allow js=../foo.js
(which would not result in anything bad because the platform is secured against stuff like that - but it is better to avoid anyways). So there's a need for some sort of regular expression to remove everything fromcss=
and js=
but letters, numbers, dashes, underlines and one period.
The above is just a suggestion. Feel free to propose something better.
When I run faastruby new my-function --template local:~/foo/bar
the CLI only creates one file, faastruby.yml.
my-function
└── faastruby.yml
It would be nice if faastruby deploy-to
would precompile javascript and css before creating the ZIP package on asset-functions.
The code for deploy-to
is here: https://github.com/FaaStRuby/faastruby-cli/blob/master/lib/faastruby/cli/commands/function/deploy_to.rb
The idea is to do that with as minimal dependencies as possible, and fail gracefully if the dependencies are not installed. The implementation might be coupled with #6.
How to reproduce:
$ faastruby new-project a_project
$ cd a_project
$ faastruby local
# In another terminal
$ cd a_project/functions
$ faastruby new myfunction --runtime crystal:0.27.2
Local will think myfunction/src
is the function name, instead of correctly identifying myfunction
as the name.
Users should be able to add custom domains to their accounts and associate them with workspaces.
The whole process can be done via CLI. Here's a suggestion:
$ faastruby domain --add example.com # to add a domain
$ faastruby domain --remove example.com # to remove a domain
When you add a domain, the CLI will hit the API domains endpoint and receive a response with a Let's Encrypt DNS challenge.
The user will be prompted to make the proper DNS changes and run:
$ faastruby domain --verify example.com
It will then hit an API endpoint that will trigger a Let's encrypt verification.
If everything works, the domain is ready to be associated with a workspace.
Users can associate a domain to a workspace manually by running:
$ faastruby update-workspace WORKSPACE_NAME --attach-domain app.example.com # will attach the domain
$ faastruby update-workspace WORKSPACE_NAME --detach-domain app.example.com # will detach the domain
Users can also add that domain to Local's project.yml
file, choosing which environments will use this domain. Users should also be able to set custom names for workspaces that use custom domains, so myworkspace-prod-12345.example.com
could be actually app.example.com
. This will work by simply orchestrating the command update-workspace
.
Users should be able to run Crystal functions on FaaStRuby Server as well.
The Crystal function code should be compiled on-the-fly when any modification is made.
If a file gets modified, the contents of before_build
in faastruby.yml
will run, then the Crystal function will be compiled.
Users should be able to pass the branch name, a tag or the commit sha on the command line for a Git template.
Example:
~$ faastruby new FUNCTION_NAME --template github:user/repo [ --branch master | --tag v0.1 | --commit 1713e60 ]
Impacts #18 as well as standard signup
behavior.
Need to take in a password confirmation, compare values; reject if they don't match, otherwise proceed with signup or password reset.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.