MicroBin is a tiny, feature rich, configurable, self-contained, and self-hosted paste bin web application. It is elementary to set up and use, and will only require a few megabytes of memory and disk storage.
Fly.io
Fly.io is a platform for running full-stack applications and databases close to the users without any DevOps. You can deploy your apps to Fly.io (it's about the simplest place to deploy a Docker Image) and use our CLI to launch instances in regions that are most important for their application.
Structure of MicroBin
Step 1:
Clone your repository
git clone https://github.com/manjularajamani/microbin.git
cd microbin/
Step 2:
Using Dockerfile(or pre-built Docker images)we can able to deploy the application on the fly.io app server
FROM rust:latest as build
WORKDIR /app
COPY . .
RUN \
DEBIAN_FRONTEND=noninteractive \
apt-get update &&\
apt-get -y install ca-certificates tzdata &&\
CARGO_NET_GIT_FETCH_WITH_CLI=true \
cargo build --release
# https://hub.docker.com/r/bitnami/minideb
FROM bitnami/minideb:latest
# microbin will be in /app
WORKDIR /app
# copy time zone info
COPY --from=build \
/usr/share/zoneinfo \
/usr/share/zoneinfo
COPY --from=build \
/etc/ssl/certs/ca-certificates.crt \
/etc/ssl/certs/ca-certificates.crt
# copy built executable
COPY --from=build \
/app/target/release/microbin \
/usr/bin/microbin
# Expose webport used for the webserver to the docker runtime
EXPOSE 8080
ENTRYPOINT ["microbin"]
Or fetch Docker image from DockerHub: danielszabo99/microbin:latest
Step 3:
Install flyctl:
flyctl is a command line interface to the Fly.io platform.It allows users to manage authentication, application launch, deployment, network configuration, logging and more with just the one command.Install Flyctl CLI
Sign In:
If you already have a Fly.io account, all you need to do is sign in with flyctl
fly auth login
Your browser will open up with the Fly.io sign-in screen, enter your user name and password to sign in.
Step 4:
To deploy app into fly.io we need a fly.toml
file
app = "microbin"
primary_region = "ams"
kill_signal = "SIGINT"
kill_timeout = "5s"
[experimental]
entrypoint = ["microbin", "--highlightsyntax", "--private", "--qr", "--editable", "--enable-burn-after"]
[build]
image = "danielszabo99/microbin:latest"
[[mounts]]
source = "microbin_data"
destination = "/app/pasta_data"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
I've added only a few things that are enough for micro microbin
kill_signal:
The kill_signal option allows you to change what signal is sent so that you can trigger a softer, less disruptive shutdown.kill_timeout:
When shutting down a Fly app instance, by default, after sending a signal, Fly gives an app instance five seconds to close down before being killed.experimental:
This section is for flags and feature settings which have yet to be promoted into the main configuration.build:
The image builder is used when you want to immediately deploy an existing public imagemounts:
This section supports the Volumes feature for persistent storageauto_stop_machines:
Whether to automatically stop an application's machines when there's excess capacity, per region.auto_start_machines:
Whether to automatically start an application's machines when a new request is made to the application and there's no excess capacity, per region.
Step 5:
Launch an App on Fly:
Fly.io enables you to deploy almost any kind of app using a Docker image.
flyctl launch
(or)
flyctl launch --image danielszabo99/microbin:latest
If you need to edit fly.toml
and redeploy use the below command
flyctl deploy
Check Your App's Status:
The application has been deployed with a DNS hostname of microbin.fly.dev
. Your deployment's name will, of course, be different. fly status
give us basic details
flyctl status
Step 6:
The DESTROY command will remove an application from the Fly platform.
flyctl destroy <APPNAME>
Adding Custom Domains
Fly offers a simple command-line process for the manual configuration of custom domains and for people integrating Fly custom domains into their automated workflows.
Step 1:
Run flyctl ips list
to see your app's addresses
flyctl ips list
Create an A record pointing to your v4 address, and an AAAA record pointing to your v6 address on your respective DNS.
Step 2:
You can add the custom domain to the application's certificates.
flyctl certs create <domain.name>
Step 3:
You can check on the progress by running the below command
flyctl certs show <domain.name>
Once the certificate is issued you can access your application to your Domain
Step 4:
To remove the hostname from the application, drop the certificates in the process.
flyctl certs delete <domain.name>