Add self hosting docs (#34)

* Add self host docs

* Add more documentation
This commit is contained in:
KM Koushik
2024-06-28 20:10:18 +10:00
committed by GitHub
parent 88549febfe
commit 6af2521ebb
18 changed files with 332 additions and 10 deletions

68
docker/README.md Normal file
View File

@@ -0,0 +1,68 @@
# Docker Setup for Unsend
The following guide will walk you through setting up Unsend using Docker. You can choose between a production setup using Docker Compose or a standalone container.
## Prerequisites
Before you begin, ensure that you have the following installed:
- Docker
- Docker Compose (if using the Docker Compose setup)
## Option 1: Production Docker Compose Setup
This setup includes PostgreSQL, Redis and the Unsend application.
1. Download the Docker Compose file from the Unsend repository: [compose.yml](https://github.com/unsend-dev/unsend/blob/main/docker/prod/compose.yml)
2. Navigate to the directory containing the `compose.yml` file.
3. Create a `.env` file in the same directory. Copy the contents of `.env.selfhost.example`
4. Run the following command to start the containers:
```
docker-compose --env-file ./.env up -d
```
This will start the PostgreSQL database, Redis and the Unsend application containers.
5. Access the Unsend application by visiting `http://localhost:3000` in your web browser.
## Option 2: Standalone Docker Container
If you prefer to host the Unsend application on your container provider of choice, you can use the pre-built Docker image from DockerHub or GitHub's Package Registry. Note that you will need to provide your own database and SMTP host.
1. Pull the Unsend Docker image:
```
docker pull unsend/unsend
```
Or, if using GitHub's Package Registry:
```
docker pull ghcr.io/unsend-dev/unsend
```
2. Run the Docker container, providing the necessary environment variables for your database and SMTP host:
```
docker run -d \
-p 3000:3000 \
-e NEXTAUTH_URL="<your-nextauth-url>"
-e NEXTAUTH_SECRET="<your-nextauth-secret>"
-e DATABASE_URL="<your-next-private-database-url>"
-e REDIS_URL="<your-next-private-redis-url>"
-e AWS_ACCESS_KEY="<your-next-private-aws-access-key-id>"
-e AWS_SECRET_KEY="<your-next-private-aws-secret-access-key>"
-e AWS_DEFAULT_REGION="<your-next-private-aws-region>"
-e GITHUB_ID="<your-next-private-github-id>"
-e GITHUB_SECRET="<your-next-private-github-secret>"
unsend/unsend
```
Replace the placeholders with your actual database and aws details.
1. Access the Unsend application by visiting the URL you provided in the `NEXTAUTH_URL` environment variable in your web browser.
## Success
You have now successfully set up Unsend using Docker. You can start sending emails efficiently. If you encounter any issues or have further questions, please refer to the official Unsend documentation or seek assistance from the community.