Skip to content

tlavu2004/csc13008-web-final-project

 
 

Repository files navigation

Project Deployment Instructions

Prerequisites

Before you begin, ensure you have the following installed on your machine:

  • Node.js (version 14.x or higher)
  • npm (version 6.x or higher)
  • MongoDB (Ensure MongoDB is running)

Environment Variables

Create a .env file in the root directory of your project and add the following environment variables:

   PORT=3000
   MONGO_URI=mongodb://<your-mongo-uri>
   SESSION_SECRET=your-session-secret
   CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name
   HOST=domain-your-website
   CLOUDINARY_API_KEY=your-cloudinary-api-key
   CLOUDINARY_API_SECRET=your-cloudinary-api-secret
   MOMO_PARTNER_CODE=your-momo-partner-code
   MOMO_ACCESS_KEY=your-momo-access-key
   MOMO_SECRET_KEY=your-momo-secret-key
   MOMO_REDIRECT_URL=your-momo-redirect-url
   MOMO_IPN_URL=your-momo-ipn-url
   VNPAY_TMN_CODE=your-vnpay-tmn-code
   VNPAY_HASH_SECRET=your-vnpay-hash-secret
   VNPAY_URL=your-vnpay-url
   VNPAY_RETURN_URL=your-vnpay-return-url

Installation

  1. Clone the repository:
git clone https://github.com/Keruedu/WEB-FinalProject-2024
cd your-repository
  1. Install the dependencies:
npm install
  1. Build the CSS:
npm run build-css

Database Setup

Run the migration scripts to set up the database:

node database/migrations/dropDatabase.js
node database/seed_data/seed.js

Running the Application

  1. Run the migration scripts to set up the database:
npm start
  1. Open your browser and navigate to http://localhost:3000.

Deployment on Render

To deploy the application on Render, follow these steps:

  1. Create a Render Account:

    • Go to Render and sign up for an account.
  2. Create a New Web Service:

    • Click on the "New" button and select "Web Service".
    • Connect your GitHub repository to Render.
    • Select the repository you want to deploy.
  3. Configure the Web Service:

    • Name: Choose a name for your service.
    • Region: Select the region closest to your users.
    • Branch: Select the branch you want to deploy (e.g., main).
    • Build Command: Set the build command to:
      npm install && npm run build-css
    • Start Command: Set the start command to:
      npm start
  4. Set Environment Variables:

    • Add the environment variables listed in your .env file to the Render environment variables section. This includes:
      PORT=3000
      MONGO_URI=mongodb://<your-mongo-uri>
      SESSION_SECRET=your-session-secret
      CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name
      HOST=domain-your-website
      CLOUDINARY_API_KEY=your-cloudinary-api-key
      CLOUDINARY_API_SECRET=your-cloudinary-api-secret
      MOMO_PARTNER_CODE=your-momo-partner-code
      MOMO_ACCESS_KEY=your-momo-access-key
      MOMO_SECRET_KEY=your-momo-secret-key
      MOMO_REDIRECT_URL=your-momo-redirect-url
      MOMO_IPN_URL=your-momo-ipn-url
      VNPAY_TMN_CODE=your-vnpay-tmn-code
      VNPAY_HASH_SECRET=your-vnpay-hash-secret
      VNPAY_URL=your-vnpay-url
      VNPAY_RETURN_URL=your-vnpay-return-url
  5. Deploy the Service:

    • Click on the "Create Web Service" button to start the deployment process.
    • Render will automatically build and deploy your application.
  6. Monitor the Deployment:

    • You can monitor the deployment logs in the Render dashboard.
    • Once the deployment is complete, Render will provide a URL where your application is accessible.
  7. Database Setup:

    • Ensure your MongoDB instance is accessible from Render.
    • If using a managed MongoDB service like MongoDB Atlas, whitelist Render's IP addresses.
  8. Additional Configuration:

    • Configure your domain and SSL (if applicable) in the Render dashboard.

Source Repository

The source code for this project is available on GitHub:

Frontend Template

This project uses the Tailgrid Play template for the frontend. You can find more information about the template here:

For any issues or questions, please refer to the Render documentation or the issue tracker on GitHub.

About

GA02 from web course hcmus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • EJS 75.0%
  • JavaScript 14.3%
  • CSS 10.7%