Skip to content

Commit aec507b

Browse files
committed
WIP yml files, scripts for convenience, updating documentation.
1 parent a6e1091 commit aec507b

File tree

9 files changed

+60
-53
lines changed

9 files changed

+60
-53
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"name": "Sailbot Workspace",
44
"dockerComposeFile": [
55
"docker-compose.yml",
6-
// "website/docker-compose.website.yml", // website
76

87
// Uncomment the files containing the programs you need
98
// "docs/docker-compose.docs.yml", // docs

.devcontainer/docker-compose.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ services:
88
network_mode: host
99
privileged: true
1010
user: ros
11-
ports:
12-
# website
13-
- "3005:3005"
14-
# docs
15-
# - "8000:8000"
1611
volumes:
1712
- ..:/workspaces/sailbot_workspace:cached
1813
- sailbot-new-project-bashhistory:/home/ros/commandhistory:delegated

.devcontainer/website/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#### NOTE: We now only use this for deployment! We do website development locally now. Hmph.
2+
13
# Website Image
24

35
Used for running [our website](https://github.com/UBCSailbot/sailbot_workspace/tree/main/src/website).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# hello from website team
2+
# website development only needs mongodb and not the other fancy ros services
3+
4+
services:
5+
mongodb:
6+
image: mongo:7.0
7+
container_name: sailbot-mongodb
8+
ports:
9+
- "27017:27017"
10+
volumes:
11+
- mongodb-data:/data/db:delegated
12+
restart: unless-stopped
13+
14+
volumes:
15+
mongodb-data:

.devcontainer/website/docker-compose.website.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.devcontainer/website/website.Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/website/README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,49 @@ This directory contains all installed packages.
3636

3737
When installing a new package to the website, please follow the steps below:
3838

39-
1. Access the terminal of the website container on Docker.
40-
41-
2. Run the command `npm install <package-name>`.
39+
1. Run the command `npm install <package-name>`.
4240
Replace `<package-name>` with the actual name of the package you want to add.
4341

4442
- Should you encounter errors related to resolving peer dependencies, please re-run the command with
4543
the header `--legacy-peer-deps`. Do not to use `--force` unless you're well aware of the potential consequences.
4644

47-
3. Review the `package.json` file to ensure the new package and its version have been added to the dependencies section.
45+
2. Review the `package.json` file to ensure the new package and its version have been added to the dependencies section.
4846
- Confirm that `package-lock.json` has also been updated.
4947
This file holds specific version information to ensure consistent installations across different environments.
50-
4. Once the installation process is finished, please make sure to commit the files `package.json` and `package-lock.json`.
48+
3. Once the installation process is finished, please make sure to commit the files `package.json` and `package-lock.json`.
5149
These files are essential for version controlling the dependencies that have been added.
5250

5351
## Run
5452

55-
Using [Sailbot Workspace](https://github.com/UBCSailbot/sailbot_workspace),
56-
the website should be up and running on [http://localhost:3005](http://localhost:3005).
57-
58-
Otherwise, you execute the following commands to run it in development mode:
53+
You can run the website in development mode by executing the following command:
5954

6055
```bash
6156
npm run dev
6257
```
6358

59+
This will start the website in development mode and spin up a Docker container for our MongoDB database.
60+
Make sure you have Docker installed!
61+
62+
Once you have run the website in development mode, you can access it at [http://localhost:3005](http://localhost:3005).
63+
64+
After spinning up the database, it will keep running in the background until Docker is stopped. You can just manually stop the database by running:
65+
66+
```bash
67+
npm run db:stop
68+
```
69+
70+
Otherwise, here are some useful commands:
71+
72+
| Command | Description |
73+
| -------------------- | -------------------------------------------------------- |
74+
| `npm run db:start` | Starts the MongoDB database container |
75+
| `npm run db:stop` | Stops the MongoDB database container |
76+
| `npm run web:dev` | Runs the website in development mode on port 3005 |
77+
| `npm run dev` | Starts both the database and website in development mode |
78+
| `npm run web:build` | Builds the website for production |
79+
| `npm run web:start` | Starts the production website on port 3005 |
80+
| `npm run simulation` | Runs the simulation script |
81+
6482
## Linters
6583

6684
Before merging in new changes to the repository, please execute the following commands in order:

src/website/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
"private": true,
33
"scripts": {
44
"postinstall": "cd tests && npm install",
5-
"dev": "next dev -p 3005",
6-
"build": "next build",
7-
"start": "next start -p 3005",
5+
"db:start": "docker compose -f ../../.devcontainer/website/docker-compose.mongodb.yml up -d",
6+
"db:stop": "docker compose -f ../../.devcontainer/website/docker-compose.mongodb.yml down",
7+
"web:dev": "next dev -p 3005",
8+
"dev": "npm run db:start && npm run web:dev",
9+
"web:build": "next build",
10+
"web:start": "next start -p 3005",
11+
"simulation": "bash scripts/run-simulation.sh",
812
"lint": "prettier --check . && stylelint --allow-empty-input \"**/*.{css,scss}\" && next lint",
913
"format": "prettier --write ."
1014
},

src/website/scripts/run-simulation.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
[ ! -d "venv" ] && python3 -m venv venv
4+
5+
source venv/bin/activate
6+
pip install pymongo --quiet
7+
8+
cd tests/simulation
9+
python3 simulation.py

0 commit comments

Comments
 (0)