From e52fe8abd5f7614685b06c799f86de08ec6676b8 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Wed, 25 Oct 2023 12:34:28 +0200 Subject: [PATCH 01/14] add a new docker compose to facilitate local dev --- docker-compose.dev.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docker-compose.dev.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 00000000..e3292449 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,33 @@ +version: '3.8' + +services: + web: + env_file: .env + environment: + - LOG_LEVEL=info + image: datacite/levriero + build: . + ports: + - "8045:80" + - "2245:22" + volumes: + - ./app:/home/app/webapp/app + - ./config:/home/app/webapp/config + - ./lib:/home/app/webapp/lib + - ./spec:/home/app/webapp/spec + platform: linux/amd64 + networks: + - lupo_public + depends_on: + - memcached + + memcached: + image: memcached:1.4.31 + platform: linux/amd64 + networks: + - lupo_public + +networks: + lupo_public: + external: true + default: From bd6d0805f9a564b45c43f07769bbb5f1a79ba597 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Wed, 25 Oct 2023 13:04:38 +0200 Subject: [PATCH 02/14] add pull request github action --- .github/workflows/pull_request.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 00000000..3a39a4e4 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,49 @@ +name: Deploy +on: + pull_request: + branches: + - master +jobs: + test: + runs-on: ubuntu-latest + services: + memcached: + image: memcached:1.4.31 + ports: + - 11211/udp + env: + MEMCACHE_SERVERS: "localhost:11211" + SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} + SESSION_ENCRYPTED_COOKIE_SALT: ${{ secrets.SESSION_ENCRYPTED_COOKIE_SALT }} + JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }} + JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby 2.6 + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.6" + - uses: actions/cache@v3 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems- + - name: Install + run: | + cp .env.build .env + gem install bundler + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Lint and Test + env: + MEMCACHE_SERVERS: "localhost:11211" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} + STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} + run: | + # bundle exec rubocop + bundle exec rspec + echo $? From bfb30aaae366cc5e459a259b1232fa1368d3117a Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Wed, 25 Oct 2023 13:06:08 +0200 Subject: [PATCH 03/14] rename the pull request github action --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3a39a4e4..35ee15c4 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,4 @@ -name: Deploy +name: Pull Request on: pull_request: branches: From 9db8a4baa366e60912dc7fa7e0809c51e2edad1d Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 15:58:07 +0200 Subject: [PATCH 04/14] add conditional logic for ENV[API_URL] --- config/application.rb | 12 ++++---- .../fetch_metadata_dataset.yml | 30 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/config/application.rb b/config/application.rb index dffa9c28..611c14b9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,11 +21,11 @@ # load ENV variables from container environment if json file exists # see https://github.com/phusion/baseimage-docker#envvar_dumps -env_json_file = "/etc/container_environment.json" -if File.exist?(env_json_file) - env_vars = JSON.parse(File.read(env_json_file)) - env_vars.each { |k, v| ENV[k] = v } -end +# env_json_file = "/etc/container_environment.json" +# if File.exist?(env_json_file) +# env_vars = JSON.parse(File.read(env_json_file)) +# env_vars.each { |k, v| ENV[k] = v } +# end # default values for some ENV variables ENV["APPLICATION"] ||= "levriero" @@ -35,7 +35,7 @@ ENV["CONCURRENCY"] ||= "25" ENV["GITHUB_URL"] ||= "https://github.com/datacite/levriero" ENV["ORCID_API_URL"] ||= "https://pub.orcid.org/v2.1" -ENV["API_URL"] ||= "https://api.stage.datacite.org" +ENV["API_URL"] ||= Rails.env.development? ? "http://lupo-api" : "https://api.stage.datacite.org" ENV["VOLPINO_URL"] ||= "https://api.stage.datacite.org" ENV["LAGOTTINO_URL"] ||= "https://api.stage.datacite.org" ENV["SASHIMI_QUERY_URL"] ||= "https://api.stage.datacite.org" diff --git a/spec/fixtures/vcr_cassettes/Base/get_datacite_metadata/fetch_metadata_dataset.yml b/spec/fixtures/vcr_cassettes/Base/get_datacite_metadata/fetch_metadata_dataset.yml index 6bfcf385..b6832de0 100644 --- a/spec/fixtures/vcr_cassettes/Base/get_datacite_metadata/fetch_metadata_dataset.yml +++ b/spec/fixtures/vcr_cassettes/Base/get_datacite_metadata/fetch_metadata_dataset.yml @@ -19,7 +19,7 @@ http_interactions: message: OK headers: Date: - - Fri, 04 Jun 2021 09:49:17 GMT + - Thu, 05 May 2022 15:46:24 GMT Content-Type: - application/json; charset=utf-8 Connection: @@ -31,25 +31,31 @@ http_interactions: Cache-Control: - max-age=0, private, must-revalidate Vary: - - Accept-Encoding, Origin + - Accept-Encoding Content-Encoding: - gzip - X-Request-Id: - - 84b87330-6582-47c1-92d8-3a8f72b38fba Etag: - - W/"d7740e5c510865f3aee546d0d8afe40e" + - W/"8c293ffd62ad24c0d545e640145cd58c" X-Runtime: - - '0.098694' - X-Rack-Cors: - - miss; no-origin + - '0.078352' + X-Request-Id: + - 57820303-d288-49fc-9e44-9ceef8c801a7 X-Powered-By: - - Phusion Passenger(R) 6.0.8 + - Phusion Passenger(R) 6.0.13 Server: - - nginx/1.14.0 + Phusion Passenger(R) 6.0.8 + - nginx/1.18.0 + Phusion Passenger(R) 6.0.13 + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET, POST, PUT, PATCH, DELETE, OPTIONS + Access-Control-Allow-Headers: + - Accept,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With + Access-Control-Expose-Headers: + - Authorization body: encoding: ASCII-8BIT string: !binary |- - H4sIAB33uWAAA7RZ2XLaTBZ+FcpXScWxhYD8wXdmEyIg2+xo6r+QWg1qaC3RAogkU/Ma83rzJPO1JBDYpJJM1aTKAR2d5Tunz9LdfLuxjMi4efh2w6ybh5uydFcty9V7QrbErR5ubm+ixKd4YXksxJMRRQEz44iGQgTEqzJ+QJdsX7wCKYyXGangYhZ1I7ZkNICyf3w7ewabHUV++HB/bxuuxekdDEZ3AilhEb3zgtX9W6uF/DjD3HpSb37cvlL81+faX5/K19ibzVbz5sffcJJHNHCNiKqvEF55cWbqquD/4orA/HNTKcyf2cq9E16QgBqRlyN3DUfIPtuMc+aHt6XHu/YdtAh6rvcZXnquwUFdsS11tUwkZ1waDuOJdqlGwMCycmZEzHNh6O9M42Xc/hb+5AC6BrdocFtS7nq/Zz5nvDCfKflz403b8B3DvS19uZv9nvWc8cJ6ruXPzSueZ+2YK2Lf/93Y99+Yz7X8ufkv1KdBdFtq/m7om1dCnyn5XeMgRyziNMvB9GuewK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YYp/qDhM6ajjEqYv698QsQG9gkN2gTtH7hokFftSf6MNpvS2czkEfYd+LGKpdC/vB/abqNXWSiFptYG/IxfyvqYq+xd7rgPiEkI1MxHZRmYawsT72MLWrScQVM2AK2UGsdlIMR1xrrBl6MParSYO/no3p3vKIHXNqUcwL9Hkd9M46j8cB+jd0VF1NBWaRP0r9YGTrvjn1kAyvhNmHvWw68+CD+K4jr6ch8NiW00FOdDDTJivd7W3NkeCfrF4krf2SNLCnfllZqC0xD5E7Qj5GTpVFHqZzSLmcQ8ibNWoGcWjYROwvgAn1IuKSzRIlmyXge+P/Qq5jf82zGshtk/kUdrkErODrHLBunKT7squ584ae1hL2EugnB9hNFujVODjFAT+eycXhEQeuSUHB0cwQ58Dp8fAuHe8mTpT0+vfh/v7ixjfjud/QwKX8Y0XcaKQ3F0e9LHzEyXOLZ5xiKd5G2QXLkrmWOFGmlw1GWFwXbBndNb3YjVII4il82tJgzMStXXp/4O1c7hlWwXSkvGIMjge+ghOw05PhW8orWZxWo4JJPD0tz1BlIXlDOOdJL62pld0lff4oyR+l2liqP9QqD/Jfd5Ik6anrKxbiTPwrvuNVoVVcTcW+9Sv9x3si4Z4tLrkfvt0QzqhA+O3y1xJCLHIn/it+J8k4w5sf4pox8LbMSi8d38oVIke2TMihFjPeSPz0d5mM/cePs4ULC2lxAVws1iu6WJ9rtKflK2K+Tq95T8t3Qce//wIAAP//AwDGsDcUVBoAAA== http_version: null - recorded_at: Fri, 04 Jun 2021 09:49:10 GMT + recorded_at: Thu, 05 May 2022 15:46:24 GMT recorded_with: VCR 5.1.0 From 566eedfd35671f5dbb9d5d0ad6d7dd3780aa8679 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 16:51:12 +0200 Subject: [PATCH 05/14] remove commented out code --- config/application.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index 611c14b9..436142ec 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,11 +21,11 @@ # load ENV variables from container environment if json file exists # see https://github.com/phusion/baseimage-docker#envvar_dumps -# env_json_file = "/etc/container_environment.json" -# if File.exist?(env_json_file) -# env_vars = JSON.parse(File.read(env_json_file)) -# env_vars.each { |k, v| ENV[k] = v } -# end +env_json_file = "/etc/container_environment.json" +if File.exist?(env_json_file) + env_vars = JSON.parse(File.read(env_json_file)) + env_vars.each { |k, v| ENV[k] = v } +end # default values for some ENV variables ENV["APPLICATION"] ||= "levriero" From d9fd39f303964c2563130486ef3e208d2685a8ac Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 17:26:29 +0200 Subject: [PATCH 06/14] remove api_url condition --- config/application.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index 436142ec..b311bbd9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,10 +22,10 @@ # load ENV variables from container environment if json file exists # see https://github.com/phusion/baseimage-docker#envvar_dumps env_json_file = "/etc/container_environment.json" -if File.exist?(env_json_file) - env_vars = JSON.parse(File.read(env_json_file)) - env_vars.each { |k, v| ENV[k] = v } -end +# if File.exist?(env_json_file) +# env_vars = JSON.parse(File.read(env_json_file)) +# env_vars.each { |k, v| ENV[k] = v } +# end # default values for some ENV variables ENV["APPLICATION"] ||= "levriero" @@ -35,7 +35,7 @@ ENV["CONCURRENCY"] ||= "25" ENV["GITHUB_URL"] ||= "https://github.com/datacite/levriero" ENV["ORCID_API_URL"] ||= "https://pub.orcid.org/v2.1" -ENV["API_URL"] ||= Rails.env.development? ? "http://lupo-api" : "https://api.stage.datacite.org" +ENV["API_URL"] ||= "https://api.stage.datacite.org" ENV["VOLPINO_URL"] ||= "https://api.stage.datacite.org" ENV["LAGOTTINO_URL"] ||= "https://api.stage.datacite.org" ENV["SASHIMI_QUERY_URL"] ||= "https://api.stage.datacite.org" From b5a0fc52b3eaf805aabb2843542b124e4a54a845 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 17:27:44 +0200 Subject: [PATCH 07/14] remove commented out code --- config/application.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/application.rb b/config/application.rb index b311bbd9..dffa9c28 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,10 +22,10 @@ # load ENV variables from container environment if json file exists # see https://github.com/phusion/baseimage-docker#envvar_dumps env_json_file = "/etc/container_environment.json" -# if File.exist?(env_json_file) -# env_vars = JSON.parse(File.read(env_json_file)) -# env_vars.each { |k, v| ENV[k] = v } -# end +if File.exist?(env_json_file) + env_vars = JSON.parse(File.read(env_json_file)) + env_vars.each { |k, v| ENV[k] = v } +end # default values for some ENV variables ENV["APPLICATION"] ||= "levriero" From 7ec06a37ee8405964076dbadc50f007442ae4993 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 18:17:15 +0200 Subject: [PATCH 08/14] add rubocop to the pull request workflow --- .github/workflows/pull_request.yml | 57 ++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 35ee15c4..0df82a1d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,32 +18,53 @@ jobs: JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }} JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }} AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} + STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} steps: - - uses: actions/checkout@v3 + - name: Checkout Code + uses: actions/checkout@v3 + - name: Set up Ruby 2.6 uses: ruby/setup-ruby@v1 with: ruby-version: "2.6" - - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Install - run: | - cp .env.build .env - gem install bundler - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - name: Lint and Test + bundler-cache: true + + # - uses: actions/cache@v3 + # with: + # path: vendor/bundle + # key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + # restore-keys: | + # ${{ runner.os }}-gems- + # - name: Install + # run: | + # cp .env.build .env + # gem install bundler + # bundle config path vendor/bundle + # bundle install --jobs 4 --retry 3 + + - name: Run Rubocop env: MEMCACHE_SERVERS: "localhost:11211" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} - run: | - # bundle exec rubocop - bundle exec rspec - echo $? + run: bundle exec rubocop + + # - name: Run Specs + + + # - name: Lint and Test + # env: + # MEMCACHE_SERVERS: "localhost:11211" + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} + # STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} + # run: | + # # bundle exec rubocop + # bundle exec rspec + # echo $? From 3a48bb3073d0ccd5df9361557e8686b78c02b6db Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 18:17:44 +0200 Subject: [PATCH 09/14] fix formatting --- .github/workflows/pull_request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 0df82a1d..527e169c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -56,7 +56,6 @@ jobs: # - name: Run Specs - # - name: Lint and Test # env: # MEMCACHE_SERVERS: "localhost:11211" From 83cb08f202ba70cbab3bd4d1c17fccf512f96aea Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 26 Oct 2023 20:13:41 +0200 Subject: [PATCH 10/14] add run specs gitflow step --- .github/workflows/pull_request.yml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 527e169c..095ca258 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -46,24 +46,8 @@ jobs: # bundle install --jobs 4 --retry 3 - name: Run Rubocop - env: - MEMCACHE_SERVERS: "localhost:11211" - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} - STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} run: bundle exec rubocop - # - name: Run Specs - - # - name: Lint and Test - # env: - # MEMCACHE_SERVERS: "localhost:11211" - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }} - # STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }} - # run: | - # # bundle exec rubocop - # bundle exec rspec - # echo $? + - name: Run Specs + if: success() || failure() + run: bundle exec rspec From 583a873d848c790665ed0a507be34f14e7cecba1 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Wed, 8 Nov 2023 17:51:17 +0200 Subject: [PATCH 11/14] add markdown guide and rename the compose file --- docker-compose.dev.yml => docker-compose.network.yml | 0 nework-setup.md | 12 ++++++++++++ 2 files changed, 12 insertions(+) rename docker-compose.dev.yml => docker-compose.network.yml (100%) create mode 100644 nework-setup.md diff --git a/docker-compose.dev.yml b/docker-compose.network.yml similarity index 100% rename from docker-compose.dev.yml rename to docker-compose.network.yml diff --git a/nework-setup.md b/nework-setup.md new file mode 100644 index 00000000..e596b0ee --- /dev/null +++ b/nework-setup.md @@ -0,0 +1,12 @@ +#Guide to running Levriero entirely locally + +In order to enable Levriero to access the Lupo API locally we need both Lupo and Levriero to run within the same docker network. + +The network is defined in the Lupo **docker-compose.network.yml** and is called **public**. + +Levriero joins this network through the identifier **lupo_public**. + +## Steps +1. Start the Lupo container by executing `docker compose -f docker-compose.network.yml up` + +2. Start the Levriero container by executing `docker compose -f docker-compose.network.yml up` \ No newline at end of file From 82ec76a99494ddc743a1bc7f82e3c9a3b5f9b463 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 9 Nov 2023 11:08:12 +0200 Subject: [PATCH 12/14] skip rubocop workflow step --- .github/workflows/pull_request.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 095ca258..35929ad7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -45,8 +45,9 @@ jobs: # bundle config path vendor/bundle # bundle install --jobs 4 --retry 3 - - name: Run Rubocop - run: bundle exec rubocop + # skip this for now + # - name: Run Rubocop + # run: bundle exec rubocop - name: Run Specs if: success() || failure() From 6dd34808a7022612c62adc6312a3a057b036e62c Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 9 Nov 2023 11:08:41 +0200 Subject: [PATCH 13/14] update the run specs workflow step --- .github/workflows/pull_request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 35929ad7..e70e2deb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -50,5 +50,4 @@ jobs: # run: bundle exec rubocop - name: Run Specs - if: success() || failure() run: bundle exec rspec From 138772c4da21c0c66b8e77a089e3a5020b9cdac1 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Thu, 9 Nov 2023 14:59:39 +0200 Subject: [PATCH 14/14] rename the docker compose file and some docs --- ...network.yml => docker-compose.localstack.yml | 7 +++---- run-with-localstack.md | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) rename docker-compose.network.yml => docker-compose.localstack.yml (86%) create mode 100644 run-with-localstack.md diff --git a/docker-compose.network.yml b/docker-compose.localstack.yml similarity index 86% rename from docker-compose.network.yml rename to docker-compose.localstack.yml index e3292449..dadaf9b4 100644 --- a/docker-compose.network.yml +++ b/docker-compose.localstack.yml @@ -17,7 +17,7 @@ services: - ./spec:/home/app/webapp/spec platform: linux/amd64 networks: - - lupo_public + - localstack_datacite depends_on: - memcached @@ -25,9 +25,8 @@ services: image: memcached:1.4.31 platform: linux/amd64 networks: - - lupo_public + - localstack_datacite networks: - lupo_public: + localstack_datacite: external: true - default: diff --git a/run-with-localstack.md b/run-with-localstack.md new file mode 100644 index 00000000..f2c406dc --- /dev/null +++ b/run-with-localstack.md @@ -0,0 +1,17 @@ +## Guide to run Levriero with local dependencies + +This is a simple guide on how to run Levriero (Event Data) locally. The local setup +includes LocalStack (AWS emulation) and Lupo. + +With this setup you will be able to access the Lupo API endpoints and well as access AWS +services running locally within a container. + +#### Source Code +1. LocalStack (http://this.will.be.something.soon) +2. Lupo (https://github.com/datacite/lupo) +3. Levriero (https://github.com/datacite/levriero) + +#### Steps +1. Start up the LocalStack container `docker compose up` +2. Start up the Lupo container `docker compose -f docker-compose.localstack.yml up` +2. Start up the Levriero container `docker compose -f docker-compose.localstack.yml up` \ No newline at end of file