├── .github ├── _config.yml ├── stale.yml ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ └── build-and-push.yml ├── Dockerfile ├── conf ├── config.js └── about.md ├── LICENSE └── README.md /.github/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | MAINTAINER Markus Kosmal 3 | 4 | RUN apk --update add --no-cache git 5 | RUN git clone https://github.com/seejohnrun/haste-server.git /opt/haste 6 | WORKDIR /opt/haste 7 | RUN rm /opt/haste/about.md 8 | ADD conf/about.md /opt/haste/ 9 | RUN apk del git && \ 10 | npm install 11 | 12 | ADD conf/config.js /opt/haste/config.js 13 | 14 | VOLUME ["/opt/haste"] 15 | 16 | EXPOSE 80 17 | CMD ["npm", "start"] 18 | -------------------------------------------------------------------------------- /conf/config.js: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "host": "0.0.0.0", 4 | "port": 80, 5 | 6 | "keyLength": 10, 7 | 8 | "maxLength": 400000, 9 | 10 | "staticMaxAge": 86400, 11 | 12 | "recompressStaticAssets": true, 13 | 14 | "logging": [ 15 | { 16 | "level": "error", 17 | "type": "Console", 18 | "colorize": true 19 | } 20 | ], 21 | 22 | "keyGenerator": { 23 | "type": "phonetic" 24 | }, 25 | 26 | "storage": { 27 | "type": "file", 28 | "path": "./data" 29 | }, 30 | 31 | "documents": { 32 | "about": "./about.md" 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 21 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 10 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Host (please complete the following information):** 27 | - OS: [e.g. Azure, debian] 28 | - Version [e.g. 22] 29 | 30 | **Image (please complete the following information):** 31 | - Tag: [e.g. alpine] 32 | - Configuration: [e.g. networks, routes, ports] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Markus Kosmal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/build-and-push.yml: -------------------------------------------------------------------------------- 1 | name: build-and-push 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the master branch 5 | on: 6 | push: 7 | branches: [ master ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | tag: ["latest"] 17 | include: 18 | - tag: "latest" 19 | path: "." 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | with: 24 | fetch-depth: 0 25 | 26 | - name: Docker Setup QEMU 27 | uses: docker/setup-qemu-action@v1.0.1 28 | 29 | - name: Set up Docker Buildx 30 | uses: docker/setup-buildx-action@v1 31 | 32 | - name: Login to DockerHub 33 | uses: docker/login-action@v1 34 | with: 35 | username: ${{ secrets.DOCKERHUBUSERNAME }} 36 | password: ${{ secrets.DOCKERHUBTOKEN }} 37 | 38 | - name: Build and Push 39 | uses: docker/build-push-action@v2.0.1 40 | with: 41 | tags: | 42 | mkodockx/docker-pastebin:${{ matrix.tag }} 43 | file: ${{ matrix.path }}/Dockerfile 44 | context: ${{ matrix.path }} 45 | platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 46 | push: true 47 | -------------------------------------------------------------------------------- /conf/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | Simple paste bin container. 4 | 5 | # Haste 6 | 7 | Sharing code is a good thing, and it should be _really_ easy to do it. 8 | A lot of times, I want to show you something I'm seeing - and that's where we 9 | use pastebins. 10 | 11 | Haste is the prettiest, easiest to use pastebin ever made. 12 | 13 | ## Basic Usage 14 | 15 | Type what you want me to see, click "Save", and then copy the URL. Send that 16 | URL to someone and they'll see what you see. 17 | 18 | To make a new entry, click "New" (or type 'control + n') 19 | 20 | ## From the Console 21 | 22 | Most of the time I want to show you some text, its coming from my current 23 | console session. We should make it really easy to take code from the console 24 | and send it to people. 25 | 26 | `cat something | haste` # http://hastebin.com/1238193 27 | 28 | You can even take this a step further, and cut out the last step of copying the 29 | URL with: 30 | 31 | * osx: `cat something | haste | pbcopy` 32 | * linux: `cat something | haste | xsel` 33 | * windows: check out [WinHaste](https://github.com/ajryan/WinHaste) 34 | 35 | After running that, the STDOUT output of `cat something` will show up at a URL 36 | which has been conveniently copied to your clipboard. 37 | 38 | That's all there is to that, and you can install it with `gem install haste` 39 | right now. 40 | * osx: you will need to have an up to date version of Xcode 41 | * linux: you will need to have rubygems and ruby-devel installed 42 | 43 | ## Duration 44 | 45 | Pastes will stay for 30 days from their last view. They may be removed earlier 46 | and without notice. 47 | 48 | ## Author 49 | 50 | Code by John Crepezzi 51 | Key Design by Brian Dawson 52 | 53 | Extended by Markus Kosmal 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-pastebin 2 | A dev oriented pastebin like container for sharing code and text. A lot more usefull though, thanking [John Crepezzi](https://github.com/seejohnrun) Paste your stuff however :) 3 | 4 | [![build-and-push](https://github.com/mko-x/docker-pastebin/actions/workflows/build-and-push.yml/badge.svg)](https://github.com/mko-x/docker-pastebin/actions/workflows/build-and-push.yml) 5 | 6 | # Quickstart 7 | 8 | ## Run 9 | ```bash 10 | docker run --name pastebin -p 80:80 mkodockx/docker-pastebin 11 | ``` 12 | 13 | ## Compose 14 | ```yaml 15 | pastebin: 16 | image: mkodockx/docker-pastebin 17 | ``` 18 | # Settings 19 | 20 | ## Overview 21 | 22 | * `host` - the host the server runs on (default localhost) 23 | * `port` - the port the server runs on (default 7777) 24 | * `keyLength` - the length of the keys to user (default 10) 25 | * `maxLength` - maximum length of a paste (default none) 26 | * `staticMaxAge` - max age for static assets (86400) 27 | * `recompressStatisAssets` - whether or not to compile static js assets (true) 28 | * `documents` - static documents to serve (ex: http://hastebin.com/about.com) 29 | in addition to static assets. These will never expire. 30 | * `storage` - storage options (see below) 31 | * `logging` - logging preferences 32 | * `keyGenerator` - key generator options (see below) 33 | 34 | ## Details 35 | 36 | For easy use the details are almost equal to the originals. You can find original configuration documentation at [John's github page](https://github.com/seejohnrun/haste-server/blob/master/README.md) 37 | 38 | ### Key Generation 39 | 40 | #### Phonetic 41 | 42 | Attempts to generate phonetic keys, similar to `pwgen` 43 | 44 | ``` json 45 | { 46 | "type": "phonetic" 47 | } 48 | ``` 49 | 50 | #### Random 51 | 52 | Generates a random key 53 | 54 | ``` json 55 | { 56 | "type": "random", 57 | "keyspace": "abcdef" 58 | } 59 | ``` 60 | 61 | The _optional_ keySpace argument is a string of acceptable characters 62 | for the key. 63 | 64 | ### Storage 65 | 66 | #### File 67 | 68 | To use file storage (the default) change the storage section in `config.js` to 69 | something like: 70 | 71 | ``` json 72 | { 73 | "path": "./data", 74 | "type": "file" 75 | } 76 | ``` 77 | 78 | Where `path` represents where you want the files stored 79 | 80 | #### Redis 81 | 82 | To use redis storage you must install the redis package in npm 83 | 84 | `npm install redis` 85 | 86 | Once you've done that, your config section should look like: 87 | 88 | ``` json 89 | { 90 | "type": "redis", 91 | "host": "localhost", 92 | "port": 6379, 93 | "db": 2 94 | } 95 | ``` 96 | 97 | You can also set an `expire` option to the number of seconds to expire keys in. 98 | This is off by default, but will constantly kick back expirations on each view 99 | or post. 100 | 101 | All of which are optional except `type` with very logical default values. 102 | 103 | #### Memcached 104 | 105 | To use memcached storage you must install the `memcache` package via npm 106 | 107 | `npm install memcache` 108 | 109 | Once you've done that, your config section should look like: 110 | 111 | ``` json 112 | { 113 | "type": "memcached", 114 | "host": "127.0.0.1", 115 | "port": 11211 116 | } 117 | ``` 118 | 119 | You can also set an `expire` option to the number of seconds to expire keys in. 120 | This behaves just like the redis expirations, but does not push expirations 121 | forward on GETs. 122 | 123 | All of which are optional except `type` with very logical default values. 124 | 125 | # Clients 126 | 127 | ## Web 128 | After starting the container you can navigate to 'targethost:targetport' and start using the bin via your browser. 129 | 130 | ## Linux & OSX (ruby) 131 | ### Install 132 | 133 | Usually ruby is provided by OSX basic installation. 134 | 135 | If your Linux Distro doesn't have ruby, you may want to install it. You should include the dev variant, as several games depend on them e.g. 136 | 137 | #### Ubuntu/Debian 138 | ```bash 139 | apt-get install ruby-dev 140 | ``` 141 | 142 | #### RHEL/CentOS 143 | ```bash 144 | yum install ruby-dev 145 | ``` 146 | ### Client Install 147 | 148 | After you ensure to have ruby installed use the following instruction. 149 | 150 | ```bash 151 | gem install haste 152 | ``` 153 | ### Usage 154 | #### Add Content 155 | ```bash 156 | cat file | haste 157 | ``` 158 | #### Read content 159 | ```bash 160 | haste file 161 | ``` 162 | 163 | ## Non-Ruby install 164 | For those who don't like great ruby stuff - you may use following script as an alternative. 165 | 166 | ``` bash 167 | haste() { a=$(cat); curl -X POST -s -d "$a" http://hastebin.com/documents | awk -F '"' '{print "http://hastebin.com/"$4}'; } 168 | ``` 169 | 170 | ## Windows 171 | If you want to acces via Windows have a look at [Aidan Ryan's WinHaste](https://github.com/ajryan/WinHaste) 172 | 173 | # Issues 174 | 175 | For issues please stick to [github's issue tracker](https://github.com/mko-x/docker-pastebin/issues). 176 | --------------------------------------------------------------------------------