docbrown/README.md
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

177 lines
7.3 KiB
Markdown

<div align="center">
<br>
<img alt="DEV" src="https://thepracticaldev.s3.amazonaws.com/i/ro3538by3b2fupbs63sr.png" width="500px">
<h1>DEV Community 👩‍💻👨‍💻</h1>
<strong>The Human Layer of the Stack</strong>
</div>
<br>
<p align="center">
<a href="https://www.ruby-lang.org/en/">
<img src="https://img.shields.io/badge/Ruby-v2.7.1-green.svg" alt="ruby version">
</a>
<a href="http://rubyonrails.org/">
<img src="https://img.shields.io/badge/Rails-v5.2.3-brightgreen.svg" alt="rails version">
</a>
<a href="https://travis-ci.com/thepracticaldev/dev.to">
<img src="https://travis-ci.com/thepracticaldev/dev.to.svg?branch=master" alt="Travis Status for thepracticaldev/dev.to">
</a>
<a href="https://codeclimate.com/github/thepracticaldev/dev.to/maintainability">
<img src="https://api.codeclimate.com/v1/badges/ce45bf63293073364bcb/maintainability" alt="Code Climate maintainability">
</a>
<a href="https://codeclimate.com/github/thepracticaldev/dev.to/test_coverage">
<img src="https://api.codeclimate.com/v1/badges/ce45bf63293073364bcb/test_coverage" alt="Code Climate test coverage">
</a>
<a href="https://codeclimate.com/github/thepracticaldev/dev.to/trends/technical_debt">
<img src="https://img.shields.io/codeclimate/tech-debt/thepracticaldev/dev.to" alt="Code Climate technical debt">
</a>
<a href="https://www.codetriage.com/thepracticaldev/dev.to">
<img src="https://www.codetriage.com/thepracticaldev/dev.to/badges/users.svg" alt="CodeTriage badge">
</a>
<img src="https://badgen.net/dependabot/thepracticaldev/dev.to?icon=dependabot" alt="Dependabot Badge">
<a href="https://gitpod.io/from-referrer/">
<img src="https://img.shields.io/badge/setup-automated-blue?logo=gitpod" alt="GitPod badge">
</a>
<a href="https://app.netlify.com/sites/devto/deploys">
<img src="https://api.netlify.com/api/v1/badges/e5dbe779-7bca-4390-80b9-6e678b4806a3/deploy-status" alt="Netlify badge">
</a>
<img src="https://img.shields.io/github/languages/code-size/thepracticaldev/dev.to" alt="GitHub code size in bytes">
<img src="https://img.shields.io/github/commit-activity/w/thepracticaldev/dev.to" alt="GitHub commit activity">
<a href="https://github.com/thepracticaldev/dev.to/issues?q=is%3Aissue+is%3Aopen+label%3A%22ready+for+dev%22">
<img src="https://img.shields.io/github/issues/thepracticaldev/dev.to/ready for dev" alt="GitHub issues ready for dev">
</a>
<a href="https://app.honeybadger.io/project/Pl5JzZB5ax">
<img src="https://img.shields.io/badge/honeybadger-active-informational" alt="Honeybadger badge">
</a>
</p>
Welcome to the [dev.to](https://dev.to) codebase. We are so excited to have you.
With your help, we can build out DEV to be more stable and better serve our
community.
## What is dev.to?
[dev.to](https://dev.to) (or just DEV) is a platform where software developers
write articles, take part in discussions, and build their professional profiles.
We value supportive and constructive dialogue in the pursuit of great code and
career growth for all members. The ecosystem spans from beginner to advanced
developers, and all are welcome to find their place within our community. ❤️
## Table of Contents
- [What is dev.to?](#what-is-devto)
- [Table of Contents](#table-of-contents)
- [Contributing](#contributing)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation Documentation](#installation-documentation)
- [Developer Documentation](#developer-documentation)
- [Core team](#core-team)
- [Vulnerability disclosure](#vulnerability-disclosure)
- [License](#license)
## Contributing
We encourage you to contribute to dev.to! Please check out the
[Contributing to dev.to guide](CONTRIBUTING.md) for guidelines about how to
proceed.
## Getting Started
This section provides a high-level quick start guide. If you're looking for the
[installation guide](https://docs.dev.to/installation/), you'll want to refer to
our complete [Developer Documentation](https://docs.dev.to).
We run on a [Rails](https://rubyonrails.org/) backend, and we are currently
transitioning to a [Preact](https://preactjs.com/)-first frontend.
A more complete overview of our stack is available in
[our docs](https://docs.dev.to/technical-overview/).
### Prerequisites
#### Local
- [Ruby](https://www.ruby-lang.org/en/): we recommend using
[rbenv](https://github.com/rbenv/rbenv) to install the Ruby version listed on
the badge.
- [Yarn](https://yarnpkg.com/) 1.x: please refer to their
[installation guide](https://classic.yarnpkg.com/en/docs/install).
- [PostgreSQL](https://www.postgresql.org/) 9.5 or higher.
- [ImageMagick](https://imagemagick.org/): please refer to ImageMagick's
[installation instructions](https://imagemagick.org/script/download.php).
- [Redis](https://redis.io/) 4 or higher.
- [Elasticsearch](https://www.elastic.co) 7 or higher.
#### Containers
**Linux**
- [Podman](https://github.com/containers/libpod) 1.9.2 or higher
- [Podman Compose](https://github.com/containers/podman-compose) 0.1.5 or higher
**OS X**
- [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/)
### Installation Documentation
[View Full Installation Documentation](https://docs.dev.to/installation/).
## Developer Documentation
[Check out our dedicated docs page for more technical documentation](https://docs.dev.to).
## Core team
- [@benhalpern](https://dev.to/ben)
- [@jessleenyc](https://dev.to/jess)
- [@peterkimfrank](https://dev.to/peter)
- [@maestromac](https://dev.to/maestromac)
- [@zhao-andy](https://dev.to/andy)
- [@lightalloy](https://dev.to/lightalloy)
- [@rhymes](https://dev.to/rhymes)
- [@jacobherrington](https://dev.to/jacobherrington)
- [@mstruve](https://dev.to/molly_struve)
- [@atsmith813](https://dev.to/atsmith813)
- [@citizen428](https://dev.to/citizen428)
- [@nickytonline](https://dev.to/nickytonline)
- [@joshpuetz](http://dev.to/joshpuetz)
- [@vaidehijoshi](https://dev.to/vaidehijoshi)
- [@juliannatetreault](https://dev.to/juliannatetreault)
- [@ridhwana](https://dev.to/ridhwana)
- [@fdoxyz](https://dev.to/fdoxyz)
- [@msarit](https://dev.to/msarit)
- [@jdoss](https://dev.to/jdoss)
## Vulnerability disclosure
We welcome security research on DEV under the terms of our
[vulnerability disclosure policy](https://dev.to/security).
## License
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version. Please see the [LICENSE](./LICENSE.md) file in our repository for
the full text.
Like many open source projects, we require that contributors provide us with a
Contributor License Agreement (CLA). By submitting code to the DEV project, you
are granting us a right to use that code under the terms of the CLA.
Our version of the CLA was adapted from the Microsoft Contributor License
Agreement, which they generously made available to the public domain under
Creative Commons CC0 1.0 Universal.
Any questions, please refer to our [license FAQ](https://docs.dev.to/licensing/)
doc or email yo@dev.to.
<br>
<p align="center">
<img alt="Sloan, the sloth mascot" width="250px" src="https://thepracticaldev.s3.amazonaws.com/uploads/user/profile_image/31047/af153cd6-9994-4a68-83f4-8ddf3e13f0bf.jpg">
<br>
<strong>Happy Coding</strong> ❤️
</p>