Notes file on various GearMate info.
This README contains important information about setting up and troubleshooting the GearMate III Backend project.
docker system prune
: Removes unused datadocker-compose restart backend
: Restarts the backend service
console.log(import.meta.env.MODE);
: Logs the current environment mode
docker exec -it gearmate_iii-backend-1 bash
: Enters the backend containerdocker exec -it gearmate_iii-backend-1 bin/rails db:migrate
: Runs migrationsexit
: Exits the container
- Enter the Docker environment:
docker exec -it gearmate_iii-backend-1 bash
-
Run migrations:
bin/rails db:migrate
-
Exit the container:
exit
- To enter the Ruby console:
docker exec -it gearmate_iii-backend-1 bin/rails c
Add the following variable:
VITE_API_URL=http://localhost:3000
Add the following variables:
POSTGRES_USER=<yourname>
POSTGRES_PASSWORD=<password>
Frontend logs:
Error: connect ECONNREFUSED 127.0.0.1:3000
Console error: =UserApi.ts:5 GET http://localhost:5173/api/me net::ERR_ABORTED 500 (Internal Server Error)
- Ensure the Vite proxy in
vite.config
is pointing to the correct path (localhost vs backend) - Add this line to development.rb if missing
config.hosts << "backend"
- If having dependency issues in the frontend:
docker-compose exec frontend npm install
Enter the backend environment
docker exec -it gearmate_iii-backend-1 bash
Reindex the Item being searched, for example, to reindex the Item model:
rails searchkick:reindex CLASS=Item
For heroku:
heroku run rails searchkick:reindex CLASS=Item --app gearmate
reindex in Heroku environment:
heroku run rails searchkick:reindex CLASS=Item
Push to Heroku
git push heroku main
git subtree push --prefix backend heroku main
heroku run rails console --app gearmate
If you want to look at attributes of an object, you need to add .attributes at the end of your method like so
User.find(1).attributes
Run migrations in heroku environment.
heroku run rake db:migrate
- Ping elastic search from backend container:
curl http://elasticsearch:9200
https://elements.heroku.com/buildpacks/timanovsky/subdir-heroku-buildpack
Enter redis cli
docker-compose exec redis redis-cli
docker exec -it gearmate_iii-backend-1 bin/rails c
: Opens the Ruby console
cd backend/log
shift+control+W
shift+control+V