Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • portalmec/portalmec
  • rfhferreira/cleanning-portalmec
2 results
Show changes
Commits on Source (2138)
Showing with 1021 additions and 469 deletions
attributes:
- content
- foreign_key
- inheritance
disconnected: true
filename: erd
filetype: pdf
indirect: true
inheritance: true
markup: true
notation: bachman
orientation: horizontal
polymorphism: false
sort: true
warn: true
title: PortalMEC
exclude: null
only: null
prepend_primary: false
......@@ -22,6 +22,10 @@ Gemfile.lock
/public/assets
/config/orientdb.yml
/config/dspace.yml
/shared/*
dump.rdb
/public/system/*
# ignore server scripts
puma.sh
start_puma.sh
......@@ -30,3 +34,7 @@ portalmec.service
portalmec-sidekiq.service
sidekiq.sh
autocomplete-server.service
# ignore configs
/config/database.yml
/config/sidekiq.yml
\ No newline at end of file
image: ruby:2.7
services:
- postgres:11
- elasticsearch:6.5.1
- redis:latest
variables:
POSTGRES_DB: portalmec_test
POSTGRES_USER: portalmec
POSTGRES_PASSWORD: 123mudar
ELASTICSEARCH_URL: http://elasticsearch:9200
REDIS_HOST: redis:6379
REDIS_RATE_LIMIT_URL: redis://redis:6379/0
DSPACE_LOGIN: '$mecdb1_login'
DSPACE_PASS: '$mecdb1_password'
stages:
- test
- apidoc
- deploy
before_script:
- apt-get update -y
- apt-get install default-jre postgresql-client -y
- apt-get remove --purge --auto-remove redis-server -y
- apt-get install redis-server -y
- apt-get install nodejs -y
# official way to provide password to psql: http://www.postgresql.org/docs/9.3/static/libpq-envars.html
- export PGPASSWORD=$POSTGRES_PASSWORD
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
# gems
- gem install bundler
- bundle install --jobs $(nproc) --path=/cache/bundler
test:
stage: test
script:
- export $BUNDLE_PATH='~/'
- export BUNDLE_PATH='~/'
- bundle install
- bundle exec rake db:migrate RAILS_ENV=test
- bundle exec rake test
\ No newline at end of file
- bundle exec rake db:migrate:reset RAILS_ENV=test
- bundle exec rake spec:acceptance
tags:
- ruby
- postgres
- elasticsearch
- redis
doc:
stage: apidoc
script:
- bundle exec rake db:migrate:reset RAILS_ENV=test
- bundle exec rake docs:generate
- ./docploy.sh
only:
- stable
tags:
- ruby
- postgres
- elasticsearch
- redis
# deploy:
# stage: deploy
# script:
# # - mina deploy
# only:
# - master
# tags:
# - ruby
# - postgres
# - elasticsearch
# - redis
Rails:
Enabled: true
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
Metrics/LineLength:
Enabled: false
2.2
3.0.1
# v0.1.0
## Features
* Activities
* Show activities from a specific user
* Show all activities that logged user can see (feed)
* Show all users public activities
* Show logged user activities
* Bookmarks
* Create a bookmark
* Get a list of bookmarks
* Remove a bookmark
* Collections
* Add items to a collection
* Create a collection
* Destroy a collection
* Get a collection
* Get a list of collections
* Get all collection versions
* Like a collection
* Remove items from a collection
* Unlike a collection
* Update a collection
* Complaints
* Create a complaint
* Get a list of complaints
* Contacts
* Create contacts
* Destroy a contact
* Get a contact
* Get all contacts
* Update contacts
* Downloads
* Download the content (files) of a learning object or collection
* Educational Stages
* Create an educational stage
* Get a list of educational stages
* Remove an educational stage
* Follows
* Follow an user or collection
* Unfollow an user or collection
* Institutions
* Create an institution
* Destroy an institution
* Get a list of institutions
* Get an institution
* Update an institution
* Languages
* Create a language
* Destroy a language
* Get a language
* Get a list of languages
* Update languages
* Learning Objects
* Create a learning object draft
* Destroy an attachment (file) of a learning object
* Destroy a learning object
* Get a learning object
* Get a list of learning objects
* Get all learning object versions
* Like a learning object
* Publish a learning object
* Unlike a learning object
* Update a learning object
* Mime Types
* Create a mime type
* Destroy a mime type
* Get a mime type
* Get a list of mime types
* Update a mime type
* Object Type
* Create an object type
* Destroy an object type
* Get a list of object types
* Get an object type
* Update an object type
* Reviews
* Create a review
* Delete a review
* Get a list of reviews
* Rate a review
* Update a review
* Statistics
* Show statistics about the API usage
* Subjects
* Create a subject
* Get a list of subjects
* Remove a subject
* Suggestions
* Create suggestions
* Destroy suggestions
* Get a suggestion
* Get all suggestions
* Update suggestions
* Tags
* Create a tag
* Untag an object or collection
* Users
* Create an user
* Create an user by admin
* Login with an user account
* Logout of an user account
* Destroy an user
* Destroy an user by admin
* Get a list of users
* Get an user
* Get all user versions
* Show an user’s collections
* Show an user’s drafts
* Show an user’s learning objects
* Show an user’s liked collections
* Show an user’s liked learning objects
* Show an user’s own reviews
* Show an user’s received reviews
* Show what the user is following
* Update an user
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential nodejs
RUN mkdir /app
WORKDIR /tmp
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install -j 3
WORKDIR /app
CMD ["rails", "server", "-b", "0.0.0.0"]
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
gem 'rails', '>=6.0.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# autocomplete for search
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'sdoc', '>= 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'bcrypt', '>= 3.1.7'
# memcached
gem 'dalli'
# dalli multi thread gem
gem 'connection_pool'
# web server
gem 'puma'
# protection
gem 'rack-attack'
# scheduler
gem 'whenever', require: false
......@@ -47,81 +30,89 @@ gem 'whenever', require: false
gem 'devise'
# files
gem 'paperclip'
gem 'kt-paperclip', github: 'kreeti/kt-paperclip', branch: 'master'
# enable login via rest
gem 'devise_token_auth'
gem 'devise_token_auth', github: 'lynndylanhurley/devise_token_auth', branch: 'master'
gem 'rack-cors', require: 'rack/cors'
# bootstrap
gem 'bootstrap-sass'
# select box used in search
gem 'select2-rails'
gem 'rmagick'
# Gruff (graphs and charts)
# gem 'gruff'
# Dspace REST API Integration
gem 'dspace_rest_client'
gem 'dspace_rest_client', github: 'c3sl/dspace-rest-client', branch: 'master'
# pretty logs
gem 'rainbow'
# chart js
gem 'chart-js-rails'
# depoyment
gem 'mina'
# management visual framework
gem 'locastyle'
# paginate results
gem 'kaminari'
# docs
gem 'rdoc'
gem 'stackprof'
# awesome font icons
gem 'font-awesome-rails'
group :development do
gem 'annotate'
gem 'immigrant'
gem 'derailed_benchmarks'
# Generate ER Diagram from database (use: rake erd)
# Github Page: https://github.com/voormedia/rails-erd
gem 'rails-erd'
# Manage the database application (use: localhost:3000/rails/db)
# Github Page: https://github.com/igorkasyanchuk/rails_db
#gem 'rails_db'
# static analysis tool for security vulnerabilities
gem 'brakeman', require: false
gem 'dawnscanner', require: false
# evaluate source code
gem 'rubycritic', require: false
# ruby lint
gem 'rubocop', require: false
# profiler
gem 'rack-mini-profiler'
gem 'flamegraph'
# reduce queries - https://github.com/flyerhzm/bullet
gem 'bullet'
gem 'better_errors'
gem 'better_errors', '~>2.8.0'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'web-console', '~>4.0.4'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# JavaScript runtime
gem 'execjs'
# local mailbox
# gem 'mailcatcher'
end
group :test do
gem 'shoulda'
gem 'shoulda-callback-matchers', '~> 1.1.1'
gem 'minitest-reporters'
gem 'faker'
gem 'database_cleaner'
end
gem 'streamio-ffmpeg', '~> 1.0.0'
group :development, :test do
gem 'rspec-rails', '>= 3.8' #original is 3.6
gem 'rspec_api_documentation'
gem 'factory_bot_rails'
end
gem 'streamio-ffmpeg', '>= 1.0.0'
# sidekiq
gem 'sidekiq'
......@@ -129,19 +120,16 @@ gem 'sinatra', require: false
gem 'slim'
# CUrl
gem 'curb', '~> 0.8.8'
gem 'curb', '>= 0.8.8'
# libArchive (Zip, Rar, ...)
# C extension is required
# For Mac OSX: brew install libarchive && bundle config build.libarchive "--with-opt-dir=/usr/local/opt/libarchive"
# gem 'libarchive', '~> 0.1.2', :require => 'libarchive_ruby'
gem 'libarchive-static'
gem 'ffi-libarchive'
gem 'gitlab'
# upload
gem 'resumablejs-rails'
# authorization
gem 'pundit'
......@@ -155,17 +143,32 @@ gem 'feature'
gem 'activerecord-import'
# social connect
gem 'social-share-button'
gem 'meta-tags'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-google-oauth2'
# edit in place with ajax
gem 'best_in_place'
gem 'omniauth-google-oauth2', '~>0.8.2'
# get mime type
gem 'mimemagic'
# html screenshot
gem 'screencap'
# model json serializer
gem 'active_model_serializers'
# zip files
gem 'rubyzip'
# user activity
gem 'public_activity'
# gem 'rails-observers'
# soft-deleted for active record models
#gem 'paranoia', github: 'rubysherpas/paranoia', branch: 'rails4'
gem 'paranoia'
# models versioning
gem 'paper_trail'
gem 'acts_as_list'
This diff is collapsed.
# Portal MEC
[![build status](https://ci.gitlab.c3sl.ufpr.br/projects/19/status.png?ref=master)](https://ci.gitlab.c3sl.ufpr.br/projects/19?ref=master)
## License
Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana
This file is part of portalmec.
portalmec is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
portalmec is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with portalmec. If not, see <http://www.gnu.org/licenses/>.
## Requirements
* ruby >=2.2
* rvm
* Dspace server, with solr access allowed
* Postgres
* OrientDB
* Using rvm you will install ruby "3.0.1"
* ruby "3.0.1"
* Dspace server "6.x"
* Postgres "13"
* Elasticsearch "6.8.13"
* Redis ">=5.0"
* nvm
* Using nvm you will install Node.js "14.15.1"
## Setup
To setup the rails app, will be needed run active record migrations,
orient db migrations and populate active record database:
``` ./bin/setup ```
## Definitions
Some definitions and vocabulary of project domain model.
## Deploy
Before deploy to production server, some env vars need be set:
### Application Secrets
The command 'rake secret' can be used for generate random string
* SECRET_TOKEN
* SECRET_KEY_BASE
### Postgres/Active Record credentials
* PORTALMEC_DB_NAME
* PORTALMEC_DB_USERNAME
* PORTALMEC_DB_PASSWORD
### OrientDB credentials
* PORTALMEC_ORIENTDB_HOST
* PORTALMEC_ORIENTDB_DATABASE
* PORTALMEC_ORIENTDB_USERNAME
* PORTALMEC_ORIENTDB_PASSWD
* PORTALMEC_ORIENTDB_PORT
### Dspace credentials
* PORTALMEC_DSPACE_SOLR
* PORTALMEC_DSPACE_REST
* PORTALMEC_DSPACE_PORT
* PORTALMEC_DSPACE_HOST
### Rails environment
* RAILS_SERVE_STATIC_FILES - default is FALSE
* RAILS_ENV: production, test or development
Run:
## NVM and Node.js
For install NVM and Node.js, use this follwing commands:
```
$ mina setup
$ mina deploy
```
\ No newline at end of file
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
```
```
$ nvm install 14.15.1
```
## Postgres
After the first install, you can run this commands:
* ``` sudo passwd postgres ```
* ``` su postgres```
* ``` psql -c "ALTER USER postgres WITH PASSWORD '$PASSWORD'" -d template1 ```
* ``` createuser -h localhost -U postgres -d $USER_DB ```
* ``` psql -c "ALTER USER $USER_DB WITH PASSWORD '$PASSWORD'" -d template1 ```
Note: You can ask for the database dump for someone in the project.
You need to modify the file "/etc/postgresql/11/main/pg_hba.conf", the modification is
* comment the 1st and 2nd lines with "peer" and copy them replacing "peer" with "md5".
After this, run this command:
* ``` systemctl restart postgresql ```
## Rvm
After finish the installer, you will need to add in your ~/.bashrc this commands:
* ``` export PATH="$PATH:$HOME/.rvm/bin" ```
* ``` source /home/Your_user/.rvm/scripts/rvm ```
After this, run the command ```source ~/.bashrc```.
``` Note ``` : If does not work, you can try modify the commands above, for this:
* ```export PATH="$PATH:/usr/share/rvm/bin" ```
* ```source /usr/share/rvm/scripts/rvm```
## Setup
First of all, you need to configure the dspace, elasticsearch and redis servers. Create an user for postgres database.
After this setup, open the configuration files inside the project repository and update the following files:
* config/database.yml: change your postgres credentials for development and test environment.
* config/dspace.yml: change your dspace host and credentials for development and test environment.
* config/sidekiq.yml: change your redis hosts and ports.
* config/initializers/elasticsearch.rb: inside elsif Rails.env.test? change url 'elasticsearch:9200' to 'localhost:9200'.
* config/initializers/gitlab.rb: change your gitlab host for bug reports and set env var with private token. ( $ export GITLAB_PORTALMEC_PRIVATE_TOKEN=131237128937128937 )
## Install
After installed the requeriments, the first you will need to do is run:
* ``` bundle install ```
This command will install all required gems for the project.
```Note ```: Sometimes some gems throw errors. That is because there is a chance that you do not have all the required dependecies for the installation of the gem that failed to install. Please install the dependencies and try again.
After all gems were installed succesfuly. Please create the database using the following commands:
* ``` rake db:create ```
* If you have the dump of the database, use it before db:migrate.
* To use the dump, run this commands: ```psql -U $DATABASE_USER -d $DATABASE_NAME < $DATABASE_PATH/dump_name.sql ```
* ``` rake db:migrate ```
``` Note ``` : You need to load the dump in the database_dev.
This procedure will create and configure all table in the project database
For the search mechanism to works, execute the CMD in the portalmec directory ``` rake searchkick:reindex:all ```.
<!--### Development environment-->
<!-- Se algum dia o docker do projeto for arrumado, essa parte deve bastar como explicação -->
<!--
#### Using docker for development env
You can use docker for your development environment. For that, run:
./bin/docker-setup
Now, redis, elasticsearch and postgres are running as services and linked to PortalMEC application. Database migrations were execute and the configs (database.yml, sidekiq.yml was replaced by config/docker/...).
If all development and test vars are set, run:
* ```rake db:create```
This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data.-->
Once finished, your application is read to be used. To acess it, run CMD:
``` bundle exec rails s ```
<!--
Se a rotina de testes descrita pelo rake test for arrumada, o comando a baixo funcionara
### Running tests suite
For tests, TestUnit is used, and to run it
``` bundle exec rake test ```-->
For tests, run this commands:
* ``` export DSPACE_LOGIN=your_login ```
* ``` export DSPACE_PASS=your_password ```
* ``` source ~/.bashrc ```
* ``` bundle exec rake spec:acceptance ```
### Production environment
When working in the production environment, the environment variables must be set in the file config/env_vars.sh.
After setting the variables in the file, you must include the following line into your user's .bashrc file:
* ``` source /home/portalmec/portalmec/config/env_vars.sh ```
You will also need to make some other configurations:
* Redis vars need to be set on config/sidekiq.yml
* In config/initializers/devise.rb, change the e-mail addresses. (Ex.: config.mailer_sender = 'suporte@suporte.com')
* In app/services/learning_object_publisher.rb, in the create_dspace_item change the DSpace collection where the items are gonna be created.
* Change the paths in the *.sh and *.service files in the root of the project to the absolute path of the project in the production server.
* As root, copy the *.service files to the server's systemd directory (Ex.: /lib/systemd/system), then run systemctl enable portalmec and systemctl enable portalmec-sidekiq.
* As root, copy the sidekiq_log.conf file to the rsyslog directory (/etc/rsyslog.d/) and give the shared/logs/sidekiq.log file the same permissions and ownership as the /var/log/syslog file.
Now that your application is ready, you can run it with:
* ``` systemctl start portalmec portalmec-sidekiq ```
......@@ -2,5 +2,6 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'dawn/tasks'
Rails.application.load_tasks
app/assets/images/animation.png

4.43 KiB

app/assets/images/audio.png

6.27 KiB

app/assets/images/brasil.png

597 B

app/assets/images/cc.png

1.36 KiB

app/assets/images/colecoes.png

40.4 KiB

app/assets/images/colections.png

40.4 KiB

app/assets/images/contraste.png

2.23 KiB

app/assets/images/fnde.png

21.8 KiB