Feel free to contribute PRs, Issues, Documentation, or in any other way to this repo. We welcome new ideas, implementation suggestions, and feedback!
Prerequisites - 'ruby-3.2.2' and 'postgresql' for database
- Fork the repository and clone it on your local.
- Run command 'bundle install' to install the gems.
- Make sure to update the database.yml file with the correct user name and password.
- Run 'rails db:create' to create the database.
- Run the migrations using 'rails db:migrate'
- Run 'rails server' to get the server up and running.
This application has a development environment that supports Docker. We believe this makes it easier to get started with the application. To get started, you will need either Docker desktop or Docker engine as well as Docker Compose which is a tool that is used for defining and running multi-container Docker applications. In our case for running the web application, database and selenium for testing,
Please note:
Older versions of Docker that were released before version 2 and the new docker compose command will have to use a hyphen in these commands instead.
For example running docker-compose
instead of docker compose
listed in the examples below.
We use Forked Repos - Learn More! 🚀
When contributing to the repository we use a Fork.
In case you are not aware of what a fork is here is a description from the about forks resource on Github.
A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or submit changes to the original repository with pull requests.
To fork a project all you have to do is click fork in the top right of the repository page. See image below from https://guides.github.com/activities/forking/
Once this is done you will have your own version of Meet Another Day in a url that looks like this https://github.com/YOUR_USERNAME/MeetAnotherDay.git
. To get started on this you can clone the repository and make changes for your contributions. If you aren't sure how to do this then we recommend looking at this guide on cloning a repository
In order to keep a fork up to date we need to pull from the upstream repo which will be the original Meet Another Day repo.
This can be setup by running git remote add upstream https://github.com/ChaelCodes/MeetAnotherDay.git
Again if unsure please take a look at Configuring a remote for a fork.
In order to pull changes from the original repo into the fork, we need to fetch the upstream. This can be done either by the UI on Github or the from within your terminal.
This can be done in 3 steps:
git fetch upstream
in order to fetch the changes that have been madegit checkout main
to switch to the default branchgit merge upstream/main
to merge the changes from the original repository into your copy.
- Setup web and db containers.
docker compose up -d
- Create the database.
docker compose run --rm web bundle exec rake db:setup
Run docker compose up -d
will run those services in the background and the application should be available at localhost:3000.
Run docker ps
to see all of the running services which are defined in docker-compose.yml
.
Run docker compose run --rm web bundle exec rspec
to run the test suite. We have GitHub Actions setup to run the test suite automatically. We expect new tests for new functionality, and your PR to having a passing test suite before review.
When you're done, run docker compose down
to stop the containers. You can remove all containers, images, and volumes with docker compose rm -v
when you're done contributing to Meet Another Day.
To open the Rails console:
docker compose run --rm web bin/rails c
To open the Postgres console:
docker compose exec db psql -U postgres MeetAnotherDay_development
To run your tests:
docker compose run --rm web bundle exec rspec
To run rubocop:
docker compose run --rm web bundle exec rubocop
To reset the database with the seed data:
- (If server was running) Shut down the web server:
docker compose stop web
- Reset the DB:
docker compose run web bundle exec rake db:reset
- (If server was running) Bring the web server back up:
docker compose start web
To populate the existing database with seed data (idempotent):
docker compose run web bundle exec rake db:seed
You'll have to update your node_modules folder if you see a message similar to the one below.
web_1 | ========================================
web_1 | Your Yarn packages are out of date!
web_1 | Please run `yarn install --check-files` to update.
web_1 | ========================================
If you update package.json or yarn.lock you'll want to rebuild that module. There might be a more efficient way, but you can run:
> docker compose run --rm web yarn install --check-files
If you see the following error, that means there are database change that haven't been applied.
Migrations are pending. To resolve this issue, run:
bin/rails db:migrate RAILS_ENV=development
Run this docker command to apply the changes.
docker compose run --rm web bundle exec rake db:migrate
If you run into an issue with shared mounts on WSL, (error message: Error response from daemon: path /home/<>/MeetAnotherDay is mounted on / but it is not a shared mount.
) you may want to try sudo mount --make-shared /
.
If you do not have permission to modify files created in Docker, you may need to run sudo chown -R $USER:$USER .