Reddit DevOps
268 subscribers
2 photos
31K links
Reddit DevOps. #devops
Thanks @reddit2telegram and @r_channels
Download Telegram
Understanding workflow of multi-stage Dockerfile

There are a few processes I'm struggling to wrap my brain around when it comes to multi-stage Dockerfile.

Using this as an example, I have a couple questions below it:

# Dockerfile
# Uses multi-stage builds requiring Docker 17.05 or higher
# See https://docs.docker.com/develop/develop-images/multistage-build/

# Creating a python base with shared environment variables
FROM python:3.8.1-slim as python-base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIPNOCACHEDIR=off \
PIP
DISABLEPIPVERSIONCHECK=on \
PIP
DEFAULTTIMEOUT=100 \
POETRY
HOME="/opt/poetry" \
POETRYVIRTUALENVSINPROJECT=true \
POETRY
NOINTERACTION=1 \
PYSETUP
PATH="/opt/pysetup" \
VENVPATH="/opt/pysetup/.venv"

ENV PATH="$POETRY
HOME/bin:$VENVPATH/bin:$PATH"


# builder-base is used to build dependencies
FROM python-base as builder-base
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
build-essential

# Install Poetry - respects $POETRY
VERSION & $POETRYHOME
ENV POETRY
VERSION=1.0.5
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

# We copy our Python requirements here to cache them
# and install only runtime deps using poetry
WORKDIR $PYSETUPPATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --no-dev # respects


# 'development' stage installs all dev deps and can be used to develop code.
# For example using docker-compose to mount local volume under /app

FROM python-base as development
ENV FASTAPI
ENV=development

# Copying poetry and venv into image
COPY --from=builder-base $POETRYHOME $POETRYHOME
COPY --from=builder-base $PYSETUPPATH $PYSETUPPATH

# Copying in our entrypoint
COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# venv already has runtime deps installed we get a quicker install
WORKDIR $PYSETUPPATH
RUN poetry install

WORKDIR /app

COPY . .

EXPOSE 8000
ENTRYPOINT /
docker-entrypoint.sh $0 $@
CMD ["uvicorn", "--reload", "--host=
0.0.0.0", "--port=8000", "main:app"]


# 'lint' stage runs black and isort
# running in check mode means build will fail if any linting errors occur
FROM development AS lint
RUN black --config ./pyproject.toml --check app tests
RUN isort --settings-path ./pyproject.toml --recursive --check-only
CMD ["tail", "-f", "/dev/null"]


# 'test' stage runs our unit tests with pytest and
# coverage. Build will fail if test coverage is under 95%
FROM development AS test
RUN coverage run --rcfile ./pyproject.toml -m pytest ./tests

RUN coverage report --fail-under 95


# 'production' stage uses the clean 'python-base' stage and copyies
# in only our runtime deps that were installed in the 'builder-base'
FROM python-base as production
ENV FASTAPI
ENV=production

COPY --from=builder-base $VENVPATH $VENVPATH
COPY ./docker/gunicornconf.py /gunicornconf.py

COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

COPY ./app /app
WORKDIR /app

ENTRYPOINT /docker-entrypoint.sh $0 $@
CMD "gunicorn", "--worker-class uvicorn.workers.UvicornWorker", "--config /gunicorn_conf.py", "main:app"

The questions I have:

1. Are you docker build ... this entire image and then just docker run ... --target=<stage> to run a specific stage (development, test, lint, production, etc.) or are you only building and running the specific stages you need (e.g. docker build ... -t test --target=test && docker run test ...)?
2. When it comes to local Kubernetes development (minikube, skaffold, devspace, etc.) and running unit tests, are you supposed referring to these stages
in the Dockerfile (devspace Hooks or something) or using native test tools in the container (e.g. npm test, ./manage.py test, etc.)?

Thanks for clearing this questions up.

https://redd.it/p1sn27
@r_devops
How do you like to learn new tactics and tools?

I'm investigating ways to improve how systems engineers take on the breadth of their role.

One of the ways I'm looking at this is through learning design.

Looking at microlearning as one avenue for time-poor individuals.

So, my question to you is how do you prefer to learn new tactics and tools?

Pick as many types as you find useful.

View Poll

https://redd.it/p1nh49
@r_devops
How to choose the correct PATH to get into DevOps from Ops...

Hello, my friends

After a long journey and many interviews, I have got a job position as a Junior Application Operations (my first Ops role) and I will start it in September. I have only 1 year 8 months of experience as a Quality Assurance Technician (in the gaming industry/game tester). I love improving myself and I have a great passion to become a DevOps engineer in the future. I would like to read here Advice/Tips from DevOps engineers, especially those who come from an Ops background. I want to know what kind of courses should I follow in Udemy, Coursera, or in other platforms? Tbh, I'm a Business Management student with a master's degree who doesn't have an IT background. Right now I am following Shell/Bash scripting course for myself and I hope this is a good start. I wouldn't want to skip your advice here. Thanks everyone in advance!

https://redd.it/p17azd
@r_devops
MINIKUBE AND KUBECTL - HELP NEEDED


~ % minikube start
๐Ÿ˜„ minikube v1.22.0 on Darwin 11.2 (arm64)
โœจ Using the docker driver based on existing profile
๐Ÿ‘ Starting control plane node minikube in cluster minikube
๐Ÿšœ Pulling base image ...
๐Ÿ”„ Restarting existing docker container for "minikube" ...
๐Ÿณ Preparing Kubernetes v1.21.2 on Docker 20.10.7 ...
๐Ÿ”Ž Verifying Kubernetes components...
โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ Enabled addons: storage-provisioner, default-storageclass
๐Ÿ„ Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

~ % kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:60186
CoreDNS is running at https://127.0.0.1:60186/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

kubectl get pods --all-namespaces

NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-558bd4d5db-4c2qc 1/1 Running 1 46m
kube-system etcd-minikube 1/1 Running 1 46m
kube-system kube-apiserver-minikube 1/1 Running 1 46m
kube-system kube-controller-manager-minikube 1/1 Running 1 46m
kube-system kube-proxy-wtdcr 1/1 Running 1 46m
kube-system kube-scheduler-minikube 1/1 Running 1 46m
kube-system storage-provisioner 1/1 Running 3 46m


why does cluster-info or namespace not show the dashboard, and kubeDNS?

https://redd.it/p251r3
@r_devops
Git Switch and Restore commands came in version 2.23. In this article, we will go through all the new commands that are here to make our life a bit easier. To understand more about the new Switch and Restore, we will look at "Checkout" first. Let's Start!

https://www.p3r.one/git-switch-and-restore/

https://redd.it/p274k4
@r_devops
It has been such a wonderful week so far because another tool under the CNCF umbrella got its latest update. There are many changes, bug fixes, and new features and enhancements in this new update. We are going to talk about all of these in this article. But, let's get around with Keda at first!

https://www.p3r.one/keda-2-4-release/

https://redd.it/p274h5
@r_devops
Ansible - start at specific role

I have a playbook that only calls roles. This is what it looks like: (there are about 20 roles in it)

---
- hosts: prod1234
roles:
- role1
- role2
- role3

Sometimes, a role fails, and I don't want to start over as each role is huge and I would just like to start at that point or the next one.

With tasks, I know there's a flag for --start-at-task="task-name". Is there something similar I can do with roles?

My current solution is to comment out all the lines I don't need and run it again..

Thanks ahead!

https://redd.it/p28yv6
@r_devops
advice to handle work

hey guys, so i was selected as a trainee for the role of devops. This is like my first experience of doing any job and its been almost 2 and a half months since i joined. At first i was told to study git, gitlab , docker jenkins and all those basics related to devops.

after a month i was asked to work on puppet on which i had no clue about.. i did up to puppet installation and some configuration and establishing some connection... i took some time to do this stuff since i had no clue in the beginning and got a lot of errors while proceeding.

so, i was aked to stop it and do another task related to running a flask on docker. i did it and after that i was asked to run flask using tensorflow algoirithm on containers again.. I have know prior coding knowledge and tensorflow is totally different.. i took like 3-4 days and then he told me this is getting compliacated so do work on site realibility engineering. so i stopped tensorflow with docker and started reading about sre.

i had to read a lot of sre related stuff and tried to understand what and why we need it. took me 3 days( could have taken less time) . then i was asked to implement sre in my organization which again i have no clue... i dont even know how to approach and tried for few days and told him i need more time..

again, he told me to chuck it and start looking at prtg which is a network monitoring tool.

today in the daily meeting we had, he told me that i just raise my hands when asked if someone could do a particular task but do nothing about it. And i need to be committed and stuff. he said i dont do anything so why bother giving me a task.

&#x200B;

i was like shocked and it aint going out of my mind no matter how i try. this is like my first time doing a job and it totally broke my confidence..

i just did what he told me to. i didnt even ask him why we are doing and stuff. i just said ok to him whatever he told. Now he says i didnt do anything.

&#x200B;

could you guys tell me what went wrong and then how to actually talk, act and stuff realted to being in an office.. all suggestions would be helpful.

thank you

https://redd.it/p29v5n
@r_devops
What does the future of DevOps look like?

I'm beginning my transition of Sysadmin to DevOps. Still got a long way to go as I've not used some of the key tools before. What does the future of DevOps look like in the next 5 years or so? Do you think it will become more and more in-demand? Personally I don't think it's going anywhere anytime soon, but as I've got a long way to go to get to my goal it's something that has crossed my mind.

https://redd.it/p29rik
@r_devops
Creating Subdomains on AWS Route 53 with the original domain on GoDaddy

The thing started with wanting to route the traffic through AWS by creating a hosted zone on Route 53 and copy the name servers it generates to GoDaddy. When I checked the existing name servers on my GoDaddy domain before doing anything I found some name servers that belong to Nginx and I'm not sure if adding Route 53's NSs to the existing name servers in general would result in any consequences since the domain has traffic and it's operating!

Also, I want to know which is a better practice, whether to create the subdomains on AWS Route 53 (since I'm using many AWS services) with my domain itself being on GoDaddy or create the subdomains from GoDaddy and just route the traffic through AWS by creating a hosted zone on Route 53 and copy the name servers it generates to GoDaddy.

https://redd.it/p2c22k
@r_devops
How To Automate Your Mobile App Releases using Fastlane and SemVer for Hybrid Applications

Hey guys,

I wrote an article on how you could automate your mobile app releases using Fastlane and SemVer for Hybrid Applications.

I hope you find it useful for your release management process in your pet projects or companies.

How To Automate Your Mobile App Releases using Fastlane and Semver for Hybrid Applications

Do leave a comment or recommendations on how the tool can be improved.

https://redd.it/p2dls7
@r_devops
A serverless platform for running containers globally - feedback?

Hi r/devops

We are validating a new serverless product to deploy and manage containers globally (seaplane.io, the website needs updating). We are looking for feedback.

We found that many engineering teams spend hundreds of hours building and maintaining infrastructure where they could be working on their core applications instead. We aim to solve those problems.

Our platform lets users deploy containerized workloads on a global compute cluster that runs on top of multi-cloud (AWS, Azure, GCP) and bare metal (Equinix, Hivelocity, OVH, etc.) and custom edge. The platform automatically senses your traffic and adjusts the infrastructure accordingly (much like a CDN does for content), scaling horizontally and adjusting where the compute runs to minimize latency.

Besides the compute, we also run a data layer currently supporting Postgres. The DB supports multi-region multi-writer in 400+ locations and is strongly consistent.

The goal is to give engineering and DevOps teams superpowers to build on top of strong infrastructure without worrying about zones, regions, clouds, redundancy, and anything else. The system takes care of all of that while still giving you a granular level of control.

Would you use a system like this? Anyone interested in providing feedback, we would love to hear from you!

https://redd.it/p2g516
@r_devops
Are managed Kubernetes and managed databases worth it for a one-man show?

Hey folks,

Making a webapp by myself and have very little ops experience (mostly do data engineering at my real job but I do some generalist stuff in my spare time like webdev and some backend).

I don't know jack about Kubernetes and was was wondering if paying for managed Kubernetes on DigitalOcean, Linode, or Oracle Cloud (my use case is extremely egress-heavy so I can't afford to use AWS/GCP/Azure) is worth it for me. If not, I was considering using Hashicorp Nomad instead (edit: feedback on this idea welcome).

Will be using Hashicorp stack ops-wise unless I use Kubernetes over Nomad.


Also -- would $15/mo for DigitalOcean's managed databases (because fuck paying for Oracle databases) be worth it for me time-wise? Or could I reliably back up a DB I set up myself with just a cron job?

https://redd.it/p2ge8v
@r_devops
Looking for Suggestions on git training courses for senior employees that need retraining

I'm looking for git training course suggestions:


The Situation:

I have been tasked with providing a plan for my companies migration from perforce to git; eventually moving our current process into bitbucket. Obviously part of this involves training employees on git, some of which have never used it. We are a small company, so in-house training from other employees would be too much of a time sink to be a viable solution for us.

I've been scouring the internet but i'm having trouble finding unbiased reviews of various git training courses.

Another consideration is that, ideally, there'd be some form of testing/interaction involved. Unfortunately, I'm worried that pure reading/video type courses will result in employees just clicking through it to get it done as quickly as possible and causing a knowledge gap.

Paid or Free doesn't matter for us

https://redd.it/p2im5u
@r_devops
What does your company give you for professional development?

Hello,

I'm a position where I can significantly influence the creation of a professional development policy for our company. We're roughly 400 people, majority of which are based in North America but we have a global presence.

I'm curious what everyone's companies are giving them in terms of professional development?

Specifically:

* Do you have a departmental, team, or individual budget? If so, how much?
* Do you have guidelines on how much your company reimburses vs the individual? For example, if someone wants to do some expense certification (i.e. in the thousands of $$), does the company reimburse up to a certain %?
* How does your company determine what is eligible?

There are mixed opinions about this internally so I'm try to collect some data points to justify a pretty generous policy in the spirit of retention. Thanks!

https://redd.it/p2jsea
@r_devops
What are some tools you have built that you are particularly proud of?

It's your time to shine. Brag away!

https://redd.it/p2kcwv
@r_devops
Test Cloud Ping

Just discovered this website, it's useful if like me you have a team spread on several countries and some peers start complaining about latency to some cloud server.

Not made by me.

https://cloudpingtest.com/

https://redd.it/p2mhni
@r_devops
Java Creator James Gosling Interview

James Gosling, often referred to as "Dr. Java", is a Canadian computer scientist, best known as the father of the Java programming language. He did the original design of Java and implemented its original compiler and virtual machine. Our DevRel, Grigory Petrov, had the opportunity to interview James, and we have included the entire transcript below. Hope you enjoy it!

https://redd.it/p2cwrf
@r_devops
Is it true that the decision to choose a VDS/VPS hosting for a company is more influenced by engineers than managers?

I assume that behind any management decision on choosing a VDS/VPS hosting company, there is a consultation (past or present) with engineers.

View Poll

https://redd.it/p2jsc2
@r_devops
How would you answer this Problem Statement

Roughly about a year when I had gotten my cloud cert, and was getting into devops I had an interview for a company for a junior devops engineer position. For the interview I had to explain and answer the following Problem Statement:

ยท The company is creating its new applications with an event driven microservices pattern.

ยท The company has already selected AWS

ยท The company has already selected Jenkins

ยท The microservices uptime should be 24/7

ยท The microservices need to be highly resilient, an hour of downtime will cost the company a million dollars in revenue.

Create a design for continuous delivery for these microservices from the branching strategy, through deployment, and the overall stability and scalability in a production environment. 

I don't remember the answer I gave, but I am curious how would someone with a lot of experience in the industry answer this question?

https://redd.it/p2hti5
@r_devops