docbrown/config/initializers
Joe Doss aa49cb1cfe
Bugfix for #7663 and refactor of container setup (#7747)
* Move from Alpine Linux to Fedora Linux.

This changes the base container image away from Alpine Linux to
Fedora Linux to address some musl libc issues with some of our gems.

It also moved the main file to a Containerfile and symlinks the Dockerfile
to it. This makes our container setup less Docker-centric as Linux users
most likely will be using Podman as their container runtime.

Lastly, it moves the WORKDIR from /usr/src/app to /opt/apps/devto.
The Linux FHS states that /opt is the spot for Optional application
software packages and /usr/src is for kernel source code.

https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

/opt Optional application software packages
/usr/src Source code, e.g., the kernel source code with its header files.

Also, if SELinux becomes a thing in our future, moving this makes it
easier to manage contexts out of /opt rather than /usr/src.

* Adjust the Containerfile a bit to add some missing packages, make it
more generic and move env vars to the docker-compose.

* Move the Dockerfile to a symlink to the Containerfile.

We need to be able to support more than just Docker for a container
runtime. Moving everything to a Containerfile and symlinking the
Dockerfile helps users run runtimes such as Podman.

* Add in new entrypoint files and fix the app path in docker-entrypoint.sh

* Refactor the docker-compose.yml file so it doesn't build the main
application container three times in a row. We can use the same
container for web, webpacker, and sidekiq.

Also make the volume names very explicit on what their contents and add
in SELinux context support with :Z

* Fix ELASTICSEARCH_URL.

* Remove the absolute path on ip binary and add in iproute to Containerfile.

* Symlink the Dockerfile to Containerfile and add in a container-compose.yml file
for usage with podman-compose. We are waiting for this issue to get resolved

https://github.com/containers/libpod/issues/6153

and for podman-compose to mature a bit more. A user using podman-compose can use

podman-compose -f container-compose.yml

to launch the DEV container stack with Podman.

* Update the .gitignore file to reflect the new container volumes.

* Fix the entrypoint script on the Containerfile and clean up a bunch of things.

* Rework the Containerfile to prep it to run as a non-root user. We have to wait
for this issue to get fixed:

https://github.com/containers/libpod/issues/6153

for Linux users and then we can uncomment the USER line so we are running Rails
as a non-root user. :toot:

* This reworks the compose files so each task that is needed to start the app has
a correct wait command with dockerize. It also adds in containers for doing
yarn and bundle things for development. Since we mount the code directory inside
the container we lose our pre-containerized gems and node_modules.

This means users can run:

Linux
podman-compose -f container-compose.yml up

Mac
docker-compose up

and it should correctly build the app stack with containers!

* Clean up old container related things.

* Add in some container pre-reqs and my name to the "Core team" section! :toot:

* Adjust the seed and sidekiq compose entries so they do not use the web entrypoint
and set the REDIS_URL and REDIS_SESSIONS_URL env vars for seed.

Add in some echos to the entrypoint.sh.

Also set docker-compose to use :delegated on mount points to speed things up.

https://docs.docker.com/storage/bind-mounts/#configure-mount-consistency-for-macos

* Just call yarn install --dev on the yarn container.

* Update documentation to support Docker and Podman as Container Engines and
move the page from docker to containers to reflect the fact not all users run
their containers via Docker.

There are dozens of us... DOZENS!

* Set --local on bundle config so it just impacts this Ruby app.

* Renamed bin/docker-setup to bin/container-setup to reflect the fact that that
we can use Podman as a container engine. I also refactored it so it does some
basic pre-flight checks for docker and docker-compose or podman and
podman-compose to make sure users have a container engine installed.

* Set cache_all_platforms true for bundler.

* Bump docker-compose dockerize -timeout to 45min for slower macOS hardware.

* Move to the consolidated app_initializer:setup rake task for bootstrapping the
app.

* Update docs/installation/readme.md
2020-05-28 12:11:51 -05:00
..
active_support/cache Add expires_in option for ActiveSupport::Cache::RedisStore#increment method (#7515) 2020-04-27 16:40:49 +02:00
rack [deploy] Add API Key to API Write Throttle (#8110) 2020-05-28 09:45:01 -05:00
0_application_config.rb Code cleanups (#659) 2018-08-07 11:00:13 -04:00
ahoy_email.rb Upgrade ahoy_email to 1.0.3 (#2534) 2019-04-23 16:32:14 -04:00
application_controller_renderer.rb Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
assets.rb Run rails app:update for 5.2.4.2 (#6743) [deploy] 2020-03-23 10:38:20 -04:00
audit_events.rb Implement Moderators audit logs (#3449) 2019-10-23 10:30:45 -04:00
aws_sdk.rb Fix double AWS_LAMBDA initialization (#2570) 2019-04-26 11:15:18 -04:00
backtrace_silencers.rb Run rails app:update for 5.2.4.2 (#6743) [deploy] 2020-03-23 10:38:20 -04:00
cache_logger.rb Enable cache logging in development if requested (#5330) 2020-01-02 08:11:58 -05:00
carrierwave.rb Remove ENV["USE_NEW_AWS"] and use Orig ENV variables for New Creds (#5771) [deploy] 2020-01-27 15:46:57 -05:00
cloudinary.rb Create DelayedJob config and misc DX changes (#979) 2018-10-26 13:15:14 -04:00
content_security_policy.rb [deploy] Update webpacker configuration (#8004) 2020-05-25 12:03:18 -04:00
cookies_serializer.rb Initial commit 2018-02-28 16:11:08 -05:00
datadog_apm.rb Rename DataDog to Datadog (#6226) 2020-02-21 12:00:30 -05:00
devise.rb [deploy] Authentication refactoring: cleanups (#7576) 2020-04-29 10:33:30 -04:00
docker.rb Bugfix for #7663 and refactor of container setup (#7747) 2020-05-28 12:11:51 -05:00
doorkeeper.rb [deploy] Create write_articles oauth scope (#7834) 2020-05-14 09:55:53 -04:00
filter_parameter_logging.rb Initial commit 2018-02-28 16:11:08 -05:00
flipper.rb Add Feature Flags support to DEV (#7996) 2020-05-26 15:26:33 -05:00
gibbon.rb Migrate to Travis CI (part 2) (#591) 2018-07-20 20:17:18 -04:00
honeybadger.rb [deploy] handle rate limit errors gracefully (#7422) 2020-04-22 08:55:26 -05:00
honeycomb.rb [deploy] Track Deploys In Honeycomb (#7935) 2020-05-19 09:10:41 -05:00
hypershield.rb Only Enable Hypershield if ENV variable is present (#6666) [deploy] 2020-03-16 15:28:46 -04:00
inflections.rb Initial commit 2018-02-28 16:11:08 -05:00
initialization_cachebust.rb Cache onboarding at edge (#6966) 2020-03-31 16:12:14 +02:00
liquid.rb Fix rubocop Rails.root.path complaints (#5114) 2019-12-16 12:13:15 -05:00
mime_types.rb Initial commit 2018-02-28 16:11:08 -05:00
new_framework_defaults_5_2.rb Rails 5.2 features: enable cache versioning (recyclable keys) (#5329) [deploy] 2020-01-02 08:40:03 -05:00
octokit.rb Code cleanups (#659) 2018-08-07 11:00:13 -04:00
omniauth.rb Fix Datadog auth failure payload and add tests (#7150) 2020-04-09 09:54:51 +07:00
persistent_csrf_token_cookie.rb [deploy] Authentication refactoring: cleanups (#7576) 2020-04-29 10:33:30 -04:00
pusher.rb Bump pusher-push-notifications from 1.0.0 to 1.1.0 (#1880) [ci skip] 2019-05-01 17:22:19 -04:00
redcarpet.rb Implement KatexTag (#6237) [deploy] 2020-03-09 17:58:54 -04:00
reserved_words.rb [deploy] Add async_info to ReservedWords (#8022) 2020-05-21 17:02:26 -04:00
reverse_markdown.rb Fix rubocop Rails.root.path complaints (#5114) 2019-12-16 12:13:15 -05:00
rolify.rb #260 increase mentee-mentor description length (#405) 2018-08-20 10:20:23 -04:00
s3_direct_upload.rb Code cleanups (#659) 2018-08-07 11:00:13 -04:00
session_store.rb [deploy] Make force_ssl an environment variable to make sure new communities can get proper ssl config. (#7090) 2020-04-08 14:23:50 -04:00
sidekiq.rb require worker_retries_exhausted_reporter in Sidekiq initializer (#6131) [deploy] 2020-02-18 07:56:11 -05:00
sidekiq_unique_jobs.rb [deploy] ensure that often run sidekiq jobs are unique until they execute (#7168) 2020-04-08 19:19:30 -04:00
slack_notifier.rb Finalize Slack messengers refactoring (#7484) 2020-04-24 21:15:10 +02:00
stripe.rb Remove leftover Stripe subscriptions code (#6243) 2020-02-24 08:33:36 -05:00
strong_migrations.rb Use builtin Rails index_exists? for indices (#6293) 2020-02-26 11:05:23 -05:00
timber.rb Customize UserContext in Timber logs (#4972) [deploy] 2019-12-02 13:21:52 -05:00
timeout.rb Adds optional support for Docker/Compose (#296) 2018-10-12 11:48:53 -04:00
wrap_parameters.rb Initial commit 2018-02-28 16:11:08 -05:00