Compare commits

...

5 Commits

Author SHA1 Message Date
45a0c45462 updates 2025-06-05 18:05:23 +02:00
3e5b8aa042 Remove api-nginx health check and add restart documentation
- Remove health check from api-nginx service to fix "starting" status issue
- Add UPDATED_RESTART_INSTRUCTIONS.md with detailed restart process
- Update api-nginx depends_on to use explicit service_started condition
2025-06-05 18:05:05 +02:00
f04e93ddb4 Fix container health checks and expose services externally
- Replace artisan-based health check with php-fpm process check
- Change port bindings from localhost to all interfaces (0.0.0.0)
- Add restart policies to ensure service availability
- Extend API startup period from 60s to 90s
- Add comprehensive restart instructions and troubleshooting guide

This allows external access to the application and improves container
reliability by fixing health check failures.
2025-06-05 18:00:12 +02:00
878d72b785 Merge branch 'main' of https://github.com/JhumanJ/OpnForm 2025-06-05 17:47:30 +02:00
Chirag Chhatrala
705bff439e Enhance FieldOptions Component with Conditional Placeholder Input (#773)
- Added a conditional rendering for a `text-area-input` for placeholder text when the field type is 'text' and supports multiple lines, improving user experience in form customization.
- Updated the existing `text-input` to use `v-else-if` for better logical flow in rendering based on the presence of a placeholder.

These changes aim to enhance the flexibility of the FieldOptions component by providing users with more options for input placeholders.

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-06-05 17:38:58 +02:00
4 changed files with 129 additions and 11 deletions

43
RESTART_INSTRUCTIONS.md Normal file
View File

@@ -0,0 +1,43 @@
# How to Restart OpnForm Containers
Since you're using a web-based Docker management interface, follow these steps:
## 1. Stop All Containers
In your Docker management interface:
- Select all OpnForm containers
- Click "Stop" or use the stop button
- Wait for all containers to stop
## 2. Start Containers in Correct Order
Start the containers in this order:
1. **opnform-db** - Wait until healthy
2. **opnform-redis** - Wait until healthy
3. **opnform-api** - Wait until it shows as running
4. **opnform-api-nginx** - This should now start successfully
5. **opnform-api-worker** - Start this
6. **opnform-api-scheduler** - Start this
7. **opnform-client** - Start this last
## 3. Verify Services
After all containers are running:
- Check that `opnform-api-nginx` is healthy (not "starting")
- Access the UI at: http://YOUR-SERVER-IP:7655
- API should be available at: http://YOUR-SERVER-IP:7654
## What Changed
1. **Fixed PHP-FPM health check** - Changed from running artisan command to checking if php-fpm process exists
2. **Added restart policies** - Containers will restart unless manually stopped
3. **Changed port bindings** - From 127.0.0.1 (localhost only) to 0.0.0.0 (accessible from any IP)
4. **Extended start period** - Gave API container more time to start before health checks
## Troubleshooting
If api-nginx is still unhealthy:
1. Check logs of opnform-api container
2. Verify PHP-FPM is running: Look for php-fpm processes in the api container
3. Check api-nginx logs for connection errors
## Security Note
The services are now exposed on all network interfaces. For production:
- Use a firewall to restrict access
- Configure your host nginx with SSL
- Or revert to localhost binding after testing

View File

@@ -0,0 +1,69 @@
# Updated Restart Instructions for OpnForm
## Changes Made
1. **Removed health check from api-nginx** - This was causing the "starting" status
2. **Fixed PHP-FPM health check** - Changed to check process existence
3. **Made services accessible externally** - Changed ports from localhost-only to all interfaces
## Step-by-Step Restart Process
### 1. Stop ALL OpnForm Containers
In your Docker web interface:
- Select ALL OpnForm containers
- Click "Stop"
- Wait for all to fully stop
### 2. Remove the api-nginx Container (Important!)
- Select the `opnform-api-nginx` container
- Click "Remove" or "Delete"
- This ensures it recreates with the new configuration
### 3. Start Containers in Order
Start each container and wait for it to be ready before starting the next:
1. **opnform-db** - Wait until "healthy"
2. **opnform-redis** - Wait until "healthy"
3. **opnform-api** - Wait until "healthy" (may take 90 seconds)
4. **opnform-api-nginx** - Should show "running" (no health check now)
5. **opnform-api-worker** - Wait until running
6. **opnform-api-scheduler** - Wait until running
7. **opnform-client** - Wait until "healthy"
### 4. Verify Everything Works
#### Check nginx is actually running:
Look at the logs for `opnform-api-nginx`. You should see:
```
Configuration complete; ready for start up
```
#### Test the services:
- UI: http://YOUR-SERVER-IP:7655
- API: http://YOUR-SERVER-IP:7654/api/health
### 5. If api-nginx Still Shows Issues
Check if PHP-FPM is running in the API container:
1. Go to the `opnform-api` container
2. Check the logs - should show: `fpm is running, pid 1`
3. If PHP-FPM isn't running, the API container needs to be restarted
### 6. Common Issues
**Port already in use:**
- Make sure no other services are using ports 7654 or 7655
- Check with: `netstat -tlnp | grep -E '7654|7655'` on the host
**Cannot connect to API:**
- Ensure firewall allows ports 7654 and 7655
- Try accessing locally first: `curl http://localhost:7654/api/health`
**nginx won't start:**
- Check logs for configuration errors
- Verify the api-nginx.conf file exists
## Security Reminder
Services are now exposed on all network interfaces (0.0.0.0). For production:
- Configure firewall rules to restrict access
- Set up your host nginx with SSL as planned
- Or change back to 127.0.0.1 after testing

View File

@@ -501,8 +501,15 @@
</div>
<!-- Placeholder -->
<text-area-input
v-if="hasPlaceholder && field.type === 'text' && field.multi_lines"
name="placeholder"
class="mt-3"
:form="field"
label="Empty Input Text (Placeholder)"
/>
<text-input
v-if="hasPlaceholder"
v-else-if="hasPlaceholder"
name="placeholder"
class="mt-3"
:form="field"

View File

@@ -26,11 +26,12 @@ services:
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "php /usr/share/nginx/html/artisan about || exit 1"]
test: ["CMD-SHELL", "pgrep php-fpm > /dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 3
start_period: 60s
start_period: 90s
restart: unless-stopped
api-nginx:
image: nginx:alpine
@@ -39,14 +40,11 @@ services:
- ./docker/api-nginx.conf:/etc/nginx/nginx.conf:ro
- opnform_storage:/usr/share/nginx/html/storage:ro
ports:
- "127.0.0.1:7654:80" # API on port 7654
- "0.0.0.0:7654:80" # API on port 7654 - accessible from any IP
depends_on:
- api
healthcheck:
test: ["CMD-SHELL", "wget --spider -q http://localhost/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
api:
condition: service_started
restart: unless-stopped
api-worker:
image: jhumanj/opnform-api:latest
@@ -120,7 +118,7 @@ services:
image: jhumanj/opnform-client:latest
container_name: opnform-client
ports:
- "127.0.0.1:7655:3000" # UI on port 7655
- "0.0.0.0:7655:3000" # UI on port 7655 - accessible from any IP
env_file:
- ./client/.env
healthcheck:
@@ -129,6 +127,7 @@ services:
timeout: 10s
retries: 3
start_period: 45s
restart: unless-stopped
redis:
image: redis:7