The server of Kuru Studio Social. Hosted on Heroku. You can access the server locally on port 3001
.
- Rails ~> 7.0.4.2
- Ruby ~> 3.2.1
You need to have Docker and Docker Compose installed on your machine to be able to run the following commands. You also need to setup the config/master.key
before running the commands to make sure that everything will work fine.
# Open your default terminal and run the following
β docker-compose build # Builds the project
β docker-compose run web bin/setup # Builds and populate the database
β docker-compose up # Starts the server
To install a new gem please edit the Gemfile
and run the following commands afterwards.
# Open your default terminal and run the following
β docker-compose down # Stops the server
β docker-compose run web bundle install # Run 'bundle install' inside the container
β docker-compose up --build # Starts and rebuilds the project
To test the application you can check the commands below. Be sure to set the database back to development once done testing!
β docker-compose run web rails db:create RAILS_ENV=test # Builds the test database if it doesn't exist
β docker-compose run web rails db:environment:set RAILS_ENV=test # Set the database being used to "test"
β docker-compose run web rails test # Run tests
β docker-compose run web rails db:environment:set RAILS_ENV=development # Set the database being used to "development"
For other cases please check the commands below.
# Open your default terminal and run the following
β docker-compose run web rails db:migrate RAILS_ENV=development # Run the migration
β docker-compose run web rails console # Open the rails console
β docker-compose run web rake routes |grep 'test_courses' # List routes with 'test_courses' in it
β docker ps # List all docker processes
β docker attach <CONTAINER_NAME> # Attach to the application container (for when you're trying to use Debugger/Byebug)
β heroku run --app kuru-studio-server bash # Attach to the Heroku process
Rails takes care of our credentials. To update them, please do the following.
# Enter bash inside the docker container
β docker-compose build # Builds the project
β docker-compose run web bash # Enter bash inside the docker container
β EDITOR="vim" rails credentials:edit --environment <ENVIRONMENT> # Edit the credentials inside the docker container using Vim. Environment can be 'development', 'test' or 'production'