Deployment
This section outlines the steps required to deploy the Hospital Information System.
General Deployment Steps
These are the general steps for deploying the application to a server. Specific commands and configurations may vary depending on your server environment.
Prerequisites:
- PHP (version 8.2 or higher)
- Composer
- Node.js & npm or yarn
- Database (MySQL, PostgreSQL, etc.)
- Web Server (Apache, Nginx, etc.)
- Git
Deployment Process:
- Clone the repository:
git clone https://github.com/BilalSwl6/react-hospital.git
- Install PHP dependencies:
composer install --no-dev
- Install JavaScript dependencies:
ornpm install
yarn install
- Build front-end assets:
ornpm run build
yarn build
- Set up environment file: Copy the
.env.example
file to.env
and configure your database credentials and other environment variables.cp .env.example .env
- Generate application key:
php artisan key:generate
- Run database migrations:
php artisan migrate --force
- Run database seeders (optional):
php artisan db:seed --force
- Configure your web server: Point your web server's document root to the
public
directory of your application. Ensure that the necessary rewrite rules are configured for clean URLs. - Set correct file permissions: Ensure that the
storage
andbootstrap/cache
directories are writable by your web server. - Configure cron jobs (if needed): Set up cron jobs for scheduled tasks (e.g., database backups).
Heroku Deployment
Heroku provides a platform-as-a-service that simplifies deployment. Follow these steps to deploy to Heroku:
Prerequisites:
- Heroku CLI
- Heroku account
- Git
Deployment Process:
- Log in to Heroku:
heroku login
- Create a new Heroku app:
heroku create <app-name>
- Add a buildpack: Heroku needs to know how to build your PHP application. You can use the official Heroku PHP buildpack.
heroku buildpacks:add heroku/php
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-apt
- Provision a database (e.g., Heroku Postgres):
heroku addons:create heroku-postgresql:<plan>
- Set environment variables: Configure your database credentials and other environment variables using the Heroku CLI or the Heroku dashboard.
heroku config:set APP_KEY=<your_app_key> DB_CONNECTION=<your_db_connection> DB_HOST=<your_db_host> ...
- Push your code to Heroku:
git push heroku main
- Run database migrations on Heroku:
heroku run php artisan migrate --force
- Run database seeders on Heroku (optional):
heroku run php artisan db:seed --force
- Scale your web dynos:
heroku ps:scale web=1
- Configure scheduler (if needed): Use the Heroku Scheduler add-on to run scheduled tasks.
Refer to the Heroku Dev Center for more detailed information on deploying Laravel applications.