https://github.com/moemoe89/simple-api-rails
🔺 This repo for practicing Simple API using Ruby (Rails Framework), PostgreSQL, Docker
https://github.com/moemoe89/simple-api-rails
docker postgresql rails ruby
Last synced: 3 months ago
JSON representation
🔺 This repo for practicing Simple API using Ruby (Rails Framework), PostgreSQL, Docker
- Host: GitHub
- URL: https://github.com/moemoe89/simple-api-rails
- Owner: moemoe89
- Created: 2020-04-08T17:26:21.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T23:55:36.000Z (over 3 years ago)
- Last Synced: 2026-01-02T02:24:20.632Z (6 months ago)
- Topics: docker, postgresql, rails, ruby
- Language: Ruby
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# simple-api-rails #
Simple API Rails using Ruby as Programming Language (Rails Framework), PostgreSQL as Database
### Requirements
Simple API is currently extended with the following requirements. Instructions on how to use them in your own application are linked below.
| Requirement | Version |
| ----------- | ---------- |
| Ruby | >= 2.7.1 |
| Rails | >= 6.0.2.2 |
| PosgtreSQL | >= 12.0 |
### Setup
* Setup Ruby
* Setup Rails
* Setup PostgreSQL
### Installation
Make sure you the requirements above already install on your system. Or you could easily run with Docker to make your environment clean.
Clone the project to your directory and install the dependencies.
```sh
$ git clone git@github.com:moemoe89/simple-api-rails.git
$ cd simple-api-rails
$ bundle install
```
Setup your environments.
```sh
$ cp .env.example .env
```
Change your PostgreSQL credentials depends on your PostgreSQL installed config.
```sh
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=simple_api
DB_USERNAME=postgres
DB_PASSWORD=postgres
SECRET_KEY_BASE=xxxxx
```
### Migrate
Setup your migration following by this command.
```sh
$ rails db:migrate
```
### Seed
Seed your data following by this command.
```sh
$ rails db:seed
```
### Run Application
For run application:
```sh
$ rails s
```
Verify the apllication by navigating to your server address in your preferred browser.
```sh
127.0.0.1:3000
```
### Docker
Simple API is very easy to install and deploy in a Docker container. Simply use the docker-compose build to build the image.
```sh
$ docker-compose build
```
Once done, run the Docker image by using docker-compose up command.
```sh
$ docker-compose up -d
```
Setup the DB migration by using docker-compose exec command.
```sh
$ docker-compose exec app rails db:migrate
```
Setup the DB seed by using docker-compose exec command.
```sh
$ docker-compose exec app rails db:seed
```
Verify the application by navigating to your server address in your preferred browser.
```sh
127.0.0.1:3000
```
Stop application could be done with docker-compose stop command.
```sh
$ docker-compose stop
```
License
----
MIT