Skip to content

Commit

Permalink
update dockerfile in katbin to include default DATABASE_URL; update R…
Browse files Browse the repository at this point in the history
…EADME
  • Loading branch information
liuwen committed Aug 23, 2024
1 parent 561e65a commit e5aa6ab
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ graph TD
## Services

### Caddy
Custom Caddy server with additional modules. See `services/caddy/README.md` for details.
Custom Caddy server with additional modules. See `caddy/README.md` for details.

### Katbin
A pastebin service written in Kotlin. See `katbin/README.md` for details. This service is included as a git submodule and built from source.
A pastebin service written in Elixir. See `katbin/README.md` for details. This service is included as a git submodule and built from source.

### [Other Service]
[Brief description of other service. Add as implemented.]
Expand Down
7 changes: 7 additions & 0 deletions katbin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,11 @@ USER nobody

ENV HOME=/app

# Set default environment variables
ENV DATABASE_URL='postgres://postgres:postgres@db:5432/katbin'
ENV SECRET_KEY_BASE='default_secret_key_base_change_me_in_production'
ENV SWOOSH_USERNAME='noreply@katb.in'
ENV SWOOSH_PASSWORD='default_password_change_me'
ENV SWOOSH_SMTP_RELAY='smtp.example.com'

CMD ["/app/startup.sh"]
77 changes: 64 additions & 13 deletions katbin/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,76 @@
# Katbin

This directory contains the configuration for Katbin, a pastebin service written in Elixir, as part of the versatile package manager.
This directory contains the configuration for Katbin, a pastebin service written in Elixir.

## Features
## Prerequisites

- Pastebin functionality
- Written in Elixir
- Containerized for easy deployment
- Docker and Docker Compose installed
- Access to the Katbin Docker image

## Files
## Setup and Usage

- `Dockerfile`: Defines the Katbin build and runtime environment
- `source/`: Git submodule containing the Katbin source code
1. Create a `docker-compose.yml` file:

## Usage
```yaml

1. Ensure you've initialized and updated the git submodule:
services:
katbin-db:
image: postgres:16-alpine
container_name: katbin-db
environment:
POSTGRES_DB: katbin
POSTGRES_USER: postgres
POSTGRES_PASSWORD: katbin
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- katbin-network

katbin:
image: ghcr.io/somehow22/katbin
depends_on:
- katbin-db
ports:
- "8080:8080"
env_file:
- .env
networks:
- katbin-network

volumes:
postgres_data:

networks:
katbin-network:
```
2. Generate a SECRET_KEY_BASE:
```
openssl rand -base64 64
```
Copy the output for use in the next step.

3. Create a `.env` file and configure the environment variables:
```
git submodule update --init --recursive
DATABASE_URL=postgres://postgres:katbin@db:5432/katbin
SECRET_KEY_BASE=<paste_generated_secret_here>
SWOOSH_USERNAME=your_email@example.com
SWOOSH_PASSWORD=your_email_password
SWOOSH_SMTP_RELAY=smtp.your-email-provider.com
```
2. Build the Docker image using the provided Dockerfile
3. Run the container, exposing the necessary ports
Be sure to replace the placeholders with your actual SMTP credentials.

4. Start the services:
```
docker-compose up -d
```

5. Check the logs:
```
docker-compose logs -f katbin
```
Look for any error messages or confirmation that the service has started successfully.

6. Access Katbin at `http://localhost:8080`

For more details on Katbin, please refer to the original project: [https://github.com/sphericalkat/katbin](https://github.com/sphericalkat/katbin)

0 comments on commit e5aa6ab

Please sign in to comment.