Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ EXPOSE 3000
# Configure entrypoint to run Rails
ENTRYPOINT ["./bin/docker-entrypoint.dev"]

# Start Rails server by default
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
# Start Tailwind CSS watcher and Rails server
CMD ["sh", "-c", "bundle exec rails tailwindcss:watch & bundle exec rails server -b 0.0.0.0"]
51 changes: 28 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SkillRX

SkillRX is a Ruby on Rails content management application which will allow medical training providers to upload and manage content which will be delivered to Raspberry Pi and other computers in low-resource areas for use by medical professionals at these locations.

The project provides a ground-up rewrite of the [CMES Admin Panel](https://github.com/techieswithoutborders/cmes-admin-panel-next) for [Techies Without Borders](https://techieswithoutborders.us/).
Expand All @@ -15,7 +16,6 @@ Thank you for checking out our work. We are in the process of setting up the rep

[Contribution guidelines for this project](CONTRIBUTING.md)


# Install & Setup

Clone the codebase
Expand All @@ -35,7 +35,7 @@ bin/setup

To run the app locally, use:
```
bin/dev
bin/server
```

To update dependencies in Gemfile, use:
Expand All @@ -48,39 +48,32 @@ You should see the seed organization by going to:
http://localhost:3000/
```


# Running specs

This project uses:
* `rspec` for testing
* `shoulda-matchers` for expectations
* `factory_bot` for making records

To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues.

```sh
# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
$ bundle exec rspec
$ bin/rspec

# Run all spec files in a single directory (recursively)
$ bundle exec rspec spec/models
$ bin/rspec spec/models

# Run a single spec file
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb
$ bin/rspec spec/controllers/accounts_controller_spec.rb

# Run a single example from a spec file (by line number)
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8
$ bin/rspec spec/controllers/accounts_controller_spec.rb:8

# See all options for running specs
$ bundle exec rspec --help
$ bin/rspec --help
```

# Setup

Clone this repo and run `bin/setup`. Run `bin/dev` or `bin/server` (if you like Overmind) to start working with app.

# Testing

This project uses:
* `rspec` for testing
* `shoulda-matchers` for expectations
* `factory_bot` for making records

To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues.

# Docker Development Environment

This project is containerised using Docker to ensure consistent development environments across the team.
Expand All @@ -106,14 +99,20 @@ This project is containerised using Docker to ensure consistent development envi

4. Build and start the containers:
```
docker compose up
make build
make start
```

Or directly with Docker Compose:
```
docker compose -f docker-compose.dev.yml up
```

This will build the images and initialise the containers. You can exit and stop the containers using CTRL+C.

## Container Architecture
The development environment consists of three containerised services:

The development environment consists of three containerised services:
* app : Rails application service
* Handles the main application logic
* Runs on Ruby on Rails
Expand Down Expand Up @@ -142,7 +141,9 @@ make help
```

## Common Tasks

### Rebuilding the Environment

To completely rebuild your development environment:

```bash
Expand All @@ -151,13 +152,15 @@ make rebuild
This command will clean existing containers, rebuild images, and prepare the database.

### Viewing Logs

To monitor service logs:
```
make logs # View all container logs
make logs app # View only Rails application logs
```

### Container Management

Individual services can be managed using:
```
make start db # Start only the database container
Expand All @@ -166,9 +169,11 @@ make restart db # Restart only the database container
```

### Troubleshooting

If you encounter issues:
- Ensure all required ports are available on your system
- Verify that your .env file contains all necessary variables
- Try rebuilding the environment with make rebuild
- Check container logs for specific error messages

# Test staging deployment
3 changes: 0 additions & 3 deletions bin/dev

This file was deleted.

3 changes: 3 additions & 0 deletions bin/docker-entrypoint.dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ bundle check || bundle install
# If running the rails server then create or migrate existing database
./bin/rails db:prepare

# Build CSS assets
./bin/rails tailwindcss:build

# Execute the main command passed to docker run
exec "$@"
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ FileUtils.chdir APP_ROOT do
unless ARGV.include?("--skip-server")
puts "\n== Starting development server =="
STDOUT.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
exec "bin/server"
end
end