This document explains how to set up and run the Coducate project in both development and production environments.
- Docker and Docker Compose
-
Start the Docker Daemon
Ensure Docker is running on your system. -
Configure Environment Variables
Navigate to thecoducate-backenddirectory and ensure the.envfile exists with proper database credentials. -
Start All Services
From the project root directory, run:docker compose up -d
This will start MariaDB, backend, and frontend containers. Database migrations will run automatically.
-
Access the Application
- Frontend (with HMR): http://localhost:5173
- Backend API: http://localhost:1234
- Database: localhost:3306
-
Develop with Hot Reload
- Backend: Edit files in
coducate-backend/src/- nodemon will auto-restart - Frontend: Edit files in
coducate-frontend/src/- Vite HMR will instantly update the browser
- Backend: Edit files in
-
View Logs
To see logs from all services:docker compose logs -f
To see logs from a specific service:
docker compose logs -f backend docker compose logs -f frontend docker compose logs -f mariadb
-
Start extension development host
Open the Coducate project in Visual Studio Code.
PressF5to start the extension development host. -
Test the Extension on non-development host by installing it using the
.vsixfile
Navigate to thecoducatedirectory and run:vsce package
This will create a
.vsixfile in thecoducatedirectory.
Install the extension in Visual Studio Code by following these steps:- Navigate to the Extensions view
- Click on the
...icon - Select
Install from VSIX... - Choose the
.vsixfile created earlier - Reload Visual Studio Code
-
End the Development Session
To stop all services:docker compose down
-
Rebuild Containers (after Dockerfile or dependency changes)
docker compose up -d --build
-
Restart a specific service
docker compose restart backend docker compose restart frontend
-
Check the Database
Connect to the MariaDB database from inside the container:docker compose exec mariadb mysql -u root -pOr from your host machine (requires mysql client):
mysql -h 127.0.0.1 -P 3306 -u root -p
Enter the root password from the
.envfile. -
Query the Rooms Table
Inside the MariaDB prompt, run:USE coducate; SELECT * FROM rooms;
-
Run Migrations Manually (if needed)
Migrations run automatically on startup, but you can run them manually:docker compose exec backend npx knex migrate:latest --knexfile knexfile.ts -
Rollback Migrations
docker compose exec backend npx knex migrate:rollback --knexfile knexfile.ts -
Create New Migration
docker compose exec backend npx knex migrate:make migration_name --knexfile knexfile.ts -
Populate the Rooms Table
Modify theseed_rooms.tsfile as needed, then run:docker compose exec backend npx knex seed:run --knexfile knexfile.ts -
Access Container Shell
docker compose exec backend sh docker compose exec frontend sh docker compose exec mariadb sh
-
Install new npm package
Backend:docker compose exec backend npm install <package-name> docker compose restart backend
Frontend:
docker compose exec frontend npm install <package-name> docker compose restart frontend
-
Go to the project's root directory (where this
README.mdis located). -
Run the following command to build and push images to AWS ECR:
./build_and_push.sh
-
Access the web server using SSH:
ssh -i ~/.ssh/coducate-ec2.pem ubuntu@3.79.47.246 -
Run the deployment script:
cd coducate ./deploy.sh -
Publish the extension to the Visual Studio Code Marketplace:
First, update the
CHANGELOG.mdfile with the new version and changes. Make the necessary changes to theREADME.mdfile as well. Optionally, update thepackage.jsonfile (e.g., change the description, keywords, etc.). Then, commit the changes and push them to the repository.Make sure you have the
vscetool installed. If not, install it using:npm install -g vsce
Then login using:
vsce login coducate
If the output is
Publisher 'coducate' is already known. Do you want to overwrite its PAT? [y/N], enternto keep the existing Personal Access Token (PAT) and skip the next step.Enter the Personal Access Token (PAT) when prompted. You can create a new PAT from the Visual Studio Marketplace.
Go to the
coducatedirectory and run the following command to publish the extension:vsce publish <version>
This will automatically update the version in the
package.jsonandpackage-lock.jsonfile.