130 lines
3.4 KiB
Plaintext
130 lines
3.4 KiB
Plaintext
---
|
|
title: "Docker Deployment"
|
|
description: "Deploy OpnForm using Docker"
|
|
---
|
|
|
|
import CloudVersion from "/snippets/cloud-version.mdx";
|
|
|
|
<CloudVersion/>
|
|
|
|
<Tip>
|
|
This guide is for deploying OpnForm on a production server. If you're looking to **develop OpnForm locally**, check out our [Docker Development Setup](/deployment/docker-development) guide which provides **hot-reload and other development features**.
|
|
</Tip>
|
|
|
|
## Prerequisites
|
|
|
|
- Docker
|
|
- Docker Compose
|
|
|
|
## Quick Start
|
|
|
|
1. Clone the repository:
|
|
|
|
```bash
|
|
git clone https://github.com/JhumanJ/OpnForm.git
|
|
cd OpnForm
|
|
```
|
|
|
|
2. Set up environment files:
|
|
|
|
```bash
|
|
./scripts/setup-env.sh --docker
|
|
```
|
|
|
|
3. (Optional) Customize the environment variables:
|
|
|
|
You can modify two environment files to customize your OpnForm installation:
|
|
- The `.env` file in the `api` directory for backend configuration
|
|
- The `.env` file in the `client` directory for frontend configuration
|
|
|
|
For more information on available environment variables, please refer to our [Environment Variables](/configuration/environment-variables) page.
|
|
|
|
4. Start the application:
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
5. Access OpnForm at http://localhost
|
|
|
|
|
|
### Initial Login
|
|
|
|
After installation, use these credentials to access the app:
|
|
|
|
- Email: `admin@opnform.com`
|
|
- Password: `password`
|
|
|
|
You will be prompted to change your email and password after your first login.
|
|
|
|
<Note>Public registration is disabled in the self-hosted version. Use the admin account to invite additional users.</Note>
|
|
|
|
## Docker Images
|
|
|
|
OpnForm provides pre-built Docker images for easy deployment. You can find our official Docker images on Docker Hub:
|
|
|
|
- [OpnForm API Image](https://hub.docker.com/r/jhumanj/opnform-api)
|
|
- [OpnForm Client Image](https://hub.docker.com/r/jhumanj/opnform-client)
|
|
|
|
We recommend using these official images for your OpnForm deployment.
|
|
|
|
|
|
## Building Your Own Docker Images
|
|
|
|
By default, OpnForm uses pre-built images from Docker Hub. However, if you want to build the images yourself (for development or customization), you have two options:
|
|
|
|
### Option 1: Using Docker Compose (Recommended)
|
|
|
|
The simplest way to build the images is using Docker Compose:
|
|
|
|
```bash
|
|
docker compose build
|
|
```
|
|
|
|
This will build all the necessary images. You can then start the application as usual:
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
### Option 2: Building Images Manually
|
|
|
|
You can also build the images manually using the provided Dockerfiles:
|
|
|
|
1. Build the API image:
|
|
```bash
|
|
docker build -t opnform-api:local -f docker/Dockerfile.api .
|
|
```
|
|
|
|
2. Build the UI image:
|
|
```bash
|
|
docker build -t opnform-ui:local -f docker/Dockerfile.client .
|
|
```
|
|
|
|
If you build the images manually, make sure to update your docker-compose.override.yml to use these local images (see below).
|
|
|
|
### Overriding Docker Compose Configuration
|
|
|
|
You can override the default Docker Compose configuration by creating a `docker-compose.override.yml` file. This allows you to customize various aspects of the deployment without modifying the main `docker-compose.yml` file.
|
|
|
|
Example `docker-compose.override.yml`:
|
|
|
|
```yaml
|
|
services:
|
|
api:
|
|
image: opnform-api:local
|
|
ui:
|
|
image: opnform-ui:local
|
|
api-worker:
|
|
image: opnform-api:local
|
|
```
|
|
|
|
|
|
### Clearing all resources
|
|
|
|
To completely remove all Docker containers, networks, and volumes created by Docker Compose and also remove all images used by these services, you can use the following command:
|
|
|
|
```
|
|
docker compose down -v --rmi all
|
|
```
|