Skip to content

Commit

Permalink
update env
Browse files Browse the repository at this point in the history
  • Loading branch information
HendryZheng committed Jul 16, 2023
1 parent e2b3ad3 commit 89c6558
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 94 deletions.
107 changes: 15 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,106 +6,29 @@ This repository contains the backend and frontend setup for the Auction System.

The backend consists of a Docker configuration file (`docker-compose.yml`) and a migration script that needs to be run during the first-time setup.

### Docker Configuration
### Built With
- (Node.js)[https://nodejs.org/]
- (Express)[https://expressjs.com/]
- (TypeScript)[https://www.typescriptlang.org/]
- (TypeORM)[https://typeorm.io/]
- (PostgreSQL)[https://www.postgresql.org/]

The backend is composed of two services: `postgres` and `web`.
### Guide
You can find full guide for the backend setup in the [Backend Readme](./backend/readme.md)

#### Postgres Service

- Image: postgres:10.7
- Environment variables:
- POSTGRES_USER: testuser
- POSTGRES_PASSWORD: testpass
- POSTGRES_DB: auction-system
- Ports:
- Host: 5432
- Container: 5432
- Volumes:
- ./postgres-data:/var/lib/postgresql/data

#### Web Service

- Build context: .
- Dockerfile: dev.Dockerfile
- Links: postgres
- Container name: jtr-auction-express
- Ports:
- Host: 3000
- Container: 3000
- Environment variables:
- PGHOST: postgres
- PGHOST_MIGRATION: postgres
- Volumes:
- ./:/app


### Environment Variables

The required environment variables can be found in the `.env.example` file. Create a new `.env` file and copy the contents from `.env.example`. Modify the values of the variables as needed.


### First-time Setup

To set up the backend for the first time, follow these steps:

1. Ensure that Docker is installed on your system.
2. Navigate to the project root directory.
3. Run the following command to start the backend services:

```shell
docker-compose up
```

4. After the services are up and running, open a new terminal window and navigate to the project root directory.
5. Run the following command to run the migration script:

```shell
npm run migration:run
```

This will set up the necessary database schema and initial data.

## Frontend

The frontend is built using React and TypeScript. The `package.json` file contains the dependencies and scripts required for the frontend setup.

### Dependencies

The frontend dependencies can be found in `package.json`

### Scripts

The available scripts for the frontend are:

- start: Starts the development server on port 3006.
- build: Builds the production-ready optimized bundle.
- test: Runs tests using the Jest testing framework.
- eject: Ejects the configuration and scripts from Create React App.

### Development Environment

The development environment is configured to support the following browsers:

- Chrome (latest version)
- Firefox (latest version)
- Safari (latest version)

## Getting Started

To set up the frontend, follow these steps:

1. Ensure that Node.js and npm (Node Package Manager) are installed on your system.
2. Navigate to the `frontend` directory.
3. Run the following command to install the dependencies:
## Built With

```shell
npm install
```
- [React](https://reactjs.org/) - Front-end framework
- [TypeScript](https://www.typescriptlang.org/) - Typed JavaScript

4. Once the installation is complete, you can start the development server by running the following command:
### Guide
You can find full guide for the frontend setup in the [Frontend Readme](./frontend/readme.md)

```shell
npm start
```
## Authors

This will start the frontend application on port 3006.
- [HendryZheng](https://github.com/xen-HendryZheng)
2 changes: 1 addition & 1 deletion backend/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM node:18-slim

WORKDIR /app

EXPOSE 3000
EXPOSE $PORT

CMD ["npm", "run", "start:dev"]
4 changes: 3 additions & 1 deletion backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ services:
volumes:
- ./postgres-data:/var/lib/postgresql/data
web:
env_file:
- .env
build:
context: .
dockerfile: dev.Dockerfile
links:
- postgres
container_name: jtr-auction-express
ports:
- 3000:3000
- "${PORT}:${PORT}"
environment:
- PGHOST=postgres
- PGHOST_MIGRATION=postgres
Expand Down

0 comments on commit 89c6558

Please sign in to comment.