Simplify Docker development setup with minimal configuration
- Remove Redis, queue workers, and scheduler from development environment - Update docker-compose.dev.yml with simplified service configurations - Modify Dockerfile.api to support flexible dependency installation - Update docker-setup.sh script to use single compose file - Revise Docker development documentation to reflect new lightweight approach
This commit is contained in:
parent
f7df6bc0d7
commit
44a4b983d5
|
|
@ -59,6 +59,7 @@ jobs:
|
||||||
push: true
|
push: true
|
||||||
build-args: |
|
build-args: |
|
||||||
APP_ENV=${{ env.VERSION == 'dev' && 'local' || 'production' }}
|
APP_ENV=${{ env.VERSION == 'dev' && 'local' || 'production' }}
|
||||||
|
COMPOSER_FLAGS=${{ env.VERSION == 'dev' && '--optimize-autoloader --no-interaction' || '--no-dev --optimize-autoloader --no-interaction' }}
|
||||||
tags: ${{ env.API_TAGS }}
|
tags: ${{ env.API_TAGS }}
|
||||||
cache-from: type=registry,ref=${{secrets.DOCKER_API_REPO}}:dev
|
cache-from: type=registry,ref=${{secrets.DOCKER_API_REPO}}:dev
|
||||||
cache-to: type=inline
|
cache-to: type=inline
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ For a complete list of features and detailed documentation, visit our [Technical
|
||||||
|
|
||||||
The easiest way to get started with OpnForm is through our [official managed service in the Cloud](https://opnform.com/).
|
The easiest way to get started with OpnForm is through our [official managed service in the Cloud](https://opnform.com/).
|
||||||
|
|
||||||
For self-hosted installations, please refer to our [Deployment Guides](https://docs.opnform.com/deployment). For detailed instructions on setting up a local environment, check out our [Local Deployment Documentation](https://docs.opnform.com/deployment/local-deployment).
|
For self-hosted installations, please refer to our [Deployment Guides](https://docs.opnform.com/deployment). For local development, we provide a minimal Docker-based setup - check out our [Docker Development Guide](https://docs.opnform.com/deployment/docker-development).
|
||||||
|
|
||||||
## Support & Community
|
## Support & Community
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,33 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
api: &api-base
|
api:
|
||||||
image: jhumanj/opnform-api:dev
|
image: jhumanj/opnform-api:dev
|
||||||
container_name: opnform-api
|
container_name: opnform-api
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile.api
|
dockerfile: docker/Dockerfile.api
|
||||||
args:
|
args:
|
||||||
- APP_ENV=local
|
APP_ENV: local
|
||||||
volumes: &api-base-volumes
|
COMPOSER_FLAGS: ""
|
||||||
|
volumes:
|
||||||
- ./api:/usr/share/nginx/html:delegated
|
- ./api:/usr/share/nginx/html:delegated
|
||||||
- /usr/share/nginx/html/vendor # Exclude vendor directory from the mount
|
- /usr/share/nginx/html/vendor # Exclude vendor directory from the mount
|
||||||
- ./api/storage:/usr/share/nginx/html/storage:delegated
|
- ./api/storage:/usr/share/nginx/html/storage:delegated
|
||||||
environment: &api-base-env
|
environment:
|
||||||
APP_ENV: local
|
APP_ENV: local
|
||||||
APP_DEV_CORS: "true"
|
APP_DEBUG: true
|
||||||
IS_API_WORKER: "false"
|
APP_DEV_CORS: true
|
||||||
# Database settings
|
# Database settings
|
||||||
DB_HOST: db
|
DB_HOST: db
|
||||||
REDIS_HOST: redis
|
|
||||||
DB_DATABASE: ${DB_DATABASE:-forge}
|
DB_DATABASE: ${DB_DATABASE:-forge}
|
||||||
DB_USERNAME: ${DB_USERNAME:-forge}
|
DB_USERNAME: ${DB_USERNAME:-forge}
|
||||||
DB_PASSWORD: ${DB_PASSWORD:-forge}
|
DB_PASSWORD: ${DB_PASSWORD:-forge}
|
||||||
DB_CONNECTION: ${DB_CONNECTION:-pgsql}
|
DB_CONNECTION: ${DB_CONNECTION:-pgsql}
|
||||||
|
# Override production settings for minimal setup
|
||||||
|
CACHE_DRIVER: file
|
||||||
|
SESSION_DRIVER: file
|
||||||
|
QUEUE_CONNECTION: sync
|
||||||
# Storage settings
|
# Storage settings
|
||||||
FILESYSTEM_DISK: local
|
FILESYSTEM_DISK: local
|
||||||
LOCAL_FILESYSTEM_VISIBILITY: public
|
LOCAL_FILESYSTEM_VISIBILITY: public
|
||||||
|
|
@ -34,33 +40,6 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
|
||||||
condition: service_started
|
|
||||||
|
|
||||||
api-worker:
|
|
||||||
<<: *api-base
|
|
||||||
container_name: opnform-api-worker
|
|
||||||
command: ["php", "artisan", "queue:work"]
|
|
||||||
volumes: *api-base-volumes
|
|
||||||
environment:
|
|
||||||
<<: *api-base-env
|
|
||||||
APP_ENV: local
|
|
||||||
IS_API_WORKER: "true"
|
|
||||||
|
|
||||||
api-scheduler:
|
|
||||||
<<: *api-base
|
|
||||||
container_name: opnform-api-scheduler
|
|
||||||
command: ["php", "artisan", "schedule:work"]
|
|
||||||
volumes: *api-base-volumes
|
|
||||||
environment:
|
|
||||||
<<: *api-base-env
|
|
||||||
APP_ENV: local
|
|
||||||
IS_API_WORKER: "true"
|
|
||||||
AUTORUN_ENABLED: "false"
|
|
||||||
# Scheduler settings
|
|
||||||
CONTAINER_ROLE: scheduler
|
|
||||||
PHP_MEMORY_LIMIT: 512M
|
|
||||||
PHP_MAX_EXECUTION_TIME: 60
|
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
image: jhumanj/opnform-client:dev
|
image: jhumanj/opnform-client:dev
|
||||||
|
|
@ -91,6 +70,23 @@ services:
|
||||||
- "3000:3000" # Main dev server
|
- "3000:3000" # Main dev server
|
||||||
- "24678:24678" # Vite HMR port
|
- "24678:24678" # Vite HMR port
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:16
|
||||||
|
container_name: opnform-db
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${DB_DATABASE:-forge}
|
||||||
|
POSTGRES_USER: ${DB_USERNAME:-forge}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-forge}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-forge}"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
image: nginx:1
|
image: nginx:1
|
||||||
container_name: opnform-ingress
|
container_name: opnform-ingress
|
||||||
|
|
@ -105,4 +101,7 @@ services:
|
||||||
api:
|
api:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ui:
|
ui:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
||||||
|
|
@ -3,11 +3,12 @@ services:
|
||||||
api: &api-environment
|
api: &api-environment
|
||||||
image: jhumanj/opnform-api:latest
|
image: jhumanj/opnform-api:latest
|
||||||
container_name: opnform-api
|
container_name: opnform-api
|
||||||
build:
|
build: &api-build
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile.api
|
dockerfile: docker/Dockerfile.api
|
||||||
args:
|
args:
|
||||||
- APP_ENV=production
|
APP_ENV: production
|
||||||
|
COMPOSER_FLAGS: --no-dev
|
||||||
volumes: &api-environment-volumes
|
volumes: &api-environment-volumes
|
||||||
- ./api/storage:/usr/share/nginx/html/storage:rw
|
- ./api/storage:/usr/share/nginx/html/storage:rw
|
||||||
- ./api/bootstrap/cache:/usr/share/nginx/html/bootstrap/cache:rw
|
- ./api/bootstrap/cache:/usr/share/nginx/html/bootstrap/cache:rw
|
||||||
|
|
@ -35,6 +36,7 @@ services:
|
||||||
api-worker:
|
api-worker:
|
||||||
<<: *api-environment
|
<<: *api-environment
|
||||||
container_name: opnform-api-worker
|
container_name: opnform-api-worker
|
||||||
|
build: *api-build
|
||||||
command: ["php", "artisan", "queue:work"]
|
command: ["php", "artisan", "queue:work"]
|
||||||
volumes: *api-environment-volumes
|
volumes: *api-environment-volumes
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -47,6 +49,7 @@ services:
|
||||||
api-scheduler:
|
api-scheduler:
|
||||||
<<: *api-environment
|
<<: *api-environment
|
||||||
container_name: opnform-api-scheduler
|
container_name: opnform-api-scheduler
|
||||||
|
build: *api-build
|
||||||
command: ["php", "artisan", "schedule:work"]
|
command: ["php", "artisan", "schedule:work"]
|
||||||
volumes: *api-environment-volumes
|
volumes: *api-environment-volumes
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ RUN mkdir -p storage/framework/sessions \
|
||||||
COPY api/composer.json api/composer.lock ./
|
COPY api/composer.json api/composer.lock ./
|
||||||
COPY api/app/helpers.php ./app/helpers.php
|
COPY api/app/helpers.php ./app/helpers.php
|
||||||
|
|
||||||
|
# Default to production settings unless overridden during build
|
||||||
|
ARG APP_ENV=production
|
||||||
|
ARG COMPOSER_FLAGS=--no-dev --optimize-autoloader --no-interaction
|
||||||
|
|
||||||
# Install dependencies without running scripts
|
# Install dependencies without running scripts
|
||||||
RUN if [ "$APP_ENV" = "production" ] ; then \
|
RUN composer install ${COMPOSER_FLAGS} --no-scripts --ignore-platform-req=php
|
||||||
composer install --no-dev --no-scripts --ignore-platform-req=php --optimize-autoloader ; \
|
|
||||||
else \
|
|
||||||
composer install --no-scripts --ignore-platform-req=php --optimize-autoloader ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy the rest of the application
|
# Copy the rest of the application
|
||||||
COPY api/ .
|
COPY api/ .
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,7 @@ import CloudVersion from "/snippets/cloud-version.mdx";
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
OpnForm provides a Docker-based development environment that offers:
|
OpnForm provides a minimal Docker-based development environment optimized for local development. While the full architecture is detailed in our [Docker Deployment](/deployment/docker) guide, the development setup is intentionally lighter and focused on developer experience.
|
||||||
- Hot Module Replacement (HMR) for real-time frontend updates
|
|
||||||
- Vue DevTools integration for debugging
|
|
||||||
- PHP hot reload for backend changes
|
|
||||||
- Xdebug support for PHP debugging
|
|
||||||
- Automatic dependency management
|
|
||||||
- PostgreSQL database and Redis setup
|
|
||||||
- Nginx reverse proxy configuration
|
|
||||||
|
|
||||||
For details about the Docker architecture and components, see our [Docker Deployment](/deployment/docker) guide.
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
|
@ -61,32 +52,43 @@ 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>
|
<Note>Public registration is disabled in the self-hosted version. Use the admin account to invite additional users.</Note>
|
||||||
|
|
||||||
## Development Features
|
## Architecture
|
||||||
|
|
||||||
### Frontend Development
|
While the full architecture is detailed in our [Docker Deployment](/deployment/docker) guide, the development setup is intentionally lighter and focused on developer experience.
|
||||||
|
|
||||||
The development setup includes advanced frontend features:
|
### Differences from Production
|
||||||
|
|
||||||
|
- **No Redis**: Uses file-based caching and sessions instead
|
||||||
|
- Simpler setup
|
||||||
|
- No additional service to maintain
|
||||||
|
- Slightly slower but sufficient for development
|
||||||
|
|
||||||
|
- **No Queue Workers**: Uses synchronous job processing
|
||||||
|
- Jobs run immediately in the main process
|
||||||
|
- Easier debugging of background tasks
|
||||||
|
- No need to restart workers after code changes
|
||||||
|
|
||||||
|
- **No Scheduler**: Scheduled tasks don't run automatically
|
||||||
|
- Run scheduled tasks manually when needed
|
||||||
|
- Less resource usage
|
||||||
|
- Cleaner logs
|
||||||
|
|
||||||
|
### Development Features
|
||||||
|
|
||||||
|
The development setup includes:
|
||||||
|
|
||||||
|
#### Frontend Development
|
||||||
- **Hot Module Replacement (HMR)**: Changes to Vue components and styles are instantly reflected without page reload
|
- **Hot Module Replacement (HMR)**: Changes to Vue components and styles are instantly reflected without page reload
|
||||||
- **Vue DevTools**: Full integration for component inspection and state management debugging ([learn more](https://devtools.vuejs.org/))
|
- **Vue DevTools**: Full integration for component inspection and state management debugging ([learn more](https://devtools.vuejs.org/))
|
||||||
- **Source Maps**: Enabled for easier debugging
|
- **Source Maps**: Enabled for easier debugging
|
||||||
- **Fast Refresh**: Preserves component state during updates
|
- **Fast Refresh**: Preserves component state during updates
|
||||||
- **Error Overlay**: Displays errors directly in the browser
|
- **Error Overlay**: Displays errors directly in the browser
|
||||||
|
|
||||||
### Backend Development
|
#### Backend Development
|
||||||
|
|
||||||
The Laravel API service provides:
|
|
||||||
- **PHP Hot Reload**: Changes to PHP files are immediately available
|
- **PHP Hot Reload**: Changes to PHP files are immediately available
|
||||||
- **Xdebug Integration**: Ready for step-by-step debugging
|
- **Xdebug Integration**: Ready for step-by-step debugging
|
||||||
- **Laravel Telescope**: Available for request and queue monitoring
|
|
||||||
- **Artisan Commands**: Direct access to Laravel's CLI tools
|
- **Artisan Commands**: Direct access to Laravel's CLI tools
|
||||||
|
|
||||||
<Note>
|
|
||||||
Queue workers require restart after code changes:
|
|
||||||
```bash
|
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml restart api-worker
|
|
||||||
```
|
|
||||||
</Note>
|
|
||||||
|
|
||||||
### Development URLs
|
### Development URLs
|
||||||
|
|
||||||
- **Frontend**: http://localhost:3000
|
- **Frontend**: http://localhost:3000
|
||||||
|
|
@ -120,13 +122,13 @@ To run commands in the containers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Laravel Artisan commands
|
# Laravel Artisan commands
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api php artisan [command]
|
docker compose -f docker-compose.dev.yml exec api php artisan [command]
|
||||||
|
|
||||||
# NPM commands
|
# NPM commands
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec ui npm [command]
|
docker compose -f docker-compose.dev.yml exec ui npm [command]
|
||||||
|
|
||||||
# Database commands
|
# Database commands
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec db psql -U forge
|
docker compose -f docker-compose.dev.yml exec db psql -U forge
|
||||||
```
|
```
|
||||||
|
|
||||||
### Accessing Logs
|
### Accessing Logs
|
||||||
|
|
@ -135,10 +137,10 @@ View container logs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# All containers
|
# All containers
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs -f
|
docker compose -f docker-compose.dev.yml logs -f
|
||||||
|
|
||||||
# Specific container (e.g., frontend)
|
# Specific container (e.g., frontend)
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs -f ui
|
docker compose -f docker-compose.dev.yml logs -f ui
|
||||||
```
|
```
|
||||||
|
|
||||||
### Database Access
|
### Database Access
|
||||||
|
|
@ -168,10 +170,10 @@ If containers aren't starting properly:
|
||||||
If you encounter permission issues:
|
If you encounter permission issues:
|
||||||
```bash
|
```bash
|
||||||
# Fix storage permissions
|
# Fix storage permissions
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api chmod -R 775 storage
|
docker compose -f docker-compose.dev.yml exec api chmod -R 775 storage
|
||||||
|
|
||||||
# Fix vendor permissions
|
# Fix vendor permissions
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec api chmod -R 775 vendor
|
docker compose -f docker-compose.dev.yml exec api chmod -R 775 vendor
|
||||||
```
|
```
|
||||||
|
|
||||||
### HMR Issues
|
### HMR Issues
|
||||||
|
|
@ -180,5 +182,5 @@ If hot reload isn't working:
|
||||||
2. Ensure ports 3000 and 24678 are available
|
2. Ensure ports 3000 and 24678 are available
|
||||||
3. Try restarting the UI container:
|
3. Try restarting the UI container:
|
||||||
```bash
|
```bash
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml restart ui
|
docker compose -f docker-compose.dev.yml restart ui
|
||||||
```
|
```
|
||||||
|
|
@ -42,16 +42,18 @@ echo -e "${BLUE}Starting OpnForm Docker setup...${NC}"
|
||||||
echo -e "${GREEN}Setting up environment files...${NC}"
|
echo -e "${GREEN}Setting up environment files...${NC}"
|
||||||
bash "$SCRIPT_DIR/setup-env.sh" --docker
|
bash "$SCRIPT_DIR/setup-env.sh" --docker
|
||||||
|
|
||||||
# Determine which compose files to use
|
# Determine which compose file to use
|
||||||
COMPOSE_FILES="-f docker-compose.yml"
|
|
||||||
if [ "$DEV_MODE" = true ]; then
|
if [ "$DEV_MODE" = true ]; then
|
||||||
echo -e "${YELLOW}Development mode enabled - using docker-compose.dev.yml${NC}"
|
echo -e "${YELLOW}Development mode enabled - using minimal setup with docker-compose.dev.yml${NC}"
|
||||||
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.dev.yml"
|
COMPOSE_FILE="docker-compose.dev.yml"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Production mode - using docker-compose.yml${NC}"
|
||||||
|
COMPOSE_FILE="docker-compose.yml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start Docker containers
|
# Start Docker containers
|
||||||
echo -e "${GREEN}Starting Docker containers...${NC}"
|
echo -e "${GREEN}Starting Docker containers...${NC}"
|
||||||
docker compose $COMPOSE_FILES up -d
|
docker compose -f $COMPOSE_FILE up -d
|
||||||
|
|
||||||
# Display access instructions
|
# Display access instructions
|
||||||
if [ "$DEV_MODE" = true ]; then
|
if [ "$DEV_MODE" = true ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue