|
| 1 | +# Installation |
| 2 | + |
| 3 | +### 1. Clone the Repository |
| 4 | + |
| 5 | +Run the following command on your server to clone the repository. |
| 6 | +```bash |
| 7 | + git clone https://github.com/mdgspace/domain-forge.git |
| 8 | +``` |
| 9 | + |
| 10 | +### 2. Configuring the Environment Variables |
| 11 | + |
| 12 | +This step involves the configuration of three `.env` files: |
| 13 | +- Docker env: |
| 14 | + As suggested in the `.env.sample` present at the `docker/` directory, create a file named `.env` and copy the contents as shown, replacing *"XXXX"* by the frontend and backend ports you want your application to run on. |
| 15 | + ``` |
| 16 | + PORT_BACKEND=XXXX |
| 17 | + PORT_FRONTEND=XXXX |
| 18 | + ``` |
| 19 | +- Backend env: |
| 20 | + As suggested in the `.env.sample` present at the `src/backend` directory, create a file named `.env` and copy the contents as shown, replacing *"..."* with the respective values for your registered github oauth application's **GITHUB_OAUTH_CLIENT_ID** and **GITHUB_OAUTH_CLIENT_SECRET**. Fill in the **MONGO_API_KEY** and **MONGO_APP_ID** you obtain upon creating a cluster in *MongoDB Atlas* |
| 21 | + ``` |
| 22 | + GITHUB_OAUTH_CLIENT_ID=... |
| 23 | + GITHUB_OAUTH_CLIENT_SECRET=... |
| 24 | + MONGO_API_KEY=... |
| 25 | + MONGO_APP_ID=... |
| 26 | + ``` |
| 27 | +- Frontend env: |
| 28 | + As suggested in the `.env.sample` present at the `src/frontend` directory, create a file named `.env` and copy the contents as shown, replacing *"..."* with the respective values for your registered github oauth application's **VITE_APP_GITHUB_OAUTH_CLIENT_ID** and **VITE_APP_GITHUB_OAUTH_CLIENT_SECRET**. For the **VITE_APP_GITHUB_OAUTH_REDIRECT_URL** enter the public url of the application's `/login` route. (Example: `http://df.mdgspace.org/login`). Also, add the port at which your backend is running in place of *"XXXX"*. |
| 29 | + ``` |
| 30 | + VITE_APP_GITHUB_OAUTH_CLIENT_ID=... |
| 31 | + VITE_APP_GITHUB_OAUTH_CLIENT_SECRET=... |
| 32 | + VITE_APP_GITHUB_OAUTH_REDIRECT_URL=... |
| 33 | + VITE_APP_BACKEND_PORT=XXXX |
| 34 | + ``` |
| 35 | +
|
| 36 | +### 3. Build Docker Image |
| 37 | +
|
| 38 | +> If you do not have docker installed on your system, visit [this](https://docs.docker.com/engine/install/). |
| 39 | + |
| 40 | +Navigate to the `docker` directory and build the images in the background using the following command. |
| 41 | +```bash |
| 42 | +cd docker/ |
| 43 | +docker compose up --build -d |
| 44 | +``` |
| 45 | + |
| 46 | +### 4. Setup Named Pipes |
| 47 | + |
| 48 | +Navigate to the `docker/named_pipe` directory and execute the `listen.sh` script to allow the application to run commands on the host. |
| 49 | +```bash |
| 50 | +cd docker/named_pipe |
| 51 | +./listen.sh |
| 52 | +``` |
| 53 | +> Make sure to check the permissions of the `listen.sh` file. You can change them using the `chmod` command. |
| 54 | +
|
| 55 | +### 5. Installing and Configuring NGINX |
| 56 | + |
| 57 | +Install NGINX on your server from [here](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/). |
| 58 | +Refer to [this](https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04) to configure NGINX to serve your application. |
| 59 | + |
| 60 | +### 6. Adding the DNS Records and Issue SSL Certificates |
| 61 | + |
| 62 | +Refer to [this](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/) to add DNS records for *df.yourorgname.com* and also a wildcard DNS record for **.df.yourorgname.com* |
| 63 | + |
| 64 | +You can use [letsencrypt](https://letsencrypt.org/) to issue SSL certificates for *df.yourorgname.com* and a wildcard SSL certificate for **.df.yourorgname.com*. |
0 commit comments