Place to view most recent news from Malaysia.
Powered by NewsApi.org
Run rails s
to start server without docker environment by default.
Alternatively, initiate server in docker environment in the following.
Note: Prerequisite to have docker
and docker-compose
installed locally.
Autobuild has been configured and triggered upon github master branch push -> docker-autobuild
For first time, build image locally by running the following command. run docker image ls
to list available and existing built image.
Built image will be tagged with latest
label upon completion.
docker-compose build
require: build image
docker-compose up
require: build image
docker-compose run web rails db:create db:migrate
require: build image require: docker credential
docker login
Deploy or push image to docker repo with latest
tag
docker push ganyizhong/malaysia_news:latest
docker-compose push
Checkout docker hub to view image push and autobuild status.
Google Cloud Language API is used for text classification in article content.
Important Notes
Credential json file contains private information and was intended to be used in Google Cloud environment. Do not commit and push to public repo and 3rd party cloud services.
In order to use the API,
- Create new project in google cloud console.
- Navigate to
IAM & admin
to create new service account. - Download credential
json
file - Copy credential json content and paste to
rails credentials
with convertedyml
format. - Use the following command to edit rails credentials.
EDITOR="code --wait" rails credentials:edit
Each local machine has local database setup for e.g. windows ubuntu subsystem for postgres.
To skip tracking local tracked file,
git update-index --skip-worktree <file>
To view files with skipped flagged,
git ls-files -v
Any files skipped will have character S
marked in the result.
To undo skipped worktree
git update-index --no-skip-worktree <file>
when running rubocop
in windows environment, probably would complain the following:
Layout/EndOfLine: Carriage return character detected.
caused by EOL rendered different in different OS.
try the following commands to resolve the issue
git config core.autocrlf false
git rm --cached -r .
git reset --hard