<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sean</title>
    <description>The latest articles on DEV Community by Sean (@sean_learns_devops).</description>
    <link>https://dev.to/sean_learns_devops</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F971864%2Fe7f6da76-8268-4213-943b-7e5646c3416c.jpeg</url>
      <title>DEV Community: Sean</title>
      <link>https://dev.to/sean_learns_devops</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sean_learns_devops"/>
    <language>en</language>
    <item>
      <title>Project #3: Create a CI/CD pipeline for an existing Django project</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Sat, 25 Feb 2023 19:22:35 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/project-3-create-a-cicd-pipeline-for-an-existing-django-project-4433</link>
      <guid>https://dev.to/sean_learns_devops/project-3-create-a-cicd-pipeline-for-an-existing-django-project-4433</guid>
      <description>&lt;p&gt;I finished this project &lt;a href="https://dev.to/sean_learns_devops/project-2-dockerdjango-project-from-testdrivenio-3e66"&gt;here&lt;/a&gt; taking a project from testdriven.io and then re-writing it to use GitHub Actions to deploy to my Linode server.&lt;/p&gt;

&lt;p&gt;I have a previous Django project I built about a year ago and a particular way I like to structure my projects. So I'll be re-writing the actions to work with that project.&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Project #2: Docker/Django project from testdriven.io (status: in-progress)</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Mon, 19 Dec 2022 02:20:38 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/project-2-dockerdjango-project-from-testdrivenio-3e66</link>
      <guid>https://dev.to/sean_learns_devops/project-2-dockerdjango-project-from-testdrivenio-3e66</guid>
      <description>&lt;p&gt;I started a course from &lt;a href="https://testdriven.io/courses/tdd-django/" rel="noopener noreferrer"&gt;Test-Driven Development with Django, Django REST Framework, and Docker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Status&lt;/strong&gt;: Complete&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2023-02-25&lt;/strong&gt;&lt;br&gt;
I haven't updated this in a while but for a good reason: I was actually doing the work and I can happily report that I have completed this project. According to my logs, I've put in 30+ hours into it and have learned a lot.&lt;/p&gt;

&lt;p&gt;I took the TDD Django Project from testdriven and built a CI pipeline which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built a CI version of my latest code commits and ran tests and linting&lt;/li&gt;
&lt;li&gt;Once those tests passed, it built a production docker image and pushed it up to GitHub Container Registry&lt;/li&gt;
&lt;li&gt;If that job was successful, another job pulled down the latest images from GitHub Container Registry and copied the secret &lt;code&gt;.env&lt;/code&gt; file + production docker-compose file and built the production image in Linode and deployed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7rrb05vgxq1tpeq7fus1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7rrb05vgxq1tpeq7fus1.png" alt="Image description" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6bhb3479c0jouijczzjp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6bhb3479c0jouijczzjp.png" alt="Image description" width="681" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the end I needed 3 guides to complete this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://testdriven.io/courses/tdd-django" rel="noopener noreferrer"&gt;https://testdriven.io/courses/tdd-django&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/github-actions-the-complete-guide" rel="noopener noreferrer"&gt;https://www.udemy.com/course/github-actions-the-complete-guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://testdriven.io/blog/deploying-django-to-linode-with-docker-and-github-actions/" rel="noopener noreferrer"&gt;https://testdriven.io/blog/deploying-django-to-linode-with-docker-and-github-actions/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2023-01-17&lt;/strong&gt;&lt;br&gt;
After getting my first build to run, I was beating my head trying to run the tests. I am trusting my gut in everything and decided to do a &lt;a href="https://www.udemy.com/course/github-actions-the-complete-guide" rel="noopener noreferrer"&gt;GitHub Actions course on Udemy&lt;/a&gt;. I'll go through this over the next two weeks so that I can really understand Actions. I'm not trying to piece together a buncha random StackOverflow articles. I'm doing this legit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2023-01-12&lt;/strong&gt;&lt;br&gt;
I've been putting in time this week. In my project, added flake8/black/isort which are great packages I will use for my projects in the future. It got to a point where the tutorial wanted me to sign-up for GitLab + upload my image to Docker Hub but I wanted to use GitHub Actions + GitHub Container Registry. I watched a video from &lt;a href="https://www.youtube.com/watch?v=R8_veQiYBjI" rel="noopener noreferrer"&gt;Nana Techworld&lt;/a&gt; and after bashing my head against the wall for an hour I finally got a passing build (though it is incomplete)!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwb06wwv9u5j1roj7j7n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwb06wwv9u5j1roj7j7n.png" alt="Image description" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-12-24&lt;/strong&gt;&lt;br&gt;
Worked on this about 1.5 hours today. It's looking good but it's quite Heroku specific, which I have no plans of using for future projects. Merry Christmas to all&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-12-18&lt;/strong&gt;&lt;br&gt;
It's going pretty smoothly right now, I've put roughly 2.5 hours into it. The project that we build ends up deploying to Heroku but when I'm done with the project I'll try to adapt it to deploy to my Linode.&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Project #1: Deploy a Docker Container on Linode (status: Abandoned)</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Tue, 22 Nov 2022 03:10:29 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/project-1-deploy-a-docker-container-on-linode-2d9d</link>
      <guid>https://dev.to/sean_learns_devops/project-1-deploy-a-docker-container-on-linode-2d9d</guid>
      <description>&lt;p&gt;&lt;strong&gt;Status:&lt;/strong&gt; Abandoned&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A couple of years ago, I worked on a project that dockerized a Django application that displayed a basic 'Upload' form and uploaded the files within the same container&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/drivelous/docker-ubuntu18.04-django3.0.2"&gt;https://github.com/drivelous/docker-ubuntu18.04-django3.0.2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It has a local and production build with the production build firing up an nginx service.&lt;/p&gt;

&lt;p&gt;That repo is the product of customizing code that I wrote when I followed this tutorial: &lt;a href="https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/"&gt;https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Progress Log&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2022-12-10&lt;/strong&gt;&lt;br&gt;
I did everything but couldn't do this. I did a final ~2 hour session trying to get it to work but decided to start a new tutorial from &lt;a href="https://testdriven.io/"&gt;https://testdriven.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since it's a paid course, I know that the code will work. At some point in time, I will return back to this after my knowledge of Docker and Docker Compose gets better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-11-28&lt;/strong&gt;&lt;br&gt;
I've put in a few hours this past week and while I've learned a bit, ultimately, I ended up posting on StackOverflow to see if anyone could help me out -- &lt;a href="https://stackoverflow.com/questions/74606942/docker-nginx-service-cant-communicate-with-django-service-and-returning-bad-req"&gt;https://stackoverflow.com/questions/74606942/docker-nginx-service-cant-communicate-with-django-service-and-returning-bad-req&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also just want to note that this nginx/django guide is great: &lt;a href="https://mattsegal.dev/nginx-django-reverse-proxy-config.html"&gt;https://mattsegal.dev/nginx-django-reverse-proxy-config.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-11-22&lt;/strong&gt;&lt;br&gt;
Still having issues but inching a bit closer.&lt;/p&gt;

&lt;p&gt;I realize now that using an official nginx Docker image reroutes all the logs that would normally be in &lt;code&gt;/var/log/nginx/&lt;/code&gt; to either &lt;code&gt;stdout/stderr&lt;/code&gt;. This is useful so that outside of the container I can run &lt;code&gt;docker logs &amp;lt;container_name&amp;gt;&lt;/code&gt; but since I was looking for debug level logs it didn't help much -- I know my server is returning 400, but why?&lt;/p&gt;

&lt;p&gt;So in &lt;code&gt;nginx.conf&lt;/code&gt; I added the line below and rebuild the image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upstream polls_django {
    server web:8000;
}

error_log /var/log/nginx/error_foo.log debug;  &amp;lt;--
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When running &lt;code&gt;docker exec -it &amp;lt;container_name&amp;gt; /bin/sh&lt;/code&gt; I took a peak at &lt;code&gt;error_foo.log&lt;/code&gt; and saw a lot of Operation timed out requests&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2022/11/23 01:34:39 [info] 7#7: *11 client timed out (110: Operation timed out) while waiting for request, client: xx.xx.xxx.xx, server: 0.0.0.0:80
2022/11/23 01:38:40 [info] 7#7: *15 client timed out (110: Operation timed out) while waiting for request, client: xx.xx.xxx.xx, server: 0.0.0.0:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I had a hunch it was because my environment variables &lt;code&gt;.env.prod&lt;/code&gt; didn't have my IP in &lt;code&gt;DJANGO_ALLOWED_HOSTS&lt;/code&gt; (which I thought would explain why it works locally but not in production) but that wasn't it.&lt;/p&gt;

&lt;p&gt;I have a hunch that something is amiss. Looking at the web application logs, there are no requests that made it to Django. nginx is not able to reach it for some reason.&lt;/p&gt;

&lt;p&gt;I've worked an hour on this. I gotta come back to it later on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-11-21&lt;/strong&gt;&lt;br&gt;
Locally, running the production command, I can get it to work&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose -f docker-compose.prod.yml up --build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Local: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4cCbsgyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kbxrnq55bl13dqd4ifg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4cCbsgyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kbxrnq55bl13dqd4ifg.png" alt="Image description" width="695" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But when I run it on my Linode, I'm getting Bad Request 400.&lt;/p&gt;

&lt;p&gt;All I can see in my logs is the 400&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker logs docker-ubuntu1804-django302_nginx_1
$ [22/Nov/2022:02:58:25 +0000] "GET / HTTP/1.1" 400 154 "-"...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've tried getting a shell into nginx and then running cat on the nginx error.log but it freezes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker exec -it docker-ubuntu1804-django302_nginx_1 /bin/sh
$ [nginx] cd /var/log/nginx
$ [nginx] cat error.log
--&amp;gt; (stuck hanging here)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;I'm still trying to figure out what's wrong&lt;/li&gt;
&lt;li&gt;I can't seem to find the error logs within my container&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devops</category>
      <category>seanlearnsdevops</category>
    </item>
    <item>
      <title>Project List</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Thu, 17 Nov 2022 00:25:13 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/projects-h1m</link>
      <guid>https://dev.to/sean_learns_devops/projects-h1m</guid>
      <description>&lt;p&gt;&lt;strong&gt;Projects&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deploy my old Docker/Django/Ubuntu container on Linode (&lt;a href="https://dev.to/sean_learns_devops/project-1-deploy-a-docker-container-on-linode-2d9d"&gt;Project #1&lt;/a&gt;) -- &lt;em&gt;In Progress&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Final Project&lt;/strong&gt;&lt;br&gt;
Build photo uploader written with Django/React. This project will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a basic CI/CD build which automatically deploys changes to &lt;code&gt;main&lt;/code&gt; after tests pass&lt;/li&gt;
&lt;li&gt;Have a development/production build&lt;/li&gt;
&lt;li&gt;Log exceptions in Sentry&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>discuss</category>
      <category>startup</category>
    </item>
    <item>
      <title>Hi everyone, I'm Sean</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Thu, 17 Nov 2022 00:18:30 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/hi-everyone-im-sean-4b0</link>
      <guid>https://dev.to/sean_learns_devops/hi-everyone-im-sean-4b0</guid>
      <description>&lt;p&gt;I'm starting this blog to outline my journey of learning DevOps.&lt;/p&gt;

&lt;p&gt;I've been a professional Software Engineer for 7+ years, mostly building and maintaining full stack web applications written in Django/React. While my skills have been improving writing application logic, actually deploying my apps to the web has always been a huge weakness of mine. I want to change that and write about the learning process here.&lt;/p&gt;

&lt;p&gt;I've done a few tutorials in the past (namely &lt;a href="https://www.udemy.com/course/docker-mastery/" rel="noopener noreferrer"&gt;Docker Mastery&lt;/a&gt; and &lt;a href="https://www.udemy.com/course/nginx-fundamentals/" rel="noopener noreferrer"&gt;nginx fundamentals&lt;/a&gt;) and of course the various build pipelines at my job are a part of the engineering department's every day essentials, however, I know that really learning the ins-and-outs of DevOps requires designing and building a difficult but neat project that will challenge me while keeping my interest.&lt;/p&gt;

&lt;p&gt;My ultimate project is a photo uploading application using Django/React but with all the bells and whistles of a production application. On the way, I will be building some intermediate projects. You can find them in the  entry, which I will update.&lt;/p&gt;

&lt;p&gt;If you would like to reach me, send me an email at:&lt;br&gt;
&lt;strong&gt;sean AT (github handle) DOT com&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>html</category>
    </item>
    <item>
      <title>Questions</title>
      <dc:creator>Sean</dc:creator>
      <pubDate>Mon, 14 Nov 2022 16:49:59 +0000</pubDate>
      <link>https://dev.to/sean_learns_devops/questions-3p72</link>
      <guid>https://dev.to/sean_learns_devops/questions-3p72</guid>
      <description>&lt;p&gt;I'm building a photo uploader with all the DevOps bells and whistles. I am using this post to host all my questions. Once I answer them, I'll add the answers to them.&lt;/p&gt;

&lt;p&gt;As of November 14, 2022, the way I'm thinking of building it is:&lt;/p&gt;

&lt;p&gt;TODO: create a diagram and show here&lt;/p&gt;

&lt;p&gt;React application&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How should I serve it?&lt;/li&gt;
&lt;li&gt;Should I deploy it to a server running nginx? And why?&lt;/li&gt;
&lt;li&gt;Should I serve it as a single staticfile hosted on a bucket?&lt;/li&gt;
&lt;li&gt;Should I use Docker?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Django application&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do I add data monitoring?&lt;/li&gt;
&lt;li&gt;I will use Docker to serve this application. What base image should I use?&lt;/li&gt;
&lt;li&gt;I have an application server + a task queue. How do I get these two to talk each other?&lt;/li&gt;
&lt;li&gt;How do I spin up new instances and have the load balancer know about them?&lt;/li&gt;
&lt;li&gt;How do I spin up new instances in response to data monitoring?&lt;/li&gt;
&lt;li&gt;What should I use to manage the database?&lt;/li&gt;
&lt;li&gt;How do I get my local build to upload images to one bucket and production build to upload to another?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Misc&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do I manage environment variables in production?&lt;/li&gt;
&lt;li&gt;When I push changes to main, how do I create a hook to deploy my latest changes?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Docker&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do I expose my docker container to the outside world?&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
