diff --git a/Dockerfile b/Dockerfile index bcb62297504ce90e95fa7d63dd9b198929633097..09642865a721f20db4675262c253f8231d9cdc4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM ruby:3.1.0-alpine +FROM ruby:3.1.0 ENV BUNDLER_VERSION=2.3.26 @@ -10,16 +10,8 @@ WORKDIR /app COPY Gemfile Gemfile.lock ./ -RUN apk add --update --no-cache \ - build-base \ - curl-dev \ - shared-mime-info \ - postgresql-dev \ - file \ - imagemagick-dev \ - nodejs-current \ - libarchive \ - git +RUN apt update && \ + apt install -y libarchive13 # Prevent libxml2 and libxslt conflicts RUN bundle config build.nokogiri --use-system-libraries diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000000000000000000000000000000000..f327c42d0b54edc63bd8cae5e0775f232f03a3df --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,644 @@ +GIT + remote: https://github.com/c3sl/dspace-rest-client.git + revision: 07f49b52007160278e63b866a76e5f1cf800fa1b + branch: master + specs: + dspace_rest_client (3.1.0) + activesupport (>= 5.0) + faraday (>= 1.0.0) + json (>= 1.8.3, >= 1.8) + net-http-persistent (>= 2.9.4) + resource_kit (>= 0.1.4) + +GIT + remote: https://github.com/kreeti/kt-paperclip.git + revision: 11abf222dc31bff71160a1d138b445214f434b2b + branch: master + specs: + kt-paperclip (7.1.1) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) + marcel (~> 1.0.1) + mime-types + terrapin (~> 0.6.0) + +GIT + remote: https://github.com/lynndylanhurley/devise_token_auth.git + revision: 30b6d30037ea646646e58ba2ec5ff4682b654f2c + branch: master + specs: + devise_token_auth (1.2.1) + bcrypt (~> 3.0) + devise (> 3.5.2, < 5) + rails (>= 4.2.0, < 7.1) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.4.1) + actionpack (= 7.0.4.1) + activesupport (= 7.0.4.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.4.1) + actionpack (= 7.0.4.1) + activejob (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.4.1) + actionpack (= 7.0.4.1) + actionview (= 7.0.4.1) + activejob (= 7.0.4.1) + activesupport (= 7.0.4.1) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.4.1) + actionview (= 7.0.4.1) + activesupport (= 7.0.4.1) + rack (~> 2.0, >= 2.2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.4.1) + actionpack (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.4.1) + activesupport (= 7.0.4.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + active_model_serializers (0.10.13) + actionpack (>= 4.1, < 7.1) + activemodel (>= 4.1, < 7.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activejob (7.0.4.1) + activesupport (= 7.0.4.1) + globalid (>= 0.3.6) + activemodel (7.0.4.1) + activesupport (= 7.0.4.1) + activerecord (7.0.4.1) + activemodel (= 7.0.4.1) + activesupport (= 7.0.4.1) + activerecord-import (1.4.1) + activerecord (>= 4.2) + activestorage (7.0.4.1) + actionpack (= 7.0.4.1) + activejob (= 7.0.4.1) + activerecord (= 7.0.4.1) + activesupport (= 7.0.4.1) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.4.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + acts_as_list (1.0.4) + activerecord (>= 4.2) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) + ansi (1.5.0) + ast (2.4.2) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) + bcrypt (3.1.18) + benchmark-ips (2.10.0) + better_errors (2.8.3) + coderay (>= 1.0.0) + erubi (>= 1.0.0) + rack (>= 0.9.0) + bindex (0.8.1) + brakeman (5.4.0) + builder (3.2.4) + bullet (7.0.7) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.11) + byebug (11.1.3) + case_transform (0.2) + activesupport + choice (0.2.0) + chronic (0.10.2) + climate_control (0.2.0) + coderay (1.1.3) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) + concurrent-ruby (1.1.10) + connection_pool (2.3.0) + crass (1.0.6) + curb (1.0.5) + cvss (0.99.0) + dalli (3.2.3) + database_cleaner (2.0.1) + database_cleaner-active_record (~> 2.0.0) + database_cleaner-active_record (2.0.1) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + date (3.3.3) + dawnscanner (1.6.9) + cvss + haml + justify + logger-colors + ptools + ruby_parser + sqlite3 + sys-uname + terminal-table + dead_end (4.0.0) + derailed_benchmarks (2.1.2) + benchmark-ips (~> 2) + dead_end + get_process_mem (~> 0) + heapy (~> 0) + memory_profiler (>= 0, < 2) + mini_histogram (>= 0.3.0) + rack (>= 1) + rack-test + rake (> 10, < 14) + ruby-statistics (>= 2.1) + thor (>= 0.19, < 2) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + devise (4.8.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + diff-lcs (1.5.0) + docile (1.4.0) + elastic-transport (8.2.1) + faraday (< 3) + multi_json + elasticsearch (8.7.0) + elastic-transport (~> 8) + elasticsearch-api (= 8.7.0) + elasticsearch-api (8.7.0) + multi_json + equalizer (0.0.11) + erubi (1.12.0) + execjs (2.8.1) + factory_bot (6.2.1) + activesupport (>= 5.0.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) + railties (>= 5.0.0) + faker (3.1.0) + i18n (>= 1.8.11, < 2) + faraday (2.7.3) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (3.0.2) + faraday-net_http_persistent (2.1.0) + faraday (~> 2.5) + net-http-persistent (~> 4.0) + feature (1.4.0) + ffi (1.15.5) + ffi-libarchive (1.1.3) + ffi (~> 1.0) + flamegraph (0.9.5) + flay (2.13.0) + erubi (~> 1.10) + path_expander (~> 1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) + flog (4.6.6) + path_expander (~> 1.0) + ruby_parser (~> 3.1, > 3.1.0) + sexp_processor (~> 4.8) + get_process_mem (0.2.7) + ffi (~> 1.0) + gitlab (4.19.0) + httparty (~> 0.20) + terminal-table (>= 1.5.1) + globalid (1.0.1) + activesupport (>= 5.0) + haml (6.1.1) + temple (>= 0.8.2) + thor + tilt + hashie (5.0.0) + heapy (0.2.0) + thor + httparty (0.21.0) + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) + i18n (1.12.0) + concurrent-ruby (~> 1.0) + ice_nine (0.11.2) + immigrant (0.3.6) + activerecord (>= 3.0) + json (2.6.3) + jsonapi-renderer (0.2.2) + justify (1.0.2) + jwt (2.6.0) + kwalify (0.7.2) + launchy (2.5.2) + addressable (~> 2.8) + logger-colors (1.0.0) + loofah (2.19.1) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.8.0.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (1.0.1) + method_source (1.0.0) + mime-types (3.4.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2022.0105) + mimemagic (0.4.3) + nokogiri (~> 1) + rake + mina (1.2.4) + open4 (~> 1.3.4) + rake + mini_histogram (0.3.1) + mini_mime (1.1.2) + minitest (5.17.0) + minitest-reporters (1.5.0) + ansi + builder + minitest (>= 5.0) + ruby-progressbar + multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.2.3) + mustache (1.1.1) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) + net-http-persistent (4.0.1) + connection_pool (~> 2.2) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) + nokogiri (1.14.0-x86_64-linux) + racc (~> 1.4) + oauth (1.1.0) + oauth-tty (~> 1.0, >= 1.0.1) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + oauth-tty (1.0.5) + version_gem (~> 1.1, >= 1.1.1) + oauth2 (1.4.11) + faraday (>= 0.17.3, < 3.0) + jwt (>= 1.0, < 3.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 4) + omniauth (1.9.2) + hashie (>= 3.4.6) + rack (>= 1.6.2, < 3) + omniauth-facebook (9.0.0) + omniauth-oauth2 (~> 1.2) + omniauth-google-oauth2 (0.8.2) + jwt (>= 2.0) + oauth2 (~> 1.1) + omniauth (~> 1.1) + omniauth-oauth2 (>= 1.6) + omniauth-oauth (1.2.0) + oauth + omniauth (>= 1.0, < 3) + omniauth-oauth2 (1.7.3) + oauth2 (>= 1.4, < 3) + omniauth (>= 1.9, < 3) + omniauth-twitter (1.4.0) + omniauth-oauth (~> 1.1) + rack + open4 (1.3.4) + orm_adapter (0.5.0) + paper_trail (14.0.0) + activerecord (>= 6.0) + request_store (~> 1.4) + parallel (1.22.1) + paranoia (2.6.1) + activerecord (>= 5.1, < 7.1) + parser (3.2.0.0) + ast (~> 2.4.1) + path_expander (1.1.1) + pg (1.4.5) + phantomjs (2.1.1.0) + pkg-config (1.5.1) + psych (5.0.2) + stringio + ptools (1.5.0) + public_activity (2.0.2) + actionpack (>= 5.0.0) + activerecord (>= 5.0) + i18n (>= 0.5.0) + railties (>= 5.0.0) + public_suffix (5.0.1) + puma (6.0.2) + nio4r (~> 2.0) + pundit (2.3.0) + activesupport (>= 3.0.0) + racc (1.6.2) + rack (2.2.6.2) + rack-attack (6.6.1) + rack (>= 1.0, < 3) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-mini-profiler (3.0.0) + rack (>= 1.2.0) + rack-protection (3.0.5) + rack + rack-test (2.0.2) + rack (>= 1.3) + rails (7.0.4.1) + actioncable (= 7.0.4.1) + actionmailbox (= 7.0.4.1) + actionmailer (= 7.0.4.1) + actionpack (= 7.0.4.1) + actiontext (= 7.0.4.1) + actionview (= 7.0.4.1) + activejob (= 7.0.4.1) + activemodel (= 7.0.4.1) + activerecord (= 7.0.4.1) + activestorage (= 7.0.4.1) + activesupport (= 7.0.4.1) + bundler (>= 1.15.0) + railties (= 7.0.4.1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-erd (1.7.2) + activerecord (>= 4.2) + activesupport (>= 4.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) + railties (7.0.4.1) + actionpack (= 7.0.4.1) + activesupport (= 7.0.4.1) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) + rake (13.0.6) + rdoc (6.5.0) + psych (>= 4.0.0) + redis-client (0.12.1) + connection_pool + reek (6.1.4) + kwalify (~> 0.7.0) + parser (~> 3.2.0) + rainbow (>= 2.0, < 4.0) + regexp_parser (2.6.1) + request_store (1.5.1) + rack (>= 1.4) + resource_kit (0.1.8) + addressable (>= 2.3.6, < 3.0.0) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rexml (3.2.5) + rmagick (5.1.0) + pkg-config (~> 1.4) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.1) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.11) + rspec-expectations (~> 3.11) + rspec-mocks (~> 3.11) + rspec-support (~> 3.11) + rspec-support (3.12.0) + rspec_api_documentation (6.1.0) + activesupport (>= 3.0.0) + mustache (~> 1.0, >= 0.99.4) + rspec (~> 3.0) + rubocop (1.43.0) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.24.1) + parser (>= 3.1.1.0) + ruby-graphviz (1.2.5) + rexml + ruby-progressbar (1.11.0) + ruby-statistics (3.0.1) + ruby2_keywords (0.0.5) + ruby_parser (3.19.2) + sexp_processor (~> 4.16) + rubycritic (4.7.0) + flay (~> 2.8) + flog (~> 4.4) + launchy (>= 2.0.0) + parser (>= 2.6.0) + rainbow (~> 3.0) + reek (~> 6.0, < 7.0) + ruby_parser (~> 3.8) + simplecov (>= 0.17.0) + tty-which (~> 0.4.0) + virtus (~> 1.0) + rubyzip (2.3.2) + screencap (0.1.4) + phantomjs + sdoc (2.6.0) + rdoc (>= 5.0) + searchkick (5.1.1) + activemodel (>= 5.2) + hashie + sexp_processor (4.16.1) + shoulda (4.0.0) + shoulda-context (~> 2.0) + shoulda-matchers (~> 4.0) + shoulda-context (2.0.0) + shoulda-matchers (4.5.1) + activesupport (>= 4.2.0) + sidekiq (7.0.3) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.11.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sinatra (3.0.5) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.5) + tilt (~> 2.0) + slim (4.1.0) + temple (>= 0.7.6, < 0.9) + tilt (>= 2.0.6, < 2.1) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) + spring (4.1.1) + sqlite3 (1.6.0-x86_64-linux) + stackprof (0.2.23) + streamio-ffmpeg (3.0.2) + multi_json (~> 1.8) + stringio (3.0.4) + sys-uname (1.2.2) + ffi (~> 1.1) + temple (0.8.2) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) + thor (1.2.1) + thread_safe (0.3.6) + tilt (2.0.11) + timeout (0.3.1) + tty-which (0.4.2) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) + tzinfo-data (1.2023.3) + tzinfo (>= 1.0.0) + unicode-display_width (2.4.2) + uniform_notifier (1.16.0) + version_gem (1.1.1) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) + warden (1.2.9) + rack (>= 2.0.9) + web-console (4.0.4) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + whenever (1.0.0) + chronic (>= 0.6.3) + zeitwerk (2.6.6) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + active_model_serializers + activerecord-import + acts_as_list + annotate + bcrypt (>= 3.1.7) + better_errors (~> 2.8.0) + brakeman + bullet + byebug + connection_pool + curb (>= 0.8.8) + dalli + database_cleaner + dawnscanner + derailed_benchmarks + devise + devise_token_auth! + dspace_rest_client! + elasticsearch (~> 8.6) + execjs + factory_bot_rails + faker + faraday + faraday-multipart (~> 1.0, >= 1.0.4) + faraday-net_http_persistent (~> 2.0) + feature + ffi-libarchive + flamegraph + gitlab + immigrant + kt-paperclip! + mimemagic + mina + minitest-reporters + multipart-post (~> 2.0) + net-http-persistent + omniauth-facebook + omniauth-google-oauth2 (= 0.8.2) + omniauth-twitter + paper_trail + paranoia + pg + public_activity + puma + pundit + rack-attack + rack-cors + rack-mini-profiler + rails (>= 6.0.0) + rails-erd + rainbow + rdoc + rmagick + rspec-rails (>= 3.8) + rspec_api_documentation + rubocop + rubycritic + rubyzip + screencap + sdoc (>= 0.4.0) + searchkick + shoulda + sidekiq + sinatra + slim + spring + stackprof + streamio-ffmpeg (>= 1.0.0) + tzinfo-data + web-console (~> 4.0.4) + whenever + +BUNDLED WITH + 2.3.26 diff --git a/README.md b/README.md index 52a4ca2f431f104fc77d14a8cf8e6c1b7343d18b..13c8283d4eeae57b93d0576f815b0ebc13bfd46c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,43 @@ 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/>. +# Setup with Docker Compose + +## Requirements + * `docker >= 20.10.5` + * `git` + * ElasticSearch instance + * PostgreSQL + +## Steps +(Dependending in your docker version, you may need to use `docker-compose` instead of `docker compose`) + 1. Clone the repository. + 1. In the root of the repository run `docker compose build`. This will build the necessary images for running PortalMEC. If this command fails, check if you are behind a HTTP Proxy. If that's the case, clean any built images with `docker compose down --rmi all --remove-orphans` and then use + * `docker compose build --build-arg HTTP_PROXY="<http proxy url here> --build-arg HTTPS_PROXY="<https proxy url here>"`. + + 1. Make a copy of the `.env.dev` file named `.env` and change the necessary configuration. You will need to change at least: + * `PORTALMEC_DB_HOST` + * `PORTALMEC_DB_NAME` + * `PORTALMEC_DB_USERNAME` + * `PORTALMEC_DB_PASSWORD` + * `PORTALMEC_ELASTICSEARCH_HOST` + * `PORTALMEC_ELASTICSEARCH_LOGIN` + * `PORTALMEC_ELASTICSEARCH_PASSWORD` + * `PORTALMEC_ELASTICSEARCH_INDEX_PREFIX` + * `RAILS_ENV` + 1. This step is only needed if you don't have a database. Run `docker compose run --entrypoint sh app`. This will instantiate a container from the `app` image built in the previous step and run a shell inside it. In the new shell: + 1. Run `bundle exec rake db:create` to create the database. + * If you have a database dump, you should use it now. Run *in the host*: `psql -U <database user> -d <database name> < <dump name>.sql` + 1. Run `bundle exec rake db:migrate` to create the database schema. + 1. Run `bundle exec rake db:seed` to populate the database with default data. + 1. Run `bundle exec rake searchkick:reindex:all` to index the data in ElasticSearch. + 1. Run `exit` to exit the shell. + 1. Run `docker compose up`. + +## Local specific configuration +The URL `host.docker.internal` inside a docker container is configured to point to the host machine. When you need to use a service running in the host machine (for example a local PostgresSQL installation), you should use this address instead of `localhost`. + +# Old Setup ## Requirements * rvm diff --git a/docker-compose.yml b/docker-compose.yml index fd7c58684c63779cf8fbd73fdeb8630c169dd2dc..23ace3b3ac30641dcf691a40f335c532db817b42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: - "host.docker.internal:host-gateway" redis: - image: redis:7.0.11-alpine + image: redis:7.0.11 sidekiq: build: