No description
Find a file
Gunwant Jain e17a5f7cdb Docker, Cargo: Add multi-arch builds for arm64, x86_64
Builds static binaries instead to be runnable from scratch. This eases
the build process, as we don't have to depend on docker's buildx.
Now images for both arm64 and x86_64 can be built on x86_64 platform
alone.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-18 10:07:26 +05:30
.cargo Docker, Cargo: Add multi-arch builds for arm64, x86_64 2022-01-18 10:07:26 +05:30
src cargo update, fmt and add rust_embed crate 2022-01-16 23:11:38 +05:30
static PrettyPaste: Add Fork and New button 2022-01-16 14:24:10 +05:30
templates PrettyPaste: Add Fork and New button 2022-01-16 14:24:10 +05:30
themes templates: add drag and drop func, use ayu dark 2021-07-08 18:51:20 +05:30
.dockerignore dockerignore: add dockerignore 2021-01-06 06:16:05 +05:30
.gitignore add /p/<id> routes 2020-12-29 17:37:29 +05:30
Cargo.lock cargo update, fmt and add rust_embed crate 2022-01-16 23:11:38 +05:30
Cargo.toml cargo update, fmt and add rust_embed crate 2022-01-16 23:11:38 +05:30
client client: write a simple client for the pastebin 2021-07-13 21:23:34 +05:30
copying license: lgpl license 2021-01-11 20:41:14 +05:30
docker-compose.yml docker: Use multi-stage docker builds 2022-01-16 22:04:05 +05:30
Dockerfile Docker, Cargo: Add multi-arch builds for arm64, x86_64 2022-01-18 10:07:26 +05:30
readme.md docker-compose, readme: s/HOST/HOST_URL/ 2021-01-06 06:15:03 +05:30

Usage

    POST    / 

        accepts raw data in the body of the request and responds with a URL
        of a page containing the body's content

    GET     /<id>

        retrieves the content for the paste with id `<id>`

    GET     /p/<id>

        retrieves the HTML page with syntax-highlighted content for the paste with id `<id>`

Examples

    Paste a file named 'file.txt' using cURL:

        curl --data-binary @file.txt https://bin.wantguns.dev

    Paste from stdin using cURL:

        echo "Hello, world." | curl --data-binary @- https://bin.wantguns.dev

    Add this to your .zshrc to implement a quicker usage.

        function paste() {
          local file=${1:-/dev/stdin}
          curl --data-binary @${file} https://bin.wantguns.dev
        }

    If the uploaded data binary is parsed as "text/*", then the paste will be syntax
    highlighted

Deployment

Traefik

## (... Traefik service configuration ...) ##

   pastebin:
     image: wantguns/bin
     restart: always
     container_name: pastebin
     ports:
       - 127.0.0.1:6162:6162
     environment:
       - ROCKET_PORT=6162
       - THEME=
       - HOST_URL=${BIN_DOMAIN}
     volumes:
       - /path/to/local/upload:/app/upload
     labels:
       - "traefik.enable=true"
       - "traefik.http.routers.pastebin.rule=Host(`${BIN_DOMAIN}`)"
       - "traefik.http.routers.pastebin.entrypoints=secure"
       - "traefik.http.routers.pastebin.tls.certresolver=le"
       - "traefik.http.services.pastebin.loadbalancer.server.port=6162"
     networks:
       - bin_network

networks:
  - bin_network