forked from e621ng/e621ng
[Docker] Add solargraph to the image, and a few more things
* Allow modifying .env without git complainging about changes to commit * Require COMPOSE_PROFILE=solargraph for solargraph to be included in the image * Set required vscode settings for solargraph to correctly work in docker * Clean up .solargraph.yml. All these removed values are the default * Disable autocomplete in the rails console * Add a compose service to run rubocop * Upddate rubocop config Added some, removed some, ordered alphabetically. Before: 844 files inspected, 6871 offenses detected, 6095 offenses autocorrectable After: 844 files inspected, 8024 offenses detected, 7538 offenses autocorrectable Most of the new offences are because of Style/StringLiterals (1312)
This commit is contained in:
parent
939dde40b4
commit
179a948cf2
@ -68,3 +68,10 @@
|
||||
# export DANBOORU_VERSION=
|
||||
# export DANBOORU_HOSTNAME=
|
||||
# export DANBOORU_IQDBS_SERVER=
|
||||
|
||||
#
|
||||
# Development Only
|
||||
#
|
||||
|
||||
# Start the integrated solargraph service from the compose file. Requires a rebuild when changed.
|
||||
# export COMPOSE_PROFILES=solargraph
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
.env.*
|
||||
.env
|
||||
.bundle
|
||||
.yardoc
|
||||
config/database.yml
|
||||
|
68
.rubocop.yml
68
.rubocop.yml
@ -4,8 +4,8 @@ require:
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
Exclude:
|
||||
- "bin/*"
|
||||
- "node_modules/**/*"
|
||||
- bin/*
|
||||
- node_modules/**/*
|
||||
|
||||
Bundler/OrderedGems:
|
||||
Enabled: false
|
||||
@ -13,23 +13,30 @@ Bundler/OrderedGems:
|
||||
Layout/EmptyLineAfterGuardClause:
|
||||
Enabled: false
|
||||
|
||||
Layout/EmptyLineBetweenDefs:
|
||||
Enabled: false
|
||||
Layout/FirstArrayElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Layout/FirstHashElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Layout/LineLength:
|
||||
Enabled: false
|
||||
|
||||
Lint/InheritException:
|
||||
Enabled: false
|
||||
|
||||
Lint/RescueException:
|
||||
Enabled: false
|
||||
Lint/SymbolConversion:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Enabled: false
|
||||
AllowedMethods:
|
||||
- class_methods
|
||||
- concerning
|
||||
- context
|
||||
- create_table
|
||||
- should
|
||||
Exclude:
|
||||
- config/routes.rb
|
||||
|
||||
Metrics/ClassLength:
|
||||
Enabled: false
|
||||
@ -49,15 +56,28 @@ Metrics/PerceivedComplexity:
|
||||
Naming/PredicateName:
|
||||
Enabled: false
|
||||
|
||||
Rails/BulkChangeTable:
|
||||
Enabled: false
|
||||
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
Enabled: false
|
||||
|
||||
Rails/HttpStatus:
|
||||
EnforcedStyle: numeric
|
||||
|
||||
Rails/I18nLocaleTexts:
|
||||
Enabled: false
|
||||
|
||||
Rails/InverseOf:
|
||||
Enabled: false
|
||||
|
||||
Rails/Output:
|
||||
Exclude:
|
||||
- db/*.rb
|
||||
|
||||
Rails/ReversibleMigration:
|
||||
Enabled: false
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
Enabled: false
|
||||
|
||||
@ -85,14 +105,17 @@ Style/FloatDivision:
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
||||
Style/HashSyntax:
|
||||
EnforcedShorthandSyntax: never
|
||||
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
|
||||
Style/MutableConstant:
|
||||
Enabled: false
|
||||
|
||||
Style/NumericPredicate:
|
||||
Enabled: false
|
||||
EnforcedStyle: comparison
|
||||
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
@ -100,17 +123,14 @@ Style/PerlBackrefs:
|
||||
Style/QuotedSymbols:
|
||||
Enabled: false
|
||||
|
||||
Style/RescueStandardError:
|
||||
Enabled: false
|
||||
|
||||
Style/StringLiterals:
|
||||
Enabled: false
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
Style/StringLiteralsInInterpolation:
|
||||
Enabled: false
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/SymbolArray:
|
||||
Enabled: false
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
|
||||
Style/WordArray:
|
||||
Enabled: false
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
|
@ -1,31 +1,12 @@
|
||||
---
|
||||
include:
|
||||
- "**/*.rb"
|
||||
exclude:
|
||||
- spec/**/*
|
||||
- test/**/*
|
||||
- vendor/**/*
|
||||
- ".bundle/**/*"
|
||||
require:
|
||||
- actioncable
|
||||
- actionmailer
|
||||
- actionpack
|
||||
- actionview
|
||||
- activejob
|
||||
- activemodel
|
||||
- activerecord
|
||||
- activestorage
|
||||
- activesupport
|
||||
domains: []
|
||||
- actioncable
|
||||
- actionmailer
|
||||
- actionpack
|
||||
- actionview
|
||||
- activejob
|
||||
- activemodel
|
||||
- activerecord
|
||||
- activestorage
|
||||
- activesupport
|
||||
reporters:
|
||||
- rubocop
|
||||
- require_not_found
|
||||
formatter:
|
||||
rubocop:
|
||||
cops: safe
|
||||
except: []
|
||||
only: []
|
||||
extra_args: []
|
||||
require_paths: []
|
||||
plugins: []
|
||||
max_files: 5000
|
||||
- rubocop
|
||||
|
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"solargraph.checkGemVersion": false,
|
||||
"solargraph.diagnostics": true,
|
||||
"solargraph.externalServer": {
|
||||
"host": "localhost",
|
||||
"port": 7658
|
||||
},
|
||||
"solargraph.formatting": true,
|
||||
"solargraph.transport": "external",
|
||||
}
|
10
Dockerfile
10
Dockerfile
@ -26,5 +26,15 @@ RUN gem install bundler:2.3.12 && \
|
||||
RUN wget -O /usr/bin/shoreman https://github.com/chrismytton/shoreman/raw/master/shoreman.sh \
|
||||
&& chmod +x /usr/bin/shoreman
|
||||
|
||||
|
||||
# Only setup solargraph stuff when the profile is selected
|
||||
ARG COMPOSE_PROFILES
|
||||
RUN if [[ $COMPOSE_PROFILES == *"solargraph"* ]]; then \
|
||||
solargraph download-core && bundle exec yard gems && solargraph bundle; \
|
||||
fi
|
||||
|
||||
# Stop bin/rails console from offering autocomplete
|
||||
RUN echo "IRB.conf[:USE_AUTOCOMPLETE] = false" > ~/.irbrc
|
||||
|
||||
WORKDIR /app
|
||||
CMD [ "shoreman" ]
|
||||
|
6
Gemfile
6
Gemfile
@ -56,6 +56,12 @@ group :development, :test do
|
||||
gem 'puma'
|
||||
end
|
||||
|
||||
group :docker do
|
||||
gem "rubocop", require: false
|
||||
gem "rubocop-rails", require: false
|
||||
gem "solargraph", require: false
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem "shoulda-context"
|
||||
gem "shoulda-matchers"
|
||||
|
56
Gemfile.lock
56
Gemfile.lock
@ -79,7 +79,10 @@ GEM
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ast (2.4.2)
|
||||
backport (1.2.0)
|
||||
bcrypt (3.1.16)
|
||||
benchmark (0.2.0)
|
||||
bootsnap (1.9.3)
|
||||
msgpack (~> 1.0)
|
||||
brpoplpush-redis_script (0.1.2)
|
||||
@ -113,6 +116,7 @@ GEM
|
||||
activesupport (>= 5.0)
|
||||
request_store (>= 1.0)
|
||||
ruby2_keywords
|
||||
e2mmap (0.1.0)
|
||||
elasticsearch (7.16.1)
|
||||
elasticsearch-api (= 7.16.1)
|
||||
elasticsearch-transport (= 7.16.1)
|
||||
@ -165,9 +169,14 @@ GEM
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
json (2.6.1)
|
||||
jsonapi-renderer (0.2.2)
|
||||
kgio (2.11.4)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
listen (3.7.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
@ -214,6 +223,9 @@ GEM
|
||||
nokogiri (1.13.8)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.1)
|
||||
ast (~> 2.4.1)
|
||||
pg (1.2.3)
|
||||
pg (1.2.3-x64-mingw32)
|
||||
pry (0.13.1)
|
||||
@ -257,6 +269,7 @@ GEM
|
||||
method_source
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0)
|
||||
rainbow (3.1.1)
|
||||
raindrops (0.20.0)
|
||||
rake (13.0.6)
|
||||
rb-fsevent (0.11.0)
|
||||
@ -265,6 +278,7 @@ GEM
|
||||
recaptcha (5.8.1)
|
||||
json
|
||||
redis (4.6.0)
|
||||
regexp_parser (2.6.0)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
resolv (0.2.1)
|
||||
@ -283,7 +297,26 @@ GEM
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
retriable (3.1.2)
|
||||
reverse_markdown (2.1.1)
|
||||
nokogiri
|
||||
rexml (3.2.5)
|
||||
rubocop (1.36.0)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.22.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-rails (2.16.1)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby-vips (2.1.4)
|
||||
ffi (~> 1.12)
|
||||
ruby2_keywords (0.0.5)
|
||||
@ -306,6 +339,21 @@ GEM
|
||||
simple_form (5.1.0)
|
||||
actionpack (>= 5.2)
|
||||
activemodel (>= 5.2)
|
||||
solargraph (0.47.2)
|
||||
backport (~> 1.2)
|
||||
benchmark
|
||||
bundler (>= 1.17.2)
|
||||
diff-lcs (~> 1.4)
|
||||
e2mmap
|
||||
jaro_winkler (~> 1.5)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.1)
|
||||
parser (~> 3.0)
|
||||
reverse_markdown (>= 1.0.5, < 3)
|
||||
rubocop (>= 0.52)
|
||||
thor (~> 1.0)
|
||||
tilt (~> 2.0)
|
||||
yard (~> 0.9, >= 0.9.24)
|
||||
sprockets (4.1.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
@ -317,6 +365,7 @@ GEM
|
||||
multi_json (~> 1.8)
|
||||
strscan (3.0.3)
|
||||
thor (1.2.1)
|
||||
tilt (2.0.11)
|
||||
timecop (0.9.4)
|
||||
timeout (0.2.0)
|
||||
tzinfo (2.0.4)
|
||||
@ -325,6 +374,7 @@ GEM
|
||||
unf_ext
|
||||
unf_ext (0.0.8)
|
||||
unf_ext (0.0.8-x64-mingw32)
|
||||
unicode-display_width (2.3.0)
|
||||
unicorn (6.1.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
@ -340,11 +390,14 @@ GEM
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 5.2)
|
||||
semantic_range (>= 2.3.0)
|
||||
webrick (1.7.0)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
whenever (1.0.0)
|
||||
chronic (>= 0.6.3)
|
||||
yard (0.9.28)
|
||||
webrick (~> 1.7.0)
|
||||
zeitwerk (2.6.0)
|
||||
|
||||
PLATFORMS
|
||||
@ -387,6 +440,8 @@ DEPENDENCIES
|
||||
resolv
|
||||
responders
|
||||
retriable
|
||||
rubocop
|
||||
rubocop-rails
|
||||
ruby-vips
|
||||
sanitize
|
||||
shoulda-context
|
||||
@ -394,6 +449,7 @@ DEPENDENCIES
|
||||
sidekiq
|
||||
sidekiq-unique-jobs
|
||||
simple_form
|
||||
solargraph
|
||||
streamio-ffmpeg
|
||||
timecop
|
||||
unicorn
|
||||
|
24
README.md
24
README.md
@ -15,22 +15,30 @@ To mitigate this you can install a WSL distribution and clone the project inside
|
||||
|
||||
#### Installation
|
||||
1. Download and install the prerequisites.
|
||||
2. Clone the repo with `git clone https://github.com/zwagoth/e621ng.git`.
|
||||
3. `cd` into the repo.
|
||||
4. Run the following commands:
|
||||
1. Clone the repo with `git clone https://github.com/zwagoth/e621ng.git`.
|
||||
1. `cd` into the repo.
|
||||
1. Copy the sample environment file with `cp .env.sample .env`.
|
||||
1. Uncomment the `COMPOSE_PROFILES` variable if you wish to use solargraph. Doesn't work on Windows without WSL.
|
||||
1. Run the following commands:
|
||||
```
|
||||
docker-compose run -e DANBOORU_DISABLE_THROTTLES=true -e SEED_POST_COUNT=100 e621 /app/bin/setup
|
||||
docker-compose up
|
||||
```
|
||||
After running the commands once only `docker-compose up` is needed to bring up the containers.
|
||||
5. This would be a good time to rewatch your favorite TV series installment, cook & have breakfast/lunch/dinner, walk the dog, clean your room, etc.<br>
|
||||
1. This would be a good time to rewatch your favorite TV series installment, cook & have breakfast/lunch/dinner, walk the dog, clean your room, etc.<br>
|
||||
By the time you get back the install will surely have completed.<sup>1</sup>
|
||||
6. To confirm the installation worked, open the web browser of your choice and enter `http://localhost:3000` into the address bar and see if the website loads correctly. An admin account has been created automatically, the username and password are `admin` and `e621test` respectively.
|
||||
1. To confirm the installation worked, open the web browser of your choice and enter `http://localhost:3000` into the address bar and see if the website loads correctly. An admin account has been created automatically, the username and password are `admin` and `e621test` respectively.
|
||||
|
||||
Note: When gems or js packages were updated you need to execute `docker-compose build` to reflect them in the container.
|
||||
|
||||
<sub><sup>1</sup> If the install did not finish by the time an activity is complete please select another activity to avoid crippling boredom.</sub>
|
||||
|
||||
#### Useful docker services
|
||||
|
||||
`docker-compose run --rm tests` to execute the test suite.
|
||||
|
||||
`docker-compose run --rm rubocop` to run the linter. Run it against changed files only, there are too many existing violations at the moment.
|
||||
|
||||
#### Development Database
|
||||
|
||||
The postgres server accepts outside connections which you can use to connect with a local client. Use `localhost:34517` to connect to a database named `danbooru2` with the user `danbooru`. Leave the password blank, anything will work.
|
||||
@ -66,9 +74,3 @@ debug your Nginx configuration file.
|
||||
### IQDB Service
|
||||
|
||||
IQDB integration is delegated to the [IQDBS service](https://github.com/zwagoth/iqdbs).
|
||||
|
||||
### Cropped Thumbnails
|
||||
|
||||
There's optional support for cropped thumbnails. This relies on installing
|
||||
`libvips-8.6` or higher and setting `Danbooru.config.enable_image_cropping?`
|
||||
to true.
|
||||
|
@ -13,7 +13,10 @@ x-environment: &common-env
|
||||
|
||||
services:
|
||||
e621:
|
||||
build: ./
|
||||
build:
|
||||
context: ./
|
||||
args:
|
||||
COMPOSE_PROFILES: ${COMPOSE_PROFILES-}
|
||||
image: e621
|
||||
volumes:
|
||||
- .:/app
|
||||
@ -31,24 +34,6 @@ services:
|
||||
- iqdb
|
||||
tty: true
|
||||
|
||||
tests:
|
||||
image: e621
|
||||
environment:
|
||||
<<: *common-env
|
||||
# Hide annoying output from libvips on corrupt files
|
||||
VIPS_WARNING: "0"
|
||||
volumes:
|
||||
- .:/app
|
||||
- node_modules:/app/node_modules
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
- memcached
|
||||
- elastic
|
||||
entrypoint: ["docker/test_runner.sh"]
|
||||
profiles:
|
||||
- test
|
||||
|
||||
nginx:
|
||||
image: nginx:stable-alpine
|
||||
volumes:
|
||||
@ -111,6 +96,45 @@ services:
|
||||
- post_data:/data
|
||||
- iqdb_data:/home/vagrant/iqdbs
|
||||
|
||||
# Useful for development
|
||||
|
||||
tests:
|
||||
image: e621
|
||||
environment:
|
||||
<<: *common-env
|
||||
# Hide annoying output from libvips on corrupt files
|
||||
VIPS_WARNING: "0"
|
||||
volumes:
|
||||
- .:/app
|
||||
- node_modules:/app/node_modules
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
- memcached
|
||||
- elastic
|
||||
entrypoint: ["docker/test_runner.sh"]
|
||||
profiles:
|
||||
- tests
|
||||
|
||||
rubocop:
|
||||
image: e621
|
||||
volumes:
|
||||
- .:/app
|
||||
entrypoint: bundle exec rubocop
|
||||
profiles:
|
||||
- rubocop
|
||||
|
||||
solargraph:
|
||||
image: e621
|
||||
entrypoint: solargraph socket -h 0.0.0.0
|
||||
working_dir: $PWD
|
||||
volumes:
|
||||
- .:$PWD
|
||||
ports:
|
||||
- 7658:7658
|
||||
profiles:
|
||||
- solargraph
|
||||
|
||||
volumes:
|
||||
post_data:
|
||||
iqdb_data:
|
||||
|
Loading…
Reference in New Issue
Block a user