Docker setup script

Plus added gitignore for docker volume
This commit is contained in:
Daniel Szabo 2023-07-02 13:04:28 +03:00
parent b414e1f11f
commit 7c88276a63
4 changed files with 87 additions and 14 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ target/
pasta_data/*
*.env
**/**/microbin-data

View file

@ -11,29 +11,21 @@
MicroBin is a super tiny, feature rich, configurable, self-contained and self-hosted paste bin web application. It is very easy to set up and use, and will only require a few megabytes of memory and disk storage. It takes only a couple minutes to set it up, why not give it a try now?
Install it from Cargo:
Run our quick docker setup script ([DockerHub](https://hub.docker.com/r/danielszabo99/microbin)):
```bash
cargo install microbin
sudo sh -c 'curl -s https://raw.githubusercontent.com/szabodanika/microbin/master/docker-setup.sh | bash'
```
Download the configuration file and edit it the way you see fit.
```bash
curl -L -O https://raw.githubusercontent.com/szabodanika/microbin/master/.env
```
Or install it manually from [Cargo](https://crates.io/crates/microbin):
Register your configuration:
```bash
source .env
```
And finally run MicroBin:
```bash
cargo install microbin;
curl -L -O https://raw.githubusercontent.com/;szabodanika/microbin/master/.env;
source .env;
microbin
```
Or get the Docker Image from [Dockerhub: danielszabo99/microbin](https://hub.docker.com/r/danielszabo99/microbin).
On our website [microbin.eu](https://microbin.eu) you will find the following:
- [Screenshots](https://microbin.eu/screenshots/)

45
compose.yaml Normal file
View file

@ -0,0 +1,45 @@
services:
microbin:
image: danielszabo99/microbin:2.0.0-beta1
restart: always
ports:
- "${MICROBIN_PORT}:8080"
volumes:
- ./microbin-data:/app/pasta_data
environment:
MICROBIN_BASIC_AUTH_USERNAME: ${MICROBIN_BASIC_AUTH_USERNAME}
MICROBIN_BASIC_AUTH_PASSWORD: ${MICROBIN_BASIC_AUTH_PASSWORD}
MICROBIN_ADMIN_USERNAME: ${MICROBIN_ADMIN_USERNAME}
MICROBIN_ADMIN_PASSWORD: ${MICROBIN_ADMIN_PASSWORD}
MICROBIN_EDITABLE: ${MICROBIN_EDITABLE}
MICROBIN_FOOTER_TEXT: ${MICROBIN_FOOTER_TEXT}
MICROBIN_HIDE_FOOTER: ${MICROBIN_HIDE_FOOTER}
MICROBIN_HIDE_HEADER: ${MICROBIN_HIDE_HEADER}
MICROBIN_HIDE_LOGO: ${MICROBIN_HIDE_LOGO}
MICROBIN_NO_LISTING: ${MICROBIN_NO_LISTING}
MICROBIN_HIGHLIGHTSYNTAX: ${MICROBIN_HIGHLIGHTSYNTAX}
MICROBIN_BIND: ${MICROBIN_BIND}
MICROBIN_PRIVATE: ${MICROBIN_PRIVATE}
MICROBIN_PURE_HTML: ${MICROBIN_PURE_HTML}
MICROBIN_JSON_DB: ${MICROBIN_JSON_DB}
MICROBIN_PUBLIC_PATH: ${MICROBIN_PUBLIC_PATH}
MICROBIN_SHORT_PATH: ${MICROBIN_SHORT_PATH}
MICROBIN_READONLY: ${MICROBIN_READONLY}
MICROBIN_SHOW_READ_STATS: ${MICROBIN_SHOW_READ_STATS}
MICROBIN_TITLE: ${MICROBIN_TITLE}
MICROBIN_THREADS: ${MICROBIN_THREADS}
MICROBIN_GC_DAYS: ${MICROBIN_GC_DAYS}
MICROBIN_ENABLE_BURN_AFTER: ${MICROBIN_ENABLE_BURN_AFTER}
MICROBIN_DEFAULT_BURN_AFTER: ${MICROBIN_DEFAULT_BURN_AFTER}
MICROBIN_WIDE: ${MICROBIN_WIDE}
MICROBIN_QR: ${MICROBIN_QR}
MICROBIN_ETERNAL_PASTA: ${MICROBIN_ETERNAL_PASTA}
MICROBIN_ENABLE_READONLY: ${MICROBIN_ENABLE_READONLY}
MICROBIN_DEFAULT_EXPIRY: ${MICROBIN_DEFAULT_EXPIRY}
MICROBIN_NO_FILE_UPLOAD: ${MICROBIN_NO_FILE_UPLOAD}
MICROBIN_CUSTOM_CSS: ${MICROBIN_CUSTOM_CSS}
MICROBIN_HASH_IDS: ${MICROBIN_HASH_IDS}
MICROBIN_ENCRYPTION_CLIENT_SIDE: ${MICROBIN_ENCRYPTION_CLIENT_SIDE}
MICROBIN_ENCRYPTION_SERVER_SIDE: ${MICROBIN_ENCRYPTION_SERVER_SIDE}
MICROBIN_MAX_FILE_SIZE_ENCRYPTED_MB: ${MICROBIN_MAX_FILE_SIZE_ENCRYPTED_MB}
MICROBIN_MAX_FILE_SIZE_UNENCRYPTED_MB: ${MICROBIN_MAX_FILE_SIZE_UNENCRYPTED_MB}

35
docker-setup.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# Check if wget is installed; if not, try to use curl
if ! command -v wget &> /dev/null
then
download_command="curl -O"
else
download_command="wget"
fi
# Get installation directory from user
echo -e "\033[1mEnter installation directory (default is /usr/share/microbin):\033[0m"
read install_dir
install_dir=${install_dir:-/usr/share/microbin}
# Create directory and download files
mkdir -p $install_dir
cd $install_dir
$download_command https://raw.githubusercontent.com/szabodanika/microbin/master/.env
$download_command https://raw.githubusercontent.com/szabodanika/microbin/master/compose.yaml
# Get public path URL and port from user
echo -e "\033[1mEnter public path URL (e.g. https://microbin.myserver.net or http://localhost:8080):\033[0m"
read public_path
echo -e "\033[1mEnter port number (default is 8080):\033[0m"
read port
port=${port:-8080}
# Update environment variables in .env file
sed -i "s|MICROBIN_PUBLIC_PATH=.*|MICROBIN_PUBLIC_PATH=${public_path}|" .env
sed -i "s|MICROBIN_PORT=.*|MICROBIN_PORT=${port}|" .env
# Start Microbin using Docker Compose
docker compose --env-file .env up --detach