You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-6Lines changed: 33 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,22 @@ The official Competitive Coding website for BITS Pilani, Hyderabad Campus. Surge
64
64
docker compose --profile prod down
65
65
```
66
66
67
+
## Environment Variables
68
+
Make a copy of the `.env.example` file, name it `.env` and include it in the root of your project directory. A list of reccomended defaults has been provided in `.env.example`. Here is an in depth explanation on a few environment variables which you might have to tweak based on your setup.
69
+
70
+
-`NGINX_PORT` - Used by nginx service running in the `frontend` service. This is only used in production and is the PORT which is exposed to the host and where the project is accessible in a production environment.
71
+
72
+
-`VITE_CLIENT_URL` - The URL via which your frontend is accessible. This is used to provide permanent links to rich preview images as well as auth redirects.
73
+
74
+
-`CALLBACK_URL` - This is the URL where the browser is redirected to, after the Google OAuth flow is completed successfully.
75
+
76
+
-`VITE_API_BASE_URL` - The path to your backend relative to the root of your domain. By default all requests to `/api` are rewritten to the backend via the `nginx.conf` file. This is also the default configured value in `.env.example`.
77
+
78
+
-`VITE_ENV` - Used to configure the environment where the project is running. Accepts values as `development`, `staging`, or `production`.
79
+
80
+
**NOTE: The cron jobs to refresh user information only run when `VITE_ENV` is set to `production`**
81
+
82
+
67
83
## Migrations
68
84
**Make sure you have the dev profile up and running before running migrations.**
Runs migrations which haven't been applied yet. A list of migrations which have been applied is stored in a table in the database itself. Read more about this [here](https://github.com/jbranchaud/til/blob/master/drizzle/drizzle-tracks-migrations-in-a-log-table.md).
This command **does not** generate migrations! Make sure to generate migrations for any major changes to ensure that the history of the database schema is always preserved.
This compares the current state of the database with the schema and generates migrations.
96
106
107
+
## Nginx Setup
108
+
The provided `nginx.dev.conf` should be configured to run with the default configs provided in `.env.example`. However for running in prod, the `nginx.prod.conf.example` file should be copied in the same directory and named `nginx.prod.conf`. After this, the ports in the config file should be configured accordingly.
109
+
110
+
### For dev
111
+
The containers used for dev are:
112
+
-`backend-dev`
113
+
-`frontend-dev`
114
+
-`nginx-dev`
115
+
116
+
Both `frontend-dev` and `backend-dev` are proxied through the `nginx` container. All requests to the `/api/*` route are forwarded to `backend-dev` and the rest are forwarded to `frontend-dev`.
117
+
118
+
### For prod
119
+
The containers used for prod are:
120
+
-`backend`
121
+
-`frontend`
122
+
123
+
In the prod setup, the `frontend` service is a container running nginx. This container redirects all requests to `/api/*` routes to the `backend` service. All other requests are redirected internally to the compiled vite project. This nginx service is exposed to the host on the configured `NGINX_PORT` environment variable.
0 commit comments