Skip to content

Commit

Permalink
Merge pull request #97 from MaastrichtU-IDS/RCS-132
Browse files Browse the repository at this point in the history
Cleaned up repo, removed unnecessary files, put everything in one docker-compose file [RCS-132]
  • Loading branch information
seunAdeks authored Jan 6, 2025
2 parents 09ba9ff + 1a03467 commit b3cdb82
Show file tree
Hide file tree
Showing 6 changed files with 240 additions and 241 deletions.
75 changes: 58 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,51 @@ To run the full stack including the database and API, we use docker-compose

1. Define the `.env` file to change the default configuration (user credential to enable/disable GPU on the cluster, Slack config):

<!-- ```bash
``` bash
DB_NAME=dsri-db
DB_USER=dsri-user
DB_PASSWORD=password
DB_HOST=mysql
API_PASSWORD=password
CLUSTER_USER=dsri.username
CLUSTER_PASSWORD=password
SLACK_BOT_TOKEN=xoxb-0000000000-0000000000-0000000000
SLACK_CHANNEL=C03B48CQ3QW
``` -->
```bash
DB_PASSWORD=password
API_PASSWORD=password
CLUSTER_API_KEY=token
SLACK_BOT_TOKEN=xoxb-0000000000-0000000000-0000000000
SLACK_CHANNEL=C03B48CQ3QW
SLACK_CHANNEL=C00000000QW
CLUSTER_API_KEY=""
[email protected]
SMTP_HOST=
SMTP_PORT=
SAML_SP_ENTITY_ID=
SAML_SALT=
SAML_ADMIN_PW=
SAML_TRUSTED_DOMAINS=
SAML_BASEURLPATH=
FOLDER_BOOKING_APP=/foo
FOLDER_SAML_CONFIG=/foo
FOLDER_SAML_METADATA=/foo
FOLDER_SAML_CERT=/foo
```

###

2. Run the stack:

* API on http://localhost:8000, automatically reloaded on change to the code, with CRON job enabled
* The GPU calendar on http://localhost:8001
* Database accessible through phpMyAdmin on http://localhost:8002

```bash
docker-compose up
```bash
# Don't forget to switch to the right volumes for development!

# Build images for dsri-api, cron, gpu-calender and gpu-reservation
docker compose build --no-cache

# Start the containers (detached), you can also choose to up specific services e.g. append: nginx_proxy dsri-api
docker compose up -d --force-recreate
```

> ⚠️ The first time you start the stack you might need to stop and restart the stack once the SQL database has been initialized for the API to properly connect to the database
###

3. In another terminal, run the website on http://localhost:3000, it will use the local API to display stats:

```bash
Expand All @@ -100,6 +117,8 @@ yarn upgrade

Alternatively you can also change the packages versions requirements in the `package.json` and run `yarn`

###

## 🚀 Deploy in production

### Deploy the frontend to GitHub pages
Expand All @@ -113,20 +132,40 @@ The GitHub Action will automatically compile the website to HTML in the `gh-page
Define the `.env` file to change the default configuration (user credential to enable/disable GPU on the cluster, Slack config):

```bash
DB_NAME=dsri-db
DB_USER=dsri-user
DB_PASSWORD=password
DB_HOST=mysql
API_PASSWORD=password
CLUSTER_USER=dsri.username
CLUSTER_PASSWORD=password
SLACK_BOT_TOKEN=xoxb-0000000000-0000000000-0000000000
SLACK_CHANNEL=C03B48CQ3QW
SLACK_CHANNEL=C00000000QW
CLUSTER_API_KEY=""
[email protected]
SMTP_HOST=
SMTP_PORT=
SAML_SP_ENTITY_ID=
SAML_SALT=
SAML_ADMIN_PW=
SAML_TRUSTED_DOMAINS=
SAML_BASEURLPATH=
FOLDER_BOOKING_APP=/foo
FOLDER_SAML_CONFIG=/foo
FOLDER_SAML_METADATA=/foo
FOLDER_SAML_CERT=/foo
```

Start the docker-compose in production using [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy).

```bash
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# Build images for dsri-api, cron, gpu-calender and gpu-reservation
docker compose build --no-cache

# Start the containers (detached), you can also choose to up specific services e.g. append: nginx_proxy dsri-api
docker compose up -d --force-recreate
```

###

### Database setup

#### Import CSV
Expand Down Expand Up @@ -168,6 +207,8 @@ To change the password of your database user, click on the **SQL** tab, and exec
SET PASSWORD FOR 'username'@'%' = PASSWORD('newpassword');
```

###

### Backup

#### Export as CSV
Expand Down
9 changes: 0 additions & 9 deletions deploy.sh

This file was deleted.

44 changes: 0 additions & 44 deletions docker-compose.override.yml

This file was deleted.

123 changes: 0 additions & 123 deletions docker-compose.prod.yml

This file was deleted.

Loading

0 comments on commit b3cdb82

Please sign in to comment.