diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index bf992099..00000000 --- a/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -/tmp/ -.vscode -/public/assets/ -/public/packs/ diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index c0ccb169..e4477f20 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -6,30 +6,12 @@ on: workflow_dispatch: jobs: - docker_publish: - needs: deploy - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: standardnotes/listed - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - tags: "latest,${{ github.sha }}" - deploy: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - uses: actions/cache@v2 with: path: vendor/bundle @@ -62,20 +44,9 @@ jobs: LISTED_SSH_SERVER: ${{ secrets.LISTED_SSH_SERVER_DEV }} LISTED_SSH_DEPLOY_TO: ${{ secrets.LISTED_SSH_DEPLOY_TO_DEV }} - notify_discord: - needs: deploy - - runs-on: ubuntu-latest - - steps: - - name: Run Discord Webhook - uses: johnnyhuy/actions-discord-git-webhook@main - with: - webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }} - code_scanning: runs-on: ubuntu-latest - + continue-on-error: true steps: - uses: actions/checkout@v2 - name: Runs Brakeman vulnerability scanner diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ee033fea..59e70450 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,13 +2,11 @@ name: PR on: pull_request: - branches: [ develop ] + branches: [ master ] jobs: test: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Runs Brakeman vulnerability scanner diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index 3d76eb9d..02cebef6 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -6,28 +6,12 @@ on: workflow_dispatch: jobs: - docker_publish: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: standardnotes/listed - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - tags: "stable,${{ github.sha }}" - deploy: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - uses: actions/cache@v2 with: path: vendor/bundle @@ -59,14 +43,3 @@ jobs: LISTED_SSH_USER: ${{ secrets.LISTED_SSH_USER_PROD }} LISTED_SSH_SERVER: ${{ secrets.LISTED_SSH_SERVER_PROD }} LISTED_SSH_DEPLOY_TO: ${{ secrets.LISTED_SSH_DEPLOY_TO_PROD }} - - notify_discord: - needs: deploy - - runs-on: ubuntu-latest - - steps: - - name: Run Discord Webhook - uses: johnnyhuy/actions-discord-git-webhook@main - with: - webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }} diff --git a/.nvmrc b/.nvmrc index ed9f5a0a..d9289897 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.18.2 +16.15.1 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..5b013b97 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.7.6 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f7bd5b69..00000000 --- a/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -FROM ruby:2.6.5-slim-stretch - -ARG UID=1000 -ARG GID=1000 - -RUN addgroup --system listed --gid $GID && adduser --disabled-password --system listed --gid $GID --uid $UID - -RUN rm /bin/sh && ln -s /bin/bash /bin/sh - -RUN apt-get update \ - && apt-get install -y git build-essential libmariadb-dev curl imagemagick python \ - && apt-get -y autoclean - -RUN mkdir -p /usr/local/nvm -ENV NVM_DIR /usr/local/nvm -ENV NODE_VERSION 10.20.1 -ENV NVM_INSTALL_PATH $NVM_DIR/versions/node/v$NODE_VERSION -ENV WEBPACKER_NODE_MODULES_BIN_PATH=value - -RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash - -RUN source $NVM_DIR/nvm.sh \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION \ - && nvm use default - -ENV NODE_PATH $NVM_INSTALL_PATH/lib/node_modules -ENV PATH $NVM_INSTALL_PATH/bin:$PATH - -RUN npm install -g yarn - -WORKDIR /listed - -RUN chown -R $UID:$GID . - -USER listed - -COPY --chown=$UID:$GID package.json yarn.lock Gemfile Gemfile.lock /listed/ - -RUN yarn install --pure-lockfile - -RUN gem install bundler && bundle install - -COPY --chown=$UID:$GID . /listed - -RUN bundle exec rake assets:precompile - -EXPOSE 3000 - -ENTRYPOINT [ "docker/entrypoint.sh" ] - -CMD [ "start" ] diff --git a/Gemfile b/Gemfile index 47af6c35..afae3bc7 100644 --- a/Gemfile +++ b/Gemfile @@ -5,21 +5,34 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end -gem 'rails', '= 5.2.5' -gem 'mysql2' -gem 'puma', '~> 4.3' -gem 'sass-rails', '~> 5.0' -gem 'uglifier', '>= 1.3.0' -gem 'safe_yaml' gem 'dotenv-rails', '~> 2.7.6' -gem 'sanitize' -gem 'rouge' gem 'haml-rails' -gem 'whenever' -gem 'redcarpet' +gem 'mini_racer', platforms: :ruby +gem 'mysql2', '>= 0.3.13', '< 0.5' +gem 'puma', '~> 4.3' gem 'rack-cors', :require => 'rack/cors' +gem 'rails', '= 5.2.5' gem 'react_on_rails', '11.3' +gem 'redcarpet' +gem 'rouge' +gem 'safe_yaml' +gem 'sanitize' +gem 'sass-rails', '~> 5.0' +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'uglifier', '>= 1.3.0' gem 'webpacker', '~> 4' +gem 'whenever' +gem "aws-sdk-acm", "~> 1.34" +gem "aws-sdk-elasticloadbalancingv2", "~> 1.47" +gem "aws-sdk-route53", "~> 1.40" +gem "aws-sdk-sns", "~> 1.49" +gem "aws-sdk-sqs", "~> 1.48" +gem "capistrano-shoryuken", "~> 0.1.5" +gem "lograge", "~> 0.11.2" +gem "newrelic_rpm", "= 8.2.0" +gem "newrelic-infinite_tracing", "= 8.2.0" +gem "rails-letsencrypt", "~> 0.9.0" +gem "shoryuken", "~> 5.3" group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console @@ -27,45 +40,18 @@ group :development, :test do end group :development do - # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. - gem 'web-console', '>= 3.3.0' - gem 'listen', '~> 3.0.5' - gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' - gem 'rb-readline' - # Deployment tools - gem 'capistrano' + gem 'brakeman' gem 'capistrano-bundler' + gem 'capistrano-git-submodule-strategy', '~> 0.1.22' gem 'capistrano-passenger', '>= 0.2.0' gem 'capistrano-rails' gem 'capistrano-rvm' gem 'capistrano-sidekiq' - gem 'capistrano-git-submodule-strategy', '~> 0.1.22' + gem 'capistrano' + gem 'listen', '~> 3.0.5' + gem 'rb-readline' + gem 'spring-watcher-listen', '~> 2.0.0' + gem 'spring' + gem 'web-console', '>= 3.3.0' end -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -gem 'mini_racer', platforms: :ruby - - -gem "rails-letsencrypt", "~> 0.9.0" - -gem "aws-sdk-acm", "~> 1.34" - -gem "aws-sdk-elasticloadbalancingv2", "~> 1.47" - -gem "lograge", "~> 0.11.2" - -gem "aws-sdk-route53", "~> 1.40" - -gem "newrelic_rpm", "= 8.2.0" - -gem "newrelic-infinite_tracing", "= 8.2.0" - -gem "shoryuken", "~> 5.3" - -gem "capistrano-shoryuken", "~> 0.1.5" - -gem "aws-sdk-sqs", "~> 1.48" - -gem "aws-sdk-sns", "~> 1.49" diff --git a/Gemfile.lock b/Gemfile.lock index 1a3c6517..dc728255 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,11 +50,11 @@ GEM sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) aws-eventstream (1.2.0) - aws-partitions (1.539.0) + aws-partitions (1.570.0) aws-sdk-acm (1.48.0) aws-sdk-core (~> 3, >= 3.122.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.124.0) + aws-sdk-core (3.130.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) @@ -65,15 +65,16 @@ GEM aws-sdk-route53 (1.59.0) aws-sdk-core (~> 3, >= 3.122.0) aws-sigv4 (~> 1.1) - aws-sdk-sns (1.49.0) - aws-sdk-core (~> 3, >= 3.122.0) + aws-sdk-sns (1.53.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.48.0) - aws-sdk-core (~> 3, >= 3.122.0) + aws-sdk-sqs (1.51.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) aws-sigv4 (1.4.0) aws-eventstream (~> 1, >= 1.0.2) bindex (0.8.1) + brakeman (5.2.3) builder (3.2.4) byebug (11.1.3) capistrano (3.6.1) @@ -101,7 +102,7 @@ GEM capistrano sidekiq (>= 3.4) chronic (0.10.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) connection_pool (2.2.5) crass (1.0.6) dotenv (2.7.6) @@ -111,37 +112,41 @@ GEM erubi (1.10.0) erubis (2.7.0) execjs (2.8.1) - faraday (1.8.0) + faraday (1.10.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) + faraday-net_http_persistent (~> 1.0) faraday-patron (~> 1.0) faraday-rack (~> 1.0) - multipart-post (>= 1.2, < 3) + faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) + multipart-post (>= 1.2, < 3) faraday-net_http (1.0.1) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - ffi (1.15.4) + faraday-retry (1.0.3) + ffi (1.15.5) globalid (1.0.0) activesupport (>= 5.0) - google-protobuf (3.19.1-x86_64-darwin) - google-protobuf (3.19.1-x86_64-linux) + google-protobuf (3.19.4) + google-protobuf (3.19.4-x86_64-linux) googleapis-common-protos-types (1.3.0) google-protobuf (~> 3.14) - grpc (1.42.0-x86_64-darwin) - google-protobuf (~> 3.18) + grpc (1.46.3) + google-protobuf (~> 3.19) googleapis-common-protos-types (~> 1.0) - grpc (1.42.0-x86_64-linux) - google-protobuf (~> 3.18) + grpc (1.46.3-x86_64-linux) + google-protobuf (~> 3.19) googleapis-common-protos-types (~> 1.0) haml (5.2.2) temple (>= 0.8.0) @@ -157,11 +162,10 @@ GEM haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - i18n (1.8.11) + i18n (1.10.0) concurrent-ruby (~> 1.0) - jmespath (1.4.0) - libv8-node (16.10.0.0-x86_64-darwin) - libv8-node (16.10.0.0-x86_64-linux) + jmespath (1.6.1) + libv8-node (16.10.0.0) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -170,7 +174,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.12.0) + loofah (2.15.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -178,11 +182,12 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) + mini_portile2 (2.8.0) mini_racer (0.5.0) libv8-node (~> 16.10.0.0) - minitest (5.14.4) + minitest (5.15.0) multipart-post (2.1.1) - mysql2 (0.5.3) + mysql2 (0.4.10) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) @@ -191,9 +196,12 @@ GEM newrelic_rpm (= 8.2.0) newrelic_rpm (8.2.0) nio4r (2.5.8) - nokogiri (1.12.5-x86_64-darwin) + nokogiri (1.13.3) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + nokogiri (1.13.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.12.5-x86_64-linux) + nokogiri (1.13.3-x86_64-linux) racc (~> 1.4) public_suffix (4.0.6) puma (4.3.10) @@ -236,7 +244,7 @@ GEM thor (>= 0.19.0, < 2.0) rainbow (3.0.0) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) rb-readline (0.5.5) @@ -247,8 +255,8 @@ GEM rails (>= 3.2) rainbow (~> 3.0) redcarpet (3.5.1) - redis (4.5.1) - request_store (1.5.0) + redis (4.6.0) + request_store (1.5.1) rack (>= 1.4) rouge (3.26.1) ruby2_keywords (0.0.5) @@ -274,7 +282,7 @@ GEM aws-sdk-core (>= 2) concurrent-ruby thor - sidekiq (6.3.1) + sidekiq (6.4.1) connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) @@ -285,7 +293,7 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.4.1) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) @@ -293,7 +301,7 @@ GEM net-scp (>= 1.1.2) net-ssh (>= 2.8.0) temple (0.8.2) - thor (1.1.0) + thor (1.2.1) thread_safe (0.3.6) tilt (2.0.10) tzinfo (1.2.9) @@ -316,8 +324,8 @@ GEM chronic (>= 0.6.3) PLATFORMS - x86_64-darwin-18 - x86_64-darwin-20 + arm64-darwin-21 + ruby x86_64-linux DEPENDENCIES @@ -326,6 +334,7 @@ DEPENDENCIES aws-sdk-route53 (~> 1.40) aws-sdk-sns (~> 1.49) aws-sdk-sqs (~> 1.48) + brakeman byebug capistrano capistrano-bundler @@ -340,7 +349,7 @@ DEPENDENCIES listen (~> 3.0.5) lograge (~> 0.11.2) mini_racer - mysql2 + mysql2 (>= 0.3.13, < 0.5) newrelic-infinite_tracing (= 8.2.0) newrelic_rpm (= 8.2.0) puma (~> 4.3) @@ -364,4 +373,4 @@ DEPENDENCIES whenever BUNDLED WITH - 2.2.32 + 2.3.15 diff --git a/README.md b/README.md index 16bb5a0f..4b6855a5 100644 --- a/README.md +++ b/README.md @@ -65,14 +65,3 @@ rails s -p 3009 ``` Now the application should be running on http://localhost:3009 and webpack-dev-server should be watching source files and recompiling as you make changes in your code to allow live reloading. - - -### How to run locally with Docker - -To run the application locally you have to install Docker and type the following: -``` -cp .env.sample .env -docker-compose up -d -``` - -Now the application should be running on http://localhost:3000 diff --git a/client/app/components/authors/header/menu/HomepageMenu.jsx b/client/app/components/authors/header/menu/HomepageMenu.jsx index 7e557b6f..944e2c06 100644 --- a/client/app/components/authors/header/menu/HomepageMenu.jsx +++ b/client/app/components/authors/header/menu/HomepageMenu.jsx @@ -15,7 +15,6 @@ const HomepageMenu = ({ isMobileMenuOpen, isDesktopMenu }) => {