Skip to content

add privatebin docs #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/services/paste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Pastebin
author:
- wizzdom
tags:
- aperture
- nomad
- docker
---

# Pastebin - `wizzdom`

Redbrick currently uses [Privatebin](https://github.com/PrivateBin/PrivateBin) as a paste utility accessible at [paste.redbrick.dcu.ie](https://paste.redbrick.dcu.ie) and [paste.rb.dcu.ie](https://paste.rb.dcu.ie)

## Privatebin

The Privatebin instance is deployed with [nomad](nomad.md) on [`aperture`](../hardware/aperture/index.md). Its configuration is available [here](https://github.com/redbrick/nomad/blob/master/jobs/services/privatebin.hcl). Privatebin doesn't support full configuration via environment variables but instead uses a `conf.php` file. This is passed in using [nomad templates](https://developer.hashicorp.com/nomad/docs/job-specification/template) .

All sensitive variables are stored in the [`consul`](consul.md) KV store.

The main points are as follows:

- configure URL shortener ([`shlink`](shlink.md))

```php
urlshortener = "https://s.rb.dcu.ie/rest/v1/short-urls/shorten?apiKey={{ key "privatebin/shlink/api" }}&format=txt&longUrl="
```

- enable file upload, set file size limit and enable compression

```php
fileupload = true
sizelimit = 10485760
compression = "zlib"
```

- Connect to PostgreSQL database

```php
[model]
class = Database
[model_options]
dsn = "pgsql:host=postgres.service.consul;dbname={{ key "privatebin/db/name" }}"
tbl = "privatebin_" ; table prefix
usr = "{{ key "privatebin/db/user" }}"
pwd = "{{ key "privatebin/db/password" }}"
opt[12] = true ; PDO::ATTR_PERSISTENT ; use persistent connections - default
```