Getting Started

Prerequisites

Before diving in, ensure you have the following tools installed:

Setup Instructions

1. Clone the Repository

git clone https://github.com/Rekindle-Learning/rekindle.git

2. Environment Setup

Navigate to the project directory and create an .env file.

cd rekindle/
touch .env

Next, reach out to a member of the team for the contents of the env.

3. Config Adjustments

  • Ensure Docker Desktop is open.

  • Remove ,secure: true from config/initialiser/session_store.

  • Add the following to the docker-compose.yml file on line 7:

    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    

    ⚠️ NB! Ensure YAML formatting is correct, docker compose is indentation sensitive, here is a helpful tool. Look at the color coded example below, follow the patter for your modifications. Docker-Compose-Example

4. Permissions & Dependencies

  • Change permissions:

    chmod 777 ./bin/webpack-dev-server
    
  • Update dependencies for Ruby web application

    docker-compose run --rm web bundle update
    
  • Build all images

    docker-compose build
    
  • Address rake issues and create the database:

    docker compose run web bundle exec rake db:create
    
  • Open PGAdmin

  • Hilton Jacobson will supply a restoration file with mock data for the database. Integrate this data using pg4admin after connecting to the newly instantiated database.

    For a visual guide: Helpful Video Tutorial

  • Sync the schema with:

    docker compose run --rm web bundle exec rake db:migrate RAILS_ENV=development
    

    ⚠️NB! Always delete the server.pid file in tmp/pids before using docker compose.

  • If npm modules are missing, run:

    docker compose run --rm web npm install
    
  • Update python in the dockerfile:

    RUN apt-get update && apt-get install -y python-is-python3 2to3
    

5. Additional Windows Steps

For Windows users, normalize the docker.entrypoint.sh line endings. First, download the dos2unix utility. After extracting, run:

dos2unix c:\path\to\rekindle\docker.entrypoint.sh

6. Starting Application

  • Start the Docker containers:

    docker compose up
    

7. Final Step

Visit localhost:3000 to view your Admin portal.


Common Issues

Database cannot connect

Error message:

sql: could not connect to server: Connection refused Is the server running on host “localhost” (::1) and accepting

Ensure that your database is running on the correct port. Check your docker-compose file.

Also make sure you do not have a local version of Postgres running on port 5432. If need be, you can set the docker Postgres instance to run on another port in the docker-compose file, and then update the psql command accordingly.

A server is already running

Run rm tmp/pids/server.pid. You may consider creating the dstart alias listed below if you frequently encounter this issue.

RSpec fails to run tests due to pending migrations

You need to prepare your test DB:

docker-compose run --rm web rake db:migrate db:test:prepare

We need to clear the assets cache:

ssh [email protected]
app

rm -rf tmp/cache/* .sass-cache/
OR (for heroku)
app
heroku repo:purge_cache -a appname  

Webpacker won’t start after build Error messages appear in the logs, similar to the following:

rekindle-webpacker-1  | /app/node_modules/.bin/webpack-dev-server: 1: /app/node_modules/.bin/webpack-dev-server: XSym: not found
rekindle-webpacker-1  | /app/node_modules/.bin/webpack-dev-server: 2: /app/node_modules/.bin/webpack-dev-server: 0047: not found
rekindle-webpacker-1  | /app/node_modules/.bin/webpack-dev-server: 3: /app/node_modules/.bin/webpack-dev-server: baebe48db4509e117ed95eca45abdd2e: not found
rekindle-webpacker-1  | /app/node_modules/.bin/webpack-dev-server: 4: /app/node_modules/.bin/webpack-dev-server: ../webpack-dev-server/bin/webpack-dev-server.js: not found
rekindle-webpacker-1 exited with code 127  

This is due to the docker image (Linux) trying to run binaries previously installed by npm for Windows.

Solution - delete the contents of the “node_modules” folder in your project directory, then run

docker-compose run --rm web bundle exec npm install

to re-install the node modules for Linux

Re build the docker for a certain arcitecture

export DOCKER_DEFAULT_PLATFORM=linux/amd64