项目作者: daystram

项目描述 :
URL, snippet, and file sharing with ease.
高级语言: Vue
项目地址: git://github.com/daystram/cut.git
创建时间: 2021-01-13T13:25:40Z
项目社区:https://github.com/daystram/cut

开源协议:MIT License

下载


:clipboard: Cut

Github Actions
Docker Pulls
MIT License

URL, snippet, and file sharing with ease. All content shared via Cut is ephemeral, only in-memory storage is used.

Features

  • URL shortener
  • Snippet editor with code highlighter
  • Ephemeral file sharing
  • Set expiry to shared content (with ‘Burn on Read’)
  • Raw content endpoint (302 redirect, text response, or Content-Disposition download, respectively)

Services

The application comes in two parts:

Name Code Name Stack
Back-end cut-be Rust, Actix Web, Redis
Front-end cut-fe TypeScript, Vue.js

Develop

cut-be

To ease development, cargo-watch is used to live-reload the application. Install the tool as documented.

To begin developing, simply enter the sub-directory and run the development server:

  1. $ cd cut-be
  2. $ cargo watch -x 'run'

cut-fe

Populate .env.development with the required credentials.

To begin developing, simply enter the sub-directory and run the development server:

  1. $ cd cut-fe
  2. $ yarn
  3. $ yarn serve

Deploy

cut-be, and cut-fe are containerized and pushed to Docker Hub. They are tagged based on their application name and version, e.g. daystram/cut:be or daystram/cut:be-v2.0.1.

To run cut-be, run the following:

  1. $ docker run --name cut-be --env-file ./.env -p 8080:8080 -d daystram/cut:be

And cut-fe as follows:

  1. $ docker run --name cut-fe -p 80:80 -d daystram/cut:fe

Dependencies

The following are required for cut-be to function properly:

Their credentials must be provided in their respective services’ configuration file.

Helm Chart

To deploy to a Kubernetes cluster, Helm charts could be used. Add the repository:

  1. $ helm repo add daystram https://charts.daystram.com
  2. $ helm repo update

Ensure you have the secrets created for cut-be by providing the secret name in values.yaml, or creating the secret from a populated .env file (make sure it is on the same namespace as cut installation):

  1. $ kubectl create secret generic secret-cut-be --from-env-file=.env

And install cut:

  1. $ helm install cut daystram/cut

You can override the chart values by providing a values.yaml file via the --values flag.

Pre-release and development charts are accessible using the --devel flag. To isntall the development chart, provide the --set image.tag=dev flag, as development images are deployed with the suffix dev.

Docker Compose

For ease of deployment, the following docker-compose.yml file can be used to orchestrate the stack deployment:

  1. version: "3"
  2. services:
  3. cut-be:
  4. image: daystram/cut:be
  5. ports:
  6. - "8080:8080"
  7. env_file:
  8. - /path_to_env_file/.env
  9. restart: unless-stopped
  10. cut-fe:
  11. image: daystram/cut:fe
  12. ports:
  13. - "80:80"
  14. restart: unless-stopped
  15. redis:
  16. image: redis:6.0-alpine
  17. expose:
  18. - 6379
  19. volumes:
  20. - /path_to_redis_data:/data
  21. restart: unless-stopped

License

This project is licensed under the MIT License.