Skip to main content

First Startup

This guide walks you through initializing PCH-SIG after installation.

Pre-startup checklist

Before continuing, verify that:

  • Docker is installed and running
  • Containers are started (docker compose ps)
  • Ports 3000 and 8000 are accessible
  • .env files are configured

Step 1: Start the containers

cd deploy

# Start all services
docker compose up -d

# Check status
docker compose ps

All containers should be in Up state.


Step 2: Create the database

# Access the backend container
docker exec -it pch_backend bash

# Create the database
php bin/console doctrine:database:create

# Run migrations
php bin/console doctrine:migrations:migrate --no-interaction

Verify the structure

php bin/console doctrine:schema:validate

Step 3: Generate JWT keys

# Still in the backend container
php bin/console lexik:jwt:generate-keypair

Keys are created in config/jwt/:

  • private.pem: Private key (signing)
  • public.pem: Public key (verification)
Security

JWT keys must remain confidential. Do not commit them to Git.


Step 4: Load initial data

Reference data

php bin/console doctrine:fixtures:load --group=reference --no-interaction

This loads:

  • Regions, Sectors, Communes, Localities
  • Document types
  • System parameters

Administrator user

php bin/console app:create-admin admin@pch-sig.sn Admin123!

Or via fixtures:

php bin/console doctrine:fixtures:load --group=users --no-interaction

Step 5: Clear cache

php bin/console cache:clear
php bin/console cache:warmup

Step 6: Frontend build

If not already done:

# Exit the backend container
exit

# On the host machine
cd ../frontend
npm install
npm run build

Files are generated in frontend/build/.


Step 7: Access the application

URLs

ServiceURL
Applicationhttp://localhost:3000
APIhttp://localhost:8000/api
Mailpithttp://localhost:8025

First login

  1. Go to http://localhost:3000
  2. Log in with:
    • Email: admin@pch-sig.sn
    • Password: Admin123!

Step 8: Post-startup verifications

Test the API

curl http://localhost:8000/api

Expected response: API documentation or welcome message.

Test authentication

curl -X POST http://localhost:8000/api/login_check \
-H "Content-Type: application/json" \
-d '{"email":"admin@pch-sig.sn","password":"Admin123!"}'

Expected response: JWT token.

Verify Redis

docker exec pch_redis redis-cli -a redis_secure_2025 PING

Expected response: PONG

Verify PostgreSQL

docker exec pch_postgres psql -U pch_admin -d pch_sig -c "SELECT count(*) FROM users;"

Initial configuration

Change admin password

  1. Log in to the application
  2. Click on your profile
  3. Select Settings
  4. Change the password

Create first users

  1. Go to Administration > Settings
  2. Section Users
  3. Click New user

Configure regions

Regions are loaded automatically. Check in: Settings > Geography


Common problems

"Connection refused" PostgreSQL error

# Verify PostgreSQL is started
docker logs pch_postgres

# Wait a few seconds and retry
sleep 10
docker exec -it pch_backend php bin/console doctrine:migrations:migrate

"Permission denied" error on JWT keys

# Fix permissions
docker exec pch_backend chmod 644 config/jwt/public.pem
docker exec pch_backend chmod 600 config/jwt/private.pem

Blank page on frontend

# Check the build
ls -la frontend/build/

# Rebuild if necessary
cd frontend && npm run build

Next steps