Giter Site home page Giter Site logo

liara-cloud / cli Goto Github PK

View Code? Open in Web Editor NEW
105.0 5.0 12.0 4.1 MB

The command line interface for Liara

Home Page: https://www.npmjs.com/package/@liara/cli

License: MIT License

JavaScript 0.12% Batchfile 0.05% TypeScript 99.76% Makefile 0.05% Shell 0.02%
deployment liara cli deploy hacktoberfest

cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cli's Issues

Multi-Account Login

It is good to be able to have multiple-account access (e.g. for freelancers),
you could add something like this in constants.ts for relative path lookup:

import fs from 'fs'

//...

if (fs.existsSync('.liara.json')) {
    export const GLOBAL_CONF_PATH = path.resolve('.liara.json')
} else {
    export const GLOBAL_CONF_PATH = path.join(os.homedir(), '.liara.json')
}

Problem .net core Publish

I was published your test .net core app ,but anyway display "Welcome to nginx!" page, was show.
Same as .net core 7 for my App too.
if I use this command "liara deploy --platform=netcore" then this error occurred:
dirname: missing operand
Try 'dirname --help' for more information.
Could not find a .csproj file.
⠹ Building...The command '/bin/bash -o pipefail -c chmod +x /usr/local/bin/configure.sh && /usr/local/bin/configure.sh' returned a non-zero code: 2

@liara/cli/5.0.0 darwin-arm64 node-v20.5.1

› Error: Deployment failed.
› Sorry for inconvenience. If you think it's a bug, please contact us.
› To file a ticket, please head to: https://console.liara.ir/tickets

installing on ubuntu

hello liara team

I'm trying to run liara --version command in ubuntu, but this is the result:

(node:438330) UnhandledPromiseRejectionWarning: /usr/local/lib/node_modules/@liara/cli/node_modules/@oclif/core/lib/command.js:45
            delete this.baseFlags?.json;
                                  ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@liara/cli/node_modules/@oclif/core/lib/index.js:5:19)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
(node:438330) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:438330) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error message

running the command liara deploy --api-token=<wrong-token>

Screen Shot 2022-03-03 at 1 41 54 PM

maybe we need to log something like this:

Screen Shot 2022-03-03 at 1 45 08 PM

Liara deploy problem

ModuleLoadError: [MODULE_NOT_FOUND] import() failed to load
› /opt/hostedtoolcache/node/18.18.0/x64/lib/node_modules/@liara/cli/lib/comm
› ands/deploy.js: Cannot find module 'call-bind'
› Require stack:
› - /opt/hostedtoolcache/node/18.18.0/x64/lib/node_modules/@liara/cli/node_m
› odules/@ljharb/through/index.js
› Code: MODULE_NOT_FOUND

[bug] - liara deployment freezes

So many times, when I try to run liara deploy and provide all the credentials in liara.json file, the compression and uploading process takes forever like it freezes.

Error with liara deploy

When I run "liara deploy", I get the following error

› Error: A NodeJS app must be runnable with 'npm start'.
› You must add a 'start' command to your package.json scripts.

Drop Support for Node.js v16 Due to Lack of Maintenance Releases

We are currently providing support for Node.js v16. However, as per the Node.js Release Schedule and Maintenance Policy, Node.js v16 has reached the end of its maintenance cycle, and there will be no more maintenance releases for this version.

Lets:

  • Drop support for Node.js v16 in our project to maintain a secure and stable codebase.
  • Update dependencies
  • Encourage users to upgrade to a supported version of Node.js.

Reference:
Node.js Previous Releases

liara shell error

I just pressed ctrl + c when I was using liara shell and got the following error:

root@c7fbcafa695b:/app# e^C
root@c7fbcafa695b:/app# exit
exit
events.js:352
      throw er; // Unhandled 'error' event
      ^

Error: WebSocket is not open: readyState 2 (CLOSING)
    at sendAfterClose (/Users/mhe/n/lib/node_modules/@liara/cli/node_modules/ws/lib/websocket.js:1015:17)
    at WebSocket.send (/Users/mhe/n/lib/node_modules/@liara/cli/node_modules/ws/lib/websocket.js:451:7)
    at Duplex.duplex._write (/Users/mhe/n/lib/node_modules/@liara/cli/node_modules/ws/lib/stream.js:151:8)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at Duplex.Writable.write (internal/streams/writable.js:303:10)
    at ReadStream.ondata (internal/streams/readable.js:726:22)
    at ReadStream.emit (events.js:387:35)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:261:11)
    at ReadStream.Readable.push (internal/streams/readable.js:204:10)
Emitted 'error' event on Duplex instance at:
    at Duplex.duplexOnError (/Users/mhe/n/lib/node_modules/@liara/cli/node_modules/ws/lib/stream.js:37:10)
    at Duplex.emit (events.js:387:35)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at errorOrDestroy (internal/streams/destroy.js:168:7)
    at onwriteError (internal/streams/writable.js:391:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

feat: `liara init`

It would be nice to have an liara init command. this command will ask some questions and then generates a liara.json file based on answers.

Questions like appName, port, platform, disks, which account to use for deploy, ...

issue in login with api-token

Details

@liara/cli/3.2.1 linux-x64 node-v16.14.2

Reproduce

  • liara login --api-token "TOKEN"
  • enter email address
  • bad request happen

bug: liara logs not working

here is my debug logs

$ liara logs --app=XXX -f --debug
[debug] [2024-05-14T09:56:38.974Z] Polling...
[debug] [2024-05-14T09:56:39.947Z] HTTPError: Response code 428 (Precondition Required)
    at Request.<anonymous> (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/as-promise/index.js:86:42)
    at Object.onceWrapper (node:events:629:26)
    at Request.emit (node:events:526:35)
    at Request._onResponseBase (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/core/index.js:726:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Request._onResponse (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/core/index.js:768:13)
[debug] [2024-05-14T09:56:39.979Z] Polling...
[debug] [2024-05-14T09:56:40.085Z] HTTPError: Response code 428 (Precondition Required)
    at Request.<anonymous> (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/as-promise/index.js:86:42)
    at Object.onceWrapper (node:events:629:26)
    at Request.emit (node:events:526:35)
    at Request._onResponseBase (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/core/index.js:726:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Request._onResponse (file:///home/erfanium/.nvm/versions/node/v20.9.0/lib/node_modules/@liara/cli/node_modules/got/dist/source/core/index.js:768:13)
[debug] [2024-05-14T09:56:40.979Z] Polling...

version:

$ liara --version
@liara/cli/6.0.1 linux-x64 node-v20.9.0

How pass authentication for CI/CD

Hi,
I develop some kind of web services, and I plan to use GitLab CI/CD, I ran into a problem for cli deployment, because cli ask for email and password for authentication as a prompt question!
so I suggest add new command key like --api_token to pass automatically this authentication prompt for deployment.

specifing account name in config

Hello, thanks for your awesome package.
I work as a freelancer so I have a lot of Liara accounts on my machine. even though I specified the app name in liara.json file, I have to change the account each time I change my workspace. it would be better if I could specify account name in liara.json file. something like my-username/my-app would be great. or even better the cli first searches for a matching app with the name specified in the main account, if not found, it search for it in other accounts too.

add feature to set list volumes

ability to set set list of volumes like :

{
  "platform": "docker",
  "project": "myApp",
  "port": 8080,
  "volume": [
        "/opt/app/data",
        "/opt/app/log",
        "/opt/app/backup"
    ]
}

bug: `liara logs --since=X` should fetch all logs from `since` to now.

Actual Behavior

when using liara logs command like this:

liara logs --since=1714024894

cli will print just a few logs, but it should be many.

Expected behavior

print all the logs from 1714024894 to now

Additional Context

That's because when I don't use --follow, liara cli only makes one single API call to the sever. but in case of --since, cli should do many API calls to the server in a loop

Nice work

Wish you the bests. Really enjoyed your job.

[BUG] deploy fail when using `--build-arg`

here is the error log:

 # liara deploy --build-arg='staging=1'

App: client
Path: /Users/vanenshi/Work/client-website
Platform: docker
Port: 80
Disks: 
  next-cache -> /app/.next/cache
Compressed size: 12.65MB (use .gitignore to reduce the size)
✔ Upload finished.

 ›   Error: CODE 400: child "build" fails because [child "args" fails because ["args" must be an object]]

"zsh: command not found: liara" error after installing @liara/cli using npm install -g command

I have installed the @liara/cli using the npm install -g @liara/cli command in my terminal. However, when I try to run the "liara" command in my terminal, it returns an error message that reads "zsh: command not found: liara".

I have tried uninstalling and reinstalling @liara/cli multiple times, but the issue persists. I have also tried restarting my terminal and my computer, but the error message still appears.

Can anyone please help me resolve this issue? I would appreciate any suggestions or insights on how to fix this problem.

Environment:

  • Operating System: Manjaro Linux 22.1.0
  • Node.js version: v19.8.1
  • npm version: 8.19.2
  • @liara/cli version: @liara/[email protected]

SSL wrong version

Version: 2.21.2
Platform: Darwin-arm64

Error: write EPROTO 4419732864:error:1408F10B:SSL routines:ssl3_get_record:wrong version
 ›   number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

Can't signing in to my accounts

sudo npm install -g @liara/cli Error

وقتی سعی میکنم برنامه رو نصب کنم ارور زیر رو میده!

sudo npm install -g @liara/cli
[sudo] password for ×××××:         
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@liara/[email protected]',
npm WARN EBADENGINE   required: { node: '>=14.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@oclif/[email protected]',
npm WARN EBADENGINE   required: { node: '>=14.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }

changed 286 packages, and audited 287 packages in 19s

44 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

و این که نمیتونم نسخه node رو بروز کنم! میگه این اخرین نسخه هست. دقیقا چی کار کنم؟!


             ...-:::::-...                 msadr471@Earth 
          .-MMMMMMMMMMMMMMM-.              -------------- 
      .-MMMM`..-:::::::-..`MMMM-.          OS: Linux Mint 21.1 x86_64 
    .:MMMM.:MMMMMMMMMMMMMMM:.MMMM:.        Host: X541UVK 1.0 
   -MMM-M---MMMMMMMMMMMMMMMMMMM.MMM-       Kernel: 5.15.0-56-generic 
 `:MMM:MM`  :MMMM:....::-...-MMMM:MMM:`    Uptime: 4 hours, 30 mins 
 :MMM:MMM`  :MM:`  ``    ``  `:MMM:MMM:    Packages: 4419 (dpkg), 14 (flatpak), 9 (snap) 
.MMM.MMMM`  :MM.  -MM.  .MM-  `MMMM.MMM.   Shell: bash 5.1.16 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   Resolution: 1920x1080 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM:MMM:   DE: Cinnamon 5.6.5 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   WM: Mutter (Muffin) 
.MMM.MMMM`  :MM:--:MM:--:MM:  `MMMM.MMM.   WM Theme: Mint-Y-Legacy-Dark-Orange (Mint-Y) 
 :MMM:MMM-  `-MMMMMMMMMMMM-`  -MMM-MMM:    Theme: Mint-Y-Dark-Orange [GTK2/3] 
  :MMM:MMM:`                `:MMM:MMM:     Icons: Mint-Y-Red [GTK2/3] 
   .MMM.MMMM:--------------:MMMM.MMM.      Terminal: gnome-terminal 
     '-MMMM.-MMMMMMMMMMMMMMM-.MMMM-'       CPU: Intel i7-7500U (4) @ 3.500GHz 
       '.-MMMM``--:::::--``MMMM-.'         GPU: Intel HD Graphics 620 
            '-MMMMMMMMMMMMM-'              GPU: NVIDIA GeForce 920MX 
               ``-:::::-``                 Memory: 5191MiB / 7831MiB 

                                                                   
                                                                   

****@****:~$ npm -v
9.2.0
****@****:~$ nodejs -v
v12.22.9

Setup TravisCI

We have to integrate this repo with a CI service like TravisCI to run tests automatically.
So we can make sure that PRs are passing the tests.

write down a better error msg

from:

›   Error: Response code 401 (Unauthorized)

to:

›   Error: Authentication failed. Please log in to your account by running `liara login` command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.