Skip to content
README.md 3.17 KiB
Newer Older
# Nginx Configuration

## Building and Running Docker Compose

1. Ensure Docker and Docker Compose are installed on your machine. If not, you can download them from the official Docker website.

2. Navigate to the directory containing the `docker-compose.yaml` file.

3. Build the Docker Compose file using the following command:

```sh
Marques Reis Henrique's avatar
Marques Reis Henrique committed
docker compose build
```

4. Run the Docker Compose file using the following command:

```sh
Marques Reis Henrique's avatar
Marques Reis Henrique committed
docker compose up
Marques Reis Henrique's avatar
Marques Reis Henrique committed
## Example Routes

Based on the `nginx.conf` file, the following routes are available:

1. `/projet1`: This route proxies to `http://157.26.83.14:8081/projet1`.
2. `/projet2`: This route proxies to `http://157.26.83.14:8099/projet2`.

Please note that these routes are accessible via the domain `tic.ing.he-arc.ch` on port `443` (HTTPS).

Marques Reis Henrique's avatar
Marques Reis Henrique committed
## Add a New Route

To add a new route, you need to modify the `nginx/nginx.conf` file. The following is an example of how to add a new route:

```nginx
  location /newproject {
        proxy_pass http://XX.XX.XX.XX:XXXX/newproject;
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_redirect     off;
    }
```

Then add the redirection on the `nginx/html/index.html` file.

```html
<a href="https://tic.ing.he-arc.ch/newproject">newproject</a>
```

Marques Reis Henrique's avatar
Marques Reis Henrique committed
Merge the changes to the repository. Then the CI/CD pipeline will automatically deploy the changes to the server.
Marques Reis Henrique's avatar
Marques Reis Henrique committed
If you are not using the CI/CD pipeline, you will need to build and run the Docker Compose file manually.

Marques Reis Henrique's avatar
Marques Reis Henrique committed
### Need to upload files?

If your project needs to upload files, you will need to add the following configuration to the `nginx.conf` in the `location` block of your project:

```nginx
client_max_body_size 100M; # Allow file uploads up to 100MB you also use 1G for exemple
```

### Streamlit

For projects using streamlit don't forget to add the STREAMLIT_SERVER_BASE_URL_PATH environment variable with the name of the redirection.

**/!\ The projects can be accessed by all users that can enter the domain `tic.ing.he-arc.ch`. If you want to restrict access to a specific project, you will need to add an authentication layer to the project. Like a simple password that you give only to your client. /!\\**

Marques Reis Henrique's avatar
Marques Reis Henrique committed
The SSL certificate and key are expected to be in the `/nginx/ssl/` directory. These files are ignored by Git as per the `.gitignore` file. Make sure to place your `bundle.crt` and `tic_ing.key` files in this directory.

Marques Reis Henrique's avatar
Marques Reis Henrique committed
## Giving access to external users (outside of HE-Arc network)

To grant access to exeternal users follow the instructions found [here](doc/external-access.md).

### People allowed to do the procedure

- Henrique Marques Reis
- Jules Perrelet
- Emmanuel de Salis
- Damien Chapatte
- Julien Senn

## End user documentation

You can find the end user documentation [here](doc/end-user.md).

Marques Reis Henrique's avatar
Marques Reis Henrique committed
## CI/CD config

To deploy the nginx container automatically, follow the instructions found [here](doc/setup-ci-cd.md).