title | description | tags | |||
---|---|---|---|---|---|
Laravel |
A Laravel app that connects to a PostgreSQL database |
|
Laravel Starter Example
This is a Laravel starter app that connects to a Railway Postgres database.
✨ Features
- PHP
- Laravel
- Postgres
💁♀️ How to use
- Create a Railway project with the Postgres plugin
- Connect to your Railway project with
railway link
📝 Notes
- Dockerfile: The
Dockerfile
and associated files indocker/
are based on Laravel Sail PHP 8.0 - Plugin Config: To connect to a Railway Plugin, Postgres for example, you will need to utilize the environment variables listed for that plugin in the Railway Docs.
See the
.env.example
for an example of using these with Postgres. - Web server port: Railway dynamically assigns a port for your webserver. We grab the
$PORT
environment variable indocker/start-container
to set this on Artisanserve
- Logging: Because the disk on Railway containers is ephemeral, we pipe the logs normally output to
storage/logs/laravel.log
tostdout
as seen here - APP_KEY: This starter will automatically generate the
APP_KEY
(php artisan key:generate
in thedocker/start-container
) - Migrations: This starter automatically runs migrations on deploy (in the
docker/start-container
)