nosdav / server

NosDAV Server
https://nosdav.com/server
MIT License
9 stars 1 forks source link

Proposal: Add a Fly.io deplyoment #4

Open gedw99 opened 1 year ago

gedw99 commented 1 year ago

Needs a docker file

then can use flyctl to deploy to Fly.io.

then can run on many data centers and all requests will load balance.

gedw99 commented 1 year ago

fly can act as the docker registry too btw.

takes 300 ms to doot a docker on fly. But you cant use docker compose. Only docker..

Any DB we need should be postresql or cockroach. then you get free master / master replication only fly.io ... Saves your tons of time...

gedw99 commented 1 year ago

fly-db-create:
    # works :)
    # feed it the vars i want ( using everything but snapshot size)
    flyctl postgres create --name $(FLY_DB_APP_NAME) \
        --organization $(FLY_DB_ORG_NAME) \
        --password $(FLY_DB_PASSWORD) \
        --region $(FLY_DB_REGION_NAME) \
        --initial-cluster-size $(FLY_DB_CLUSTER_INIT_SIZE) \
        --vm-size $(FLY_DB_VM_SIZE) \
        --volume-size $(FLY_DB_VOLUME_SIZE) \

fly-db-create-rpl:
    # works :)
    # walk through.. 
    flyctl postgres create
    # then save in the makefile vars or .env

fly-db-enums:
    # works :)
    # list of regions
    flyctl platform regions

    # list of vm sizes
    flyctl platform vm-sizes

fly-db-status-enums:
    # works :)
    # just opens the web url for global status
    flyctl platform status

fly-db-create-delete:
    # works :)
    # its itself an app. will ask for confirm 
    flyctl apps destroy $(FLY_DB_APP_NAME)

fly-db-status:
    # works :)
    flyctl status -a $(FLY_DB_APP_NAME)
fly-db-users:
    flyctl postgres users list $(FLY_DB_HOST_NAME) --app $(FLY_DB_APP_NAME)

fly-db-rpl:
    # from a wireguard tunnel
    psql postgres://postgres:secret123@appname.internal:**5432**

fly-db-attach:
    flyctl postgres attach --postgres-app mypostgres
fly-db-deattach:
    flyctl postgres detach -a $(FLY_DB_APP_NAME) --postgres-app postgres-app-name

fly-db-databases-list:
    flyctl postgres db list $(FLY_DB_HOST_NAME) -a $(FLY_DB_APP_NAME)
melvincarvalho commented 1 year ago

I signed up for fly.io (without a credit card tho) and tried to deploy the server, but didnt seem to manage it. Im not too sure how fly works or how to create a docker image. But I've tested the Dockerfile locally and it works.