Spoor is a Docker-based development environment for Ruby on Rails applications, inspired by Laravel Sail. It simplifies setting up and managing a Dockerized development environment, allowing you to focus on building your Rails application.
Before using Spoor, ensure that Docker is installed and running on your system. You can download Docker from https://www.docker.com/.
Add the gem to your Rails application's Gemfile:
gem "spoor"Then run:
bundle installAfter installing the gem, set up Spoor in your project:
spoor installThis will generate the necessary docker-compose.yml and .env files. If your project already has a Dockerfile, it will not be overwritten unless you use the --force-dockerfile flag:
spoor install --force-dockerfileTo start the Spoor environment, run:
spoor upThis will start the Docker containers in the background.
To stop the environment, run:
spoor downYou can run Rails commands inside the Docker container using:
spoor rails <command>For example:
spoor rails console
spoor rails db:migrateTo run Bundler commands, use:
spoor bundle <command>For example:
spoor bundle installTo start a PostgreSQL CLI session, run:
spoor psqlTo start a Redis CLI session, run:
spoor redisTo start a Bash shell in the app container, run:
spoor bashThe .env file generated during installation contains the following environment variables:
APP_PORT=3000
FORWARD_DB_PORT=5432
FORWARD_REDIS_PORT=6379
WWWUSER=1000
WWWGROUP=1000You can customize these values to fit your project's needs.
The docker-compose.yml file is pre-configured with the following services:
- web: The Rails application.
- db: PostgreSQL database.
- redis: Redis for caching or background jobs.
You can modify this file to add or remove services as needed.
-
Install Spoor:
spoor install
-
Start the environment:
spoor up
-
Run database migrations:
spoor rails db:migrate
-
Access the Rails console:
spoor rails console
-
Stop the environment when done:
spoor down
Contributions are welcome! If you'd like to contribute to Spoor, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes.
- Submit a pull request.
Spoor is open-source software licensed under the MIT License.
If you encounter any issues or have questions, please open an issue on GitHub.