Skip to content

Commit

Permalink
Merge branch 'main' into ian/#38/view-accepted-submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
otsembo authored Mar 21, 2023
2 parents d68563f + e7bee92 commit ae05fae
Show file tree
Hide file tree
Showing 21 changed files with 482 additions and 70 deletions.
1 change: 0 additions & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
ruby-version: '3.0.2'
bundler-cache: false
- run: make api-gem-setup
- run: make api-lint-fix
- run: make api-lint-check

client-lint:
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
./api/.env

./idea

.idea/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Moringa School

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ docker-build:
start:
docker compose up


# Stop Docker environment
stop:
docker compose stop
Expand Down
123 changes: 84 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
![GitHub contributors](https://img.shields.io/github/contributors/sinatra-pod/moringa-library?color=green)
![GitHub repo size](https://img.shields.io/github/repo-size/sinatra-pod/moringa-library?color=violet)

​Welcome to Moringa Hub, home of Moringa's most awesome projects!
This is an application where users can showcase their projects,designs and articles; as well as view and review all kinds of other projects, designs and articles that have been made by other members of the Moringa ecosystem.
Welcome to Moringa Hub, the home of Moringa's most awesome projects!
This is an application where users can showcase their projects, designs and articles; as well as view and review all kinds of other projects, designs and articles that have been made by other members of the Moringa ecosystem.

## Prerequisites
In order to use this repository, you will need to have the following setup in your computer.

![node:v0.9.0](https://img.shields.io/badge/node-v0.9.0-blue.svg)
![npm:v8.15.0](https://img.shields.io/badge/npm-v8.15.0-blueviolet.svg)
![ruby:2.7.4](https://img.shields.io/badge/ruby-2.7.4-yellow.svg)

* `node v0.9.0+`
* `npm 8.15.0+`
* `ruby 2.7.4+`


## Setup Instructions

### Project Setup
This section will guide you through setting up and running this repository on your local machine.

### Project

* Clone the repository
```
Expand All @@ -18,69 +32,78 @@ This is an application where users can showcase their projects,designs and artic
```
cd moringa-library
```
* To interact with the front-end part of the application, navigate to the webapp folder
* To interact with the front-end part of the application, navigate to the `webapp` folder
```
cd webapp
```
* To interact with the back-end part of the application, navigate to the api folder
* To interact with the back-end part of the application, navigate to the `api` folder
```
cd api
```

## Environment Variables Setup
### Environment Variables
To use the environment variables, create three environment files: `.env`, `.env.development` and `.env.production`.

Use the following criteria to set your environment variables:
* `.env` -Common variables that are not specific to any environment.
* `.env.development` -Variables that are only specific to `development` or `test` environments.
* `.env.production` -Variables that are only specific to production environment. Example: `ENTRY`.
* `.env` - Common variables that are not specific to any environment.
* `.env.development` - Variables that are only specific to `development` or `test` environments.
* `.env.production` - Variables that are only specific to production environment. Example: `ENTRY`.

```
[ENVIRONMENT_DETAILS]
```{shell}
# DOCKER POSTRESQL DATABASE
DEV_DB_USER='database_username'
DEV_DB_PASSWORD='database_password'
DEV_DB_NAME='database_name'
[DOMAIN]
CURRENT_SITE_DOMAIN=
# DOMAIN
CURRENT_SITE_DOMAIN=http://localhost:8080/
[SENTRY]
SENTRY_DNS=
# SENTRY
SENTRY_DNS=8.8.8.8
[COMMON_API_CREDS]
# COMMON_API_CREDS
REACT_APP_API_URL=https://myApiServerUrl.com
```
NB:
* Ensure you use the prefix `REACT_APP_` to store all the variables that are needed in the React Application. Example: `REACT_APP_NAME=janedoe`
* **DO NOT** commit any of the environment files to version control.

## Docker Setup
* Run the command below from the terminal depending on the environment needed.
```
[DEV]
docker-compose -f docker-compose-dev.yml up --build -d
### Docker

[UAT]
docker-compose -f docker-compose-uat.yml up --build -d
This application is built with Docker, you will need to have the following installed in order to use it:
* `Makefile` - Use the link below to install https://makefiletutorial.com/.
* `Docker` - https://www.docker.com/.

[PROD]
docker-compose -f docker-compose-prod.yml up --build -d
1. Build Docker container and start service.
```
make docker-build
```
2. Show logs from container processes.
```
make show-logs
```
3. Stop container.
```
make start
```
4. All client sided routes are rendered from root, `/`. Example `http://localhost:8080/admin` - Admin React Page
5. All API endpoints are rendered from `/api/`. Example `http://localhost:8080/api/admin` - Admin endpoint

```
## Prerequisites
![node:v0.9.0](https://img.shields.io/badge/node-v0.9.0-blue.svg)
![npm:v8.15.0](https://img.shields.io/badge/npm-v8.15.0-blueviolet.svg)
![ruby:2.7.4](https://img.shields.io/badge/ruby-2.7.4-yellow.svg)
* `node v0.9.0` and above
* `npm 8.15.0` and above
* `ruby 2.7.4` and above
**NB: All requests are listening from port `8080`.**

## Technologies Used
This application has been built with these technologies:
* Ruby `v2.7.0`
* Sinatra `v3.0`
* RSpec `v3.1.2`
* React `v18.0`
* Typescript `v4.9.5`
* Jest `v29.5.0`
* Firebase `v9.17.0`
* Github Actions
* Github Projects
* nginx
* Docker
* GitHub Actions
* GitHub Projects



Expand All @@ -96,7 +119,7 @@ docker-compose -f docker-compose-prod.yml up --build -d
* [Kelvin Muriithi](https://github.com/KelvinMuriithi)
* [Titus Muthomi](https://github.com/Kalunge)

## Collaboration Methodology
## Contribution Guide

In order to contribute to this repository, you need to follow these steps:

Expand All @@ -113,7 +136,7 @@ git checkout name/feature

* Once you have completed your work on the feature, create a commit with a comprehensive message. Example:
```git
git commit -m"Login: added JWT token in header"
git commit -m "Login: added JWT token in header"
```

* Push the changes to the remote repository
Expand All @@ -137,6 +160,28 @@ MONGO_DB_URI='random env here'
## License
[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Copyright (c) 2023 **Sinatra Pod**

```
MIT License
Copyright (c) 2023 Moringa School
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

Copyright (c) 2023 **Sinatra Pod**
3 changes: 2 additions & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Use a Ruby base image
FROM ruby:3.7
FROM ruby:3.0.2

# Set the working directory inside the container
WORKDIR /app

# Copy the Gemfile and Gemfile.lock into the container
COPY Gemfile Gemfile.lock ./
COPY .ruby-version ./

# Install dependencies
RUN bundle install
Expand Down
33 changes: 16 additions & 17 deletions api/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.4.2)
activesupport (= 7.0.4.2)
activerecord (7.0.4.2)
activemodel (= 7.0.4.2)
activesupport (= 7.0.4.2)
activesupport (7.0.4.2)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -24,21 +24,21 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
minitest (5.17.0)
minitest (5.18.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
nio4r (2.5.8)
parallel (1.22.1)
parser (3.2.1.0)
parser (3.2.1.1)
ast (~> 2.4.1)
pg (1.4.6)
puma (6.1.0)
puma (6.1.1)
nio4r (~> 2.0)
rack (2.2.6.2)
rack (2.2.6.4)
rack-env (0.1.3)
rack-protection (3.0.5)
rack
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rake (13.0.6)
Expand All @@ -59,11 +59,11 @@ GEM
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
rspec-mocks (3.12.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.46.0)
rubocop (1.48.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
Expand All @@ -73,9 +73,9 @@ GEM
rubocop-ast (>= 1.26.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.26.0)
rubocop-ast (1.27.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sinatra (3.0.5)
mustermann (~> 3.0)
Expand Down Expand Up @@ -114,8 +114,7 @@ DEPENDENCIES
sqlite3 (~> 1.6, >= 1.6.1)

RUBY VERSION
ruby 3.0.2p107

ruby 3.0.2p107

BUNDLED WITH
2.3.14
Loading

0 comments on commit ae05fae

Please sign in to comment.