Giter Site home page Giter Site logo

fly-admin's Introduction

fly-admin

A Typescript client for managing Fly infrastructure.

Install

npm i --save fly-admin

Usage

import { createClient } from 'fly-admin'

const fly = createClient('FLY_API_TOKEN')

async function deployApp() {
  const machine = await fly.Machine.createMachine({
    app_name: 'myAppId',
    image: 'supabase/postgres',
  })
}

API

Apps

  • fly.App.listApps()
  • fly.App.getApp()
  • fly.App.createApp()
  • fly.App.deleteApp()

Machines

  • fly.Machine.listMachines()
  • fly.Machine.getMachine()
  • fly.Machine.createMachine()
  • fly.Machine.updateMachine()
  • fly.Machine.startMachine()
  • fly.Machine.stopMachine()
  • fly.Machine.deleteMachine()
  • fly.Machine.restartMachine()
  • fly.Machine.signalMachine()
  • fly.Machine.waitMachine()
  • fly.Machine.cordonMachine()
  • fly.Machine.uncordonMachine()
  • fly.Machine.listEvents()
  • fly.Machine.listVersions()
  • fly.Machine.listProcesses()
  • fly.Machine.getLease()
  • fly.Machine.acquireLease()

Networks

  • fly.Network.allocateIpAddress()
  • fly.Network.releaseIpAddress()

Organizations

  • fly.Organization.getOrganization()

Secrets

  • fly.Secret.setSecrets()
  • fly.Secret.unsetSecrets()

Volumes

  • fly.Volume.listVolumes()
  • fly.Volume.getVolume()
  • fly.Volume.createVolume()
  • fly.Volume.deleteVolume()
  • fly.Volume.extendVolume()
  • fly.Volume.listSnapshots()

TODO

  • fly.Machine.execMachine()
  • fly.Machine.releaseLease()
  • fly.Machine.getMetadata()
  • fly.Machine.updateMetadata()
  • fly.Machine.deleteMetadata()

License

MIT

fly-admin's People

Contributors

kiwicopple avatar nicholasoxford avatar pcnc avatar sweatybridge avatar

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

Watchers

 avatar  avatar  avatar

fly-admin's Issues

Unable to create more than one machine in same app

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I'm currently unable to create more than one machine per app. The name property is being used both as the app name and the machine name. I don't think that's the right approach. We should have the flexibility to set the app name and machine name independently.

I can't see the example from the readme file in the repositorys root ever will work, because the createMachine method only takes one parameter:

const machine = await fly.Machine.createMachine('myAppId', {
  image: 'supabase/postgres',
})

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

const fly = createClient("[my-api-key]");

const config: CreateMachineRequest = {
  name: "app-name",
  region: "ams",
  config: {
    image: "nginx",
    services: [],
  },
};

const machine = await fly.Machine.createMachine(config);

Expected behavior

Be able to create more than one new machine with the name defined in the config payload.

Current behavior

If I create multiple machine with the configuration example, I get this error from the API:

Name 'app-name' already in use by another machine in the same App.

I think a request body like this would be a better fit for this method:

const config: CreateMachineRequest = {
  name: "machine-name",
  appId: "my-app",
  region: "ams",
  config: {
    image: "nginx",
    services: [],
  },
};

Regions api asking `You must be authenticated to view this.`

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When calling regions api, an error is thrown about not being authenticated. When I call another api, like list machines, it works.

To Reproduce

const regions = await fly.Regions.getRegions();
console.log(regions);

Expected behavior

A list of locations should be returned, although I am grabbing the users api key from fly auth token via the CLI. I wonder if that token needs elevated permissions

Additional context

Also, @sweatybridge it is nice to meet you ๐Ÿ‘‹ I am super interested in helping maintain this project. Let me know if you ever need help with something!

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.