Skip to content

Commit

Permalink
Fixing lints (BretFisher#96)
Browse files Browse the repository at this point in the history
* fixing lints

* trying input

* removing outdated changelogs. Using GH Projects

* fixing lints
  • Loading branch information
BretFisher authored and Safiquddin committed Sep 12, 2023
1 parent 21518c9 commit 5c9ce12
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 98 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ignored:
- DL3003 #ignore that we use cd sometimes
- DL3006 #image pin versions
- DL3007 #for learning, latest is ok, sometimes
- DL3008 #apt pin versions
- DL3018 #apk add pin versions
- DL3022 #bad rule for COPY --from
- DL3025 #for learning, we sometimes use shell notation
- DL3028 #gem install pin versions
- DL3059 #multiple consecutive runs
- DL4006 #we don't need pipefail in this
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
uses: bretfisher/super-linter-workflow/.github/workflows/super-linter.yaml@main
with:
devops-only: true
filter-regex-exclude: .*compose-sample-3/html/.*
16 changes: 0 additions & 16 deletions CHANGELOG-Docker-Mastery.md

This file was deleted.

8 changes: 0 additions & 8 deletions CHANGELOG-Swarm-Mastery.md

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ This repo is for use in my Udemy Courses "Docker Mastery" and "Swarm Mastery"

NOTE: As of July 2020 the new default branch is `main`, so please update your clone if you're still on `master` branch.

Get these courses for with my "cheapest on the Internet" coupon links:
Get these courses for with my "cheapest on the internet" coupon links:

https://www.bretfisher.com/courses
[bretfisher.com/courses](https://www.bretfisher.com/courses)

My other DevOps and Docker resources are at https://www.bretfisher.com/docker
My other DevOps and Docker resources are at [bretfisher.com/docker](https://www.bretfisher.com/docker)

Feel free to create issues or PRs if you find a problem with examples in this repo!
Feel free to create issues or PRs if you find a problem with examples in this repository!
4 changes: 2 additions & 2 deletions compose-assignment-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

> Goal: Create a compose config for a local Drupal CMS website
- This empty directory is where you should create a docker-compose.yml
- This empty directory is where you should create a docker-compose.yml
- Use the `drupal:8.8.2` image along with the `postgres:12.1` image
- Set the version to 2
- Use `ports` to expose Drupal on 8080
- Be sure to setup POSTGRES_PASSWORD on postgres image
- Walk through Drupal config in browser at http://localhost:8080
- Walkthrough Drupal config in browser at `http://localhost:8080`
- Tip: Drupal assumes DB is localhost, but it will actually be on the compose service name you give it
- Use Docker Hub documentation to figure out the right environment and volume settings
- Extra Credit: Use volumes to store Drupal unique data
51 changes: 39 additions & 12 deletions compose-assignment-2/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@
# Assignment: Compose For On-The-Fly Image Building and Multi-Container Testing

Goal: This time imagine you're just wanting to learn Drupal's admin and GUI, or maybe you're a software tester and you need to test a new theme for Drupal. When configured properly, this will let you build a custom image and start everything with `docker-compose up` including storing important db and config data in volumes so the site will remember your changes across Compose restarts.
Goal: This time imagine you're just wanting to learn Drupal's admin and GUI, or maybe you're
a software tester and you need to test a new theme for Drupal. When configured properly,
this will let you build a custom image and start everything with `docker-compose up`
including storing important db and config data in volumes so the site will remember your
changes across Compose restarts.

- Use the compose file you created in the last assignment (drupal and postgres) as a starting point.
- Let's pin image version from Docker Hub this time. It's always a good idea to do that so a new major version doesn't surprise you.
- Let's pin image version from Docker Hub this time.
It's always a good idea to do that so a new major version doesn't surprise you.

## Dockerfile
- First you need to build a custom Dockerfile in this directory, `FROM drupal:8.8.2` NOTE: if it fails to build, try the latest 8 branch version with `FROM drupal:8`

- First you need to build a custom Dockerfile in this directory,
`FROM drupal:8.8.2` NOTE: if it fails to build, try the latest 8 branch version with `FROM drupal:8`
- Then RUN apt package manager command to install git: `apt-get update && apt-get install -y git`
- Remember to cleanup after your apt install with `rm -rf /var/lib/apt/lists/*` and use `\` and `&&` properly. You can find examples of them in drupal official image. More on this below under Compose file.
- Remember to cleanup after your apt install with `rm -rf /var/lib/apt/lists/*` and use `\` and `&&` properly.
You can find examples of them in drupal official image. More on this below under Compose file.
- Then change `WORKDIR /var/www/html/themes`
- Then use git to clone the theme with: `RUN git clone --branch 8.x-3.x --single-branch --depth 1 https://git.drupalcode.org/project/bootstrap.git`
- Combine that line with this line, as we need to change permissions on files and don't want to use another image layer to do that (it creates size bloat). This drupal container runs as www-data user but the build actually runs as root, so often we have to do things like `chown` to change file owners to the proper user: `chown -R www-data:www-data bootstrap`. Remember the first line needs a `\` at end to signify the next line is included in the command, and at start of next line you should have `&&` to signify "if first command succeeds then also run this command"
- Then use git to clone the theme with:
`RUN git clone --branch 8.x-3.x --single-branch --depth 1 https://git.drupalcode.org/project/bootstrap.git`
- Combine that line with this line, as we need to change permissions on files and don't want to
use another image layer to do that (it creates size bloat).
This drupal container runs as www-data user but the build actually runs as root,
so often we have to do things like `chown` to change file owners to the proper user:
`chown -R www-data:www-data bootstrap`. Remember the first line needs a `\` at end
to signify the next line is included in the command, and at start of next line you should have
`&&` to signify "if first command succeeds then also run this command"
- Then, just to be safe, change the working directory back to its default (from drupal image) at `/var/www/html`

## Compose File
- We're going to build a custom image in this compose file for drupal service. Use Compose file from previous assignment for Drupal to start with, and we'll add to it, as well as change image name.

- We're going to build a custom image in this compose file for drupal service.
Use Compose file from previous assignment for Drupal to start with, and we'll add to it, as well as change image name.
- Rename image to `custom-drupal` as we want to make a new image based on the official `drupal:8.8.2`.
- We want to build the default Dockerfile in this directory by adding `build: .` to the `drupal` service. When we add a build + image value to a compose service, it knows to use the image name to write to in our image cache, rather then pull from Docker Hub.
- For the `postgres:12.1` service, you need the same password as in previous assignment, but also add a volume for `drupal-data:/var/lib/postgresql/data` so the database will persist across Compose restarts.
- We want to build the default Dockerfile in this directory by adding `build: .` to the `drupal` service.
When we add a build + image value to a compose service,
it knows to use the image name to write to in our image cache, rather then pull from Docker Hub.
- For the `postgres:12.1` service, you need the same password as in previous assignment,
but also add a volume for `drupal-data:/var/lib/postgresql/data` so the database will
persist across Compose restarts.

## Start Containers, Configure Drupal

- Start containers like before, configure Drupal web install like before.
- After website comes up, click on `Appearance` in top bar, and notice a new theme called `Bootstrap` is there. That's the one we added with our custom Dockerfile.
- Click `Install and set as default`. Then click `Back to site` (in top left) and the website interface should look different. You've successfully installed and activated a new theme in your own custom image without installing anything on your host other than Docker!
- If you exit (ctrl-c) and then `docker-compose down` it will delete containers, but not the volumes, so on next `docker-compose up` everything will be as it was.
- After site comes up, click on `Appearance` in top bar, and notice a new theme called`Bootstrap` is there.
That's the one we added with our custom Dockerfile.
- Click `Install and set as default`.
Then click `Back to site` (in top left) and the site interface should look different.
You've successfully installed and activated a new theme in your own custom image without
installing anything on your host other than Docker!
- If you exit (ctrl-c) and then `docker-compose down` it will delete containers,
but not the volumes, so on next `docker-compose up` everything will be as it was.
- To totally clean up volumes, add `-v` to `down` command.
5 changes: 3 additions & 2 deletions compose-assignment-2/answer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM drupal:8.8.2


RUN apt-get update && apt-get install -y git \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /var/www/html/themes
Expand Down
2 changes: 1 addition & 1 deletion dockerfile-assignment-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# It is common to still need to deploy old app versions, even years later.
# - this app listens on port 3000, but the container should launch on port 80
# so it will respond to http://localhost:80 on your computer
# - then it should use alpine package manager to install tini: 'apk add --update tini'
# - then it should use alpine package manager to install tini: 'apk add --no-cache tini'
# - then it should create directory /usr/src/app for app files with 'mkdir -p /usr/src/app'
# - Node uses a "package manager", so it needs to copy in package.json file
# - then it needs to run 'npm install' to install dependencies from that file
Expand Down
2 changes: 1 addition & 1 deletion dockerfile-assignment-1/answer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:6-alpine

EXPOSE 3000

RUN apk add --update tini
RUN apk add --no-cache tini

WORKDIR /usr/src/app

Expand Down
9 changes: 4 additions & 5 deletions registry-sample-1/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Commands for setting up a local registry


- enable insecure registries in Daemon




- Enable SSL

```shell
mkdir -p certs
openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt
```

docker run --rm -e COMMON_NAME=127.0.0.1 -e KEY_NAME=registry -v $(pwd)/certs:/certs centurylink/openssl
`docker run --rm -e COMMON_NAME=127.0.0.1 -e KEY_NAME=registry -v $(pwd)/certs:/certs centurylink/openssl`
50 changes: 38 additions & 12 deletions slack-chat/coc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Vital DevOps (aka Docker Mastery) community Code of Conduct

All members of our chat communities are required to agree with the following code of conduct. Organizers will enforce this code throughout all channels. We are expecting cooperation from all participants to help ensuring a safe environment for everybody.
All members of our chat communities are required to agree with the following code of conduct.
Organizers will enforce this code throughout all channels.
We are expecting cooperation from all participants to help ensuring a safe environment for everybody.

## tl;dr

Expand All @@ -11,30 +13,54 @@ All members of our chat communities are required to agree with the following cod

## The Quick Version

Our community, including Discord, Slack, and Udemy is dedicated to providing a harassment-free communication experience for everyone, regardless of gender, gender identity and expression, age, sexual orientation, disability, physical appearance, body size, race, or religion (or lack thereof). We do not tolerate harassment of participants in any form. Sexual language and imagery is not appropriate in any channels.
Our community, including Discord, Slack, and Udemy is dedicated to providing a harassment-free
communication experience for everyone.
We do not tolerate harassment of participants in any form.
Sexual language and imagery is not appropriate in any channels.

This code of conduct applies to all Vital DevOps and Docker/Kubernetes Mastery spaces, including public channels, private channels and direct messages, both online and off. Anyone who violates this code of conduct may be sanctioned or expelled from these spaces at the discretion of the Slack group organizers. This is a safe space, lets keep it that way.
This code of conduct applies to all Bret Fisher, Vital DevOps, and Docker/Kubernetes Mastery spaces,
including public channels, private channels and direct messages, both online and off.
Anyone who violates this code of conduct may be sanctioned or expelled from these spaces at the
discretion of the Slack group organizers. This is a safe space, lets keep it that way.

## The Less Quick Version

Harassment includes offensive comments related to gender, gender identity and expression, age, sexual orientation, disability, physical appearance, body size, race, religion, sexual images, deliberate intimidation, stalking, sustained disruption of channels or other mediums, and unwelcome sexual attention.
Harassment includes offensive comments related to gender, gender identity and expression, age,
sexual orientation, disability, physical appearance, body size, race, religion, sexual images,
deliberate intimidation, stalking, sustained disruption of channels or other mediums,
and unwelcome sexual attention.

Organizers are also subject to the anti-harassment policy. Organizers should not use sexualized content or otherwise create a sexualized environment.
Organizers are also subject to the anti-harassment policy.
Organizers should not use sexualized content or otherwise create a sexualized environment.

Participants asked to stop any harassing behavior are expected to comply immediately. If a participant engages in harassing behavior, the Slack group organizers may take any action they deem appropriate, including warning the offender or expulsion from the Slack group.
Participants asked to stop any harassing behavior are expected to comply immediately.
If a participant engages in harassing behavior, the Slack group organizers may take any action
they deem appropriate, including warning the offender or expulsion from the Slack group.

If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact [Bret]([email protected]) or a member of the group organizers and moderators immediately.
If you are being harassed, notice that someone else is being harassed, or have any other concerns,
please contact [Bret]([email protected]) or a member of the group organizers and moderators immediately.

Organizers will be happy to help participants experiencing harassment to feel safe for the duration of their time in our community. We value your contribution to the community.
Organizers will be happy to help participants experiencing harassment to feel safe for the
duration of their time in our community. We value your contribution to the community.

## Reporting

If you are being harassed by a member of the Docker Mastery Slack group, notice that someone else is being harassed, or have any other concerns, please [contact a group organizer](https://dockermastery.slack.com/team). Organizers will respond as soon as they are able. If the person who is harassing you is on the admin team, they will recuse themselves from handling your incident.
If you are being harassed by a member of the Docker Mastery Slack group,
notice that someone else is being harassed, or have any other concerns,
please contact [@BretFisher](https://twitter.com/bretfisher) (DM's are open) or
[email protected], or a moderator or TA. Organizers will respond as soon as they are able.
If the person who is harassing you is on the admin team, they will recuse themselves from handling your incident.

In order to protect volunteers from abuse and burnout, we reserve the right to reject any report we believe to have been made in bad faith. Reports intended to silence legitimate criticism may be deleted without response.
In order to protect volunteers from abuse and burnout,
we reserve the right to reject any report we believe to have been made in bad faith.
Reports intended to silence legitimate criticism may be deleted without response.

We will respect confidentiality requests for the purpose of protecting victims of abuse. At our discretion, we may publicly name a person about whom we’ve received harassment complaints, or privately warn third parties about them, if we believe that doing so will increase the safety of 757Dev members or the general public. We will not name harassment victims without their affirmative consent.
We will respect confidentiality requests for the purpose of protecting victims of abuse.
At our discretion, we may publicly name a person about whom we’ve received harassment complaints,
or privately warn third parties about them, if we believe that doing so will increase the
safety of members or the general public. We will not name harassment victims without their affirmative consent.

## Credits

This Code of Conduct is heavily based on the [Conference Code of Conduct](http://confcodeofconduct.com) and the [ZA Developers Code of Conduct for Slack](https://github.com/zadev/code-of-conduct/blob/master/README.md).
This Code of Conduct is heavily based on the [Conference Code of Conduct](http://confcodeofconduct.com)
and the [ZA Developers Code of Conduct for Slack](https://github.com/zadev/code-of-conduct/blob/master/README.md).
Loading

0 comments on commit 5c9ce12

Please sign in to comment.