Docker Deployment
TryPost includes Laravel Sail, a lightweight Docker development environment.
Requirements
- Docker Desktop (Mac, Windows) or Docker Engine (Linux)
- Docker Compose
Quick Start
1. Clone the repository
git clone https://github.com/trypost-it/trypost.git
cd trypost
2. Install Composer dependencies
You can use a temporary container to install dependencies without PHP on your host:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/var/www/html" \
-w /var/www/html \
laravelsail/php84-composer:latest \
composer install --ignore-platform-reqs
3. Configure environment
cp .env.example .env
Update your .env for Docker:
APP_URL=http://localhost
DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432
DB_DATABASE=trypost
DB_USERNAME=sail
DB_PASSWORD=password
REDIS_HOST=redis
4. Generate the Docker Compose file
php artisan sail:install
Select the services you need:
- pgsql - PostgreSQL database (recommended)
- redis - Required for queues and caching
- meilisearch - Optional, for search functionality
5. Start the containers
./vendor/bin/sail up -d
6. Generate application key
./vendor/bin/sail artisan key:generate
7. Run migrations
./vendor/bin/sail artisan migrate
8. Build frontend assets
./vendor/bin/sail npm install
./vendor/bin/sail npm run build
Accessing TryPost
Once running, access TryPost at: http://localhost
Common Commands
# Start containers
./vendor/bin/sail up -d
# Stop containers
./vendor/bin/sail down
# View logs
./vendor/bin/sail logs
# Run Artisan commands
./vendor/bin/sail artisan <command>
# Run npm commands
./vendor/bin/sail npm <command>
# Access PostgreSQL
./vendor/bin/sail psql
# Access Redis CLI
./vendor/bin/sail redis
Running the Queue Worker
For background job processing:
./vendor/bin/sail artisan horizon
Or run it in a separate terminal:
./vendor/bin/sail up -d
./vendor/bin/sail artisan horizon
Shell Alias
Add this alias to your shell profile (~/.bashrc, ~/.zshrc):
alias sail='./vendor/bin/sail'
Then you can use:
sail up -d
sail artisan migrate
sail npm run dev
Production with Docker
For production deployments with Docker, you’ll want to:
- Use a production-ready Docker Compose configuration
- Set
APP_ENV=productionandAPP_DEBUG=false - Use proper SSL termination (nginx, Traefik, etc.)
- Configure persistent volumes for storage
- Set up proper logging and monitoring
See the Production Setup guide for more details on production configurations.
Troubleshooting
Port conflicts
If port 80 is already in use, change the APP_PORT in .env:
APP_PORT=8080
Permission issues
On Linux, you may need to run:
sudo chown -R $USER: .
Database connection refused
Make sure the database container is running:
./vendor/bin/sail ps
Wait a few seconds after starting for the database to initialize.