Developer docker setup (#683)

* Add build context to compose

Signed-off-by: Daniel Ekman <knegge@gmail.com>

* Update Docker documentation with build instructions

Enhance Docker deployment documentation by:
- Adding detailed instructions for building Docker images
- Providing two methods for image building (Docker Compose and manual)
- Clarifying how to use local images with docker-compose.override.yml

* Add development Docker configuration

Introduce development-specific Docker configuration:
- Create docker-compose.dev.yml for local development setup
- Add nginx.dev.conf with development CORS settings
- Update Dockerfile.api to support environment-specific dependency installation
- Configure development services with appropriate volumes and environment variables

* Improve Docker and Development Documentation

- Remove platform-specific ARM64 constraints in docker-compose.dev.yml
- Enhance Nginx configuration with improved proxy and HMR settings
- Update documentation for development setup and Docker deployment
- Add new Docker development documentation page
- Refactor getting started guide with clearer development instructions

* Enhance Docker configuration and CI/CD pipeline

- Update Docker Compose files with improved service configurations
- Add database healthcheck in docker-compose.yml
- Refactor GitHub Actions workflow for Docker image publishing
- Optimize Dockerfile.api with multi-stage build and environment-specific configurations
- Update Nginx configuration for development and production environments

* Add GitHub Actions permissions for Docker image publishing

Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process

---------

Signed-off-by: Daniel Ekman <knegge@gmail.com>
Co-authored-by: Daniel Ekman <knegge@gmail.com>
This commit is contained in:
Julien Nahum
2025-01-28 17:52:48 +01:00
committed by GitHub
parent ae74f33a27
commit bf85d8fa76
12 changed files with 466 additions and 74 deletions

View File

@@ -1,8 +1,25 @@
---
title: "Getting Started with Contributing"
description: "Learn how to contribute to OpnForm"
title: Getting Started
description: Learn how to contribute to OpnForm
---
## Development Setup
### Docker Setup (Recommended)
The easiest way to get started with OpnForm development is to use our Docker-based development environment. It provides:
- Hot-reload for both frontend and backend
- All necessary services pre-configured
- Consistent development environment across all platforms
Follow our [Docker Development Setup](/deployment/docker-development) guide to get started.
### Manual Setup
If you prefer not to use Docker or need a custom setup, you can follow our [Local Deployment](/deployment/local-deployment#manual-setup) guide for manual installation instructions.
## Contributing Guidelines
Welcome to the OpnForm contributing guide! Here are some helpful links to get you started:
<CardGroup cols={2}>

View File

@@ -0,0 +1,139 @@
---
title: "Docker Development Setup"
description: "Set up OpnForm locally for development using Docker"
---
import CloudVersion from "/snippets/cloud-version.mdx";
<CloudVersion/>
## Overview
OpnForm provides a Docker-based development environment that offers:
- Hot-reload for both frontend and backend
- Xdebug support for PHP debugging
- Automatic dependency management
- PostgreSQL database and Redis setup
- Nginx reverse proxy configuration
This is the recommended way to get started with OpnForm development.
## Prerequisites
- Docker and Docker Compose installed on your machine
- Git installed
- Basic understanding of Docker concepts
## Quick Start
1. Clone the repository:
```bash
git clone https://github.com/JhumanJ/OpnForm.git
cd OpnForm
```
2. Create environment files:
```bash
./scripts/setup-env.sh
```
This will create the necessary `.env` files for both the API and client. See our [Environment Variables](/configuration/environment-variables) guide for configuration details.
3. Start the development environment:
```bash
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
```
4. Access your development environment:
- Frontend: http://localhost:3000
- API: http://localhost/api
### Initial Login
After starting the development environment, 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>
## Development Features
### Hot Reload
The development setup includes hot reload capabilities:
- Frontend (Nuxt.js): Changes to files in the `client` directory trigger automatic rebuilds
- Backend (Laravel): Changes to files in the `api` directory are immediately reflected, except for queued jobs which require restarting the api-worker container (`docker compose -f docker-compose.yml -f docker-compose.dev.yml restart api-worker`)
### File Structure
The development setup mounts your local directories into the containers:
- `./api`: Mounted to the API container with vendor directory preserved
- `./client`: Mounted to the UI container with node_modules preserved
- Database and Redis data are persisted through Docker volumes
### Container Services
The development environment includes:
- `api`: Laravel API service with hot reload
- `ui`: Nuxt.js frontend with HMR
- `api-worker`: Laravel queue worker
- `db`: PostgreSQL database
- `redis`: Redis server
- `ingress`: Nginx reverse proxy
## Common Tasks
### Running Commands
To run commands in the containers:
```bash
# Laravel Artisan commands
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api php artisan [command]
# NPM commands
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec ui npm [command]
```
### Accessing Logs
View container logs:
```bash
# All containers
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs -f
# Specific container
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs -f [service]
```
### Database Management
The PostgreSQL database is accessible:
- From containers: `host=db`
- From your machine: `localhost:5432`
- Default credentials: username=forge, password=forge, database=forge
## Troubleshooting
### Container Issues
If containers aren't starting properly:
```bash
# Remove all containers and volumes
docker compose down -v
# Rebuild and start
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build
```
### Permission Issues
If you encounter permission issues with storage or vendor directories:
```bash
# Fix storage permissions
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api chmod -R 775 storage
# Fix vendor permissions
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api chmod -R 775 vendor
```

View File

@@ -1,12 +1,16 @@
---
title: "Docker"
description: "OpnForm can be easily set up using Docker. We provide pre-built images on Docker Hub, which is the recommended method for most users."
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

View File

@@ -7,6 +7,16 @@ import CloudVersion from "/snippets/cloud-version.mdx";
<CloudVersion/>
## Docker Development Setup (Recommended)
We recommend using our Docker-based development environment for the easiest setup experience. It provides hot-reload, debugging support, and all necessary services pre-configured.
See our [Docker Development Setup](/deployment/docker-development) guide to get started with Docker.
## Manual Setup
If you prefer to set up OpnForm manually or can't use Docker, follow the instructions below.
## Requirements
Before proceeding with the local deployment, ensure you have the following prerequisites installed on your system:

View File

@@ -73,6 +73,7 @@
"group": "Deployment",
"pages": [
"deployment/docker",
"deployment/docker-development",
"deployment/local-deployment",
"deployment/cloud-vs-self-hosting"
]