<?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: Angus Allman</title>
    <description>The latest articles on DEV Community by Angus Allman (@allmanaj).</description>
    <link>https://dev.to/allmanaj</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%2F131485%2F9e04a64d-ef10-44fe-a641-dc63c509b6a9.jpeg</url>
      <title>DEV Community: Angus Allman</title>
      <link>https://dev.to/allmanaj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/allmanaj"/>
    <language>en</language>
    <item>
      <title>The Best Free Django Hosting and Deployment in 2022</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Mon, 29 Aug 2022 07:59:26 +0000</pubDate>
      <link>https://dev.to/allmanaj/the-best-free-django-hosting-and-deployment-in-2022-2d68</link>
      <guid>https://dev.to/allmanaj/the-best-free-django-hosting-and-deployment-in-2022-2d68</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;TL;DR PyHost is a great Heroku alternative.    &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The world of Django hosting has been turned on its head. As of 25th August 2022, Heroku has announced that it will be &lt;a href="https://blog.heroku.com/next-chapter"&gt;discontinuing the free service&lt;/a&gt; it offers from 26th October 2022 onwards. What does this mean for Django developers looking to get a site quickly deployed so you can show friends and family your exciting new project? It means a whole world of options just became more viable and PyHost is one of them. &lt;/p&gt;

&lt;h2&gt;
  
  
  What does PyHost offer?
&lt;/h2&gt;

&lt;p&gt;At its core, PyHost is a server provisioning system. You tell it what server you want and it goes and creates it. However, it installs everything you need to get your Django site up and running based on the information you give it. Need an older Python version or a different DB driver? No problem!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t2QToOkJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/dzbaCli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t2QToOkJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/dzbaCli.png" alt="PyHost server creation form" width="880" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you’ve filled in the form, PyHost will set up your server (there’s a lot to install so it can take about 5-10 minutes at times) and then you’re in. Simply connect your server to your Git provider (&lt;a href="https://github.com"&gt;Github&lt;/a&gt;, &lt;a href="https://gitlab.com"&gt;Gitlab&lt;/a&gt;, and &lt;a href="https://bitbucket.org"&gt;Bitbucket&lt;/a&gt;). Then you can create your site from an existing git repo and you’re away. &lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying a site
&lt;/h2&gt;

&lt;p&gt;PyHost keeps track of all its deployments so you can read the logs and see what, if anything, went wrong. Sometimes it could be as simple as not having an &lt;a href="https://docs.pyhost.io/docs/environment-variables/"&gt;OS environment variables set&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  It’s still actively worked on
&lt;/h2&gt;

&lt;p&gt;PyHost just works. It feels like magic having the site set up without having to put any work in. All the best systems have areas they could be improved upon, though. This is why it’s reassuring to know that PyHost is still actively in development and being built upon. With new features released frequently and existing bugs squashed faster than you can say “&lt;a href="//djangoproject.com"&gt;Django&lt;/a&gt;” you're in good hands.&lt;/p&gt;

&lt;p&gt;On top of constant development, there’s also one-to-one email support available for any issues or questions which may arise. I’m always happy to help!&lt;/p&gt;

&lt;h2&gt;
  
  
  Not convinced?
&lt;/h2&gt;

&lt;p&gt;If you’d like to try PyHost but are still unsure, then please drop an email to &lt;a href="//mailto:admin@pyhost.io"&gt;admin@pyhost.io&lt;/a&gt; with any questions or queries. PyHost has a &lt;a href="https://pyhost.io/blog/pyhost-free-plan"&gt;free plan&lt;/a&gt; available to everyone and that will never change. At the moment you can create a server and as many sites as you like but only with &lt;code&gt;pyhost.io&lt;/code&gt; subdomains. If you want to use a custom domain then, for now, you’ll need to use at least the basic plan. I’d say that’s fair though 😉.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PyHost is a valuable tool for any Django developer, whether they’re a beginner or a dab-hand at all things Python. It deploys and hosts your site to your own server, unlike many other Django hosting solutions, which means that you get to stay in full control and which makes Django a fantastic Heroku alternative since their dropping of their free plan. So come and give it a try! Like I said before, please do not hesitate to shoot any questions over to &lt;a href="//mailto:admin@pyhost.io"&gt;admin@pyhost.io&lt;/a&gt; and I’ll be sure to get you pointed in the right direction.&lt;/p&gt;

&lt;p&gt;Thank you for reading and if you feel like someone you know or your Twitter followers could benefit from this post then don’t forget to share!&lt;/p&gt;

&lt;p&gt;PyHost is on Twitter &lt;a href="https://twitter.com/pyhost"&gt;@pyhost&lt;/a&gt; so don’t forget to mention us!&lt;/p&gt;

</description>
      <category>heroku</category>
      <category>alternative</category>
      <category>django</category>
    </item>
    <item>
      <title>How to Filter Complex Javascript Arrays</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Tue, 29 Mar 2022 16:42:39 +0000</pubDate>
      <link>https://dev.to/allmanaj/how-to-filter-complex-javascript-arrays-1nkj</link>
      <guid>https://dev.to/allmanaj/how-to-filter-complex-javascript-arrays-1nkj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;TL;DR&lt;/em&gt; I've revived an open-source npm package that I initially built a couple of years ago but have given some TLC in the last few days. You can find it here: &lt;a href="https://github.com/allmanaj/or-where"&gt;https://github.com/allmanaj/or-where&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A few years ago, a colleague and I were faced with a problem. We had to make a dashboard with dynamic, intelligent filters for multiple types of data from objects to strings. Usually this would have been a relatively simple thing to accomplish with Javascript's &lt;code&gt;filter()&lt;/code&gt; function but in this instance we had no real way of knowing what the user was going to try and filter on since the data could vary so much. To help solve the problem, I built a small, single JS file which allowed us to construct logic like Laravel's Eloquent queries. It meant that we could turn a long, meandering condition inside the filtering function to look more like English. Ultimately, we loved working with it and I released it as a small npm package.&lt;/p&gt;

&lt;p&gt;Let's take a look at an example and see how it makes life simpler for developers who find themselves with a whole load of data and no easy way to filter it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// without or-where
users.filter(user =&amp;gt; {
    return (user.name == 'Angus' || user.name == 'Jess' || user.name == 'Aaron') &amp;amp;&amp;amp; user.age &amp;gt;= 25;
});

//with or-where
filter = new Builder(users);
filter.whereIn('name', ['Angus', 'Jess', 'Aaron'])
      .where('age', '&amp;gt;=', 25)
      .get()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even in this relatively basic example it's easy to see the benefits of it. Rather than needing to read the logic gates and pay attention to the brackets, you can read the query like it's English. &lt;/p&gt;

&lt;p&gt;Using the built in methods (&lt;code&gt;where()&lt;/code&gt;, &lt;code&gt;orWhere()&lt;/code&gt;,... etc) you build up a query which is eventually passed to Javascript's &lt;code&gt;filter()&lt;/code&gt; method when you call &lt;code&gt;get()&lt;/code&gt;. That's all there is to it! You can create incredibly flexible queries with a few simple building blocks leaving your code readable and efficient. What's not to love?&lt;/p&gt;

&lt;p&gt;You can find the full documentation on github: &lt;a href="https://github.com/allmanaj/or-where"&gt;https://github.com/allmanaj/or-where&lt;/a&gt;. Feel free to contribute or open an issue if there's a feature you feel the package is missing!&lt;/p&gt;

&lt;p&gt;I'd really appreciate it if you'd take a look and share it with anyone who might find the package useful, and leave a star if you're feeling generous 😉&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>javascript</category>
      <category>laravel</category>
    </item>
    <item>
      <title>How I Learned to Love Remote Working</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Thu, 20 Aug 2020 22:40:32 +0000</pubDate>
      <link>https://dev.to/allmanaj/how-i-learned-to-love-remote-working-2a5g</link>
      <guid>https://dev.to/allmanaj/how-i-learned-to-love-remote-working-2a5g</guid>
      <description>&lt;p&gt;I hate working remotely.&lt;/p&gt;

&lt;p&gt;Well… at least I did. For some reason, it never clicked with me. I always found that I couldn’t focus on one task for any amount of time before I ended up on YouTube watching videos which, realistically, I have no interest in. I mean, sure, watching someone build perpetual motion machines is great every now and then but not when you’re 3 hours into a video hole putting off fixing a bug.&lt;/p&gt;

&lt;p&gt;I’m not sure whether it was the fact I didn’t have a choice about going remote (thanks, COVID) or whether I just needed to give it a chance but I’ve found that remote working is amazing. &lt;/p&gt;

&lt;p&gt;As with everything in life, there are upside and downsides to being a remote worker (See &lt;a href="https://www.theguardian.com/lifeandstyle/2020/jul/06/remote-working-is-not-going-away-who-wins-and-loses-when-workers-stay-home"&gt;this&lt;/a&gt; great article about what can go wrong when companies move towards remote) but these are the stand-out points that make being a remote web developer right for me &lt;/p&gt;

&lt;h3&gt;
  
  
  The 10-second commute
&lt;/h3&gt;

&lt;p&gt;I’ve not been late to work in months! Also, as long as you don’t have daily video stand-ups, then rock up in pyjamas, why not? I would get dressed at some point in the morning though or I find that it throws me all out of whack otherwise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Saving all kinds of money 🤑💰
&lt;/h3&gt;

&lt;p&gt;Working in London, and I’d assume it’s the same in most towns or cities, I got into the habit of popping into my favourite coffee shop for breakfast if I left my house in a rush, or sampling the delights of the &lt;em&gt;god knows how many&lt;/em&gt; great restaurants in Soho. No matter what I did, it all added up. &lt;/p&gt;

&lt;p&gt;No word of a lie, since I’ve been working remotely, I’ve managed to save more money than I’ve ever had in my account up until now. It’s an amazing feeling and it’s also allowed me to move to a house so we’re no longer in an old, pokey one-bed flat in the London commuter-belt all because of remote working. There’s that and having that little cushion behind me is a great feeling.&lt;/p&gt;

&lt;h3&gt;
  
  
  No Strings Attached
&lt;/h3&gt;

&lt;p&gt;Tying quite neatly to my last point about moving house. You can go anywhere. You’re not tied to a certain radius around your company’s office so that you can have a reasonable commute. You’ve got the 10 second commute now, so go where you like.&lt;/p&gt;

&lt;p&gt;Always wanted to bum around in the Mediterranean for a bit? Go for it! just make sure you have a steady internet connection and the world’s your oyster. While I run the risk of being cliché, I feel that no phrase sums it up better than the old adage: “Home is where the Wi-Fi is”.&lt;/p&gt;

&lt;h3&gt;
  
  
  Work on what you want
&lt;/h3&gt;

&lt;p&gt;I’m a busy boy. I have &lt;a href="https://pyhost.io"&gt;PyHost&lt;/a&gt;, this blog, and about half a million other half-finished side-projects on the go (who doesn’t). I never had the time, or the dedicated work-space to spend on them before. &lt;/p&gt;

&lt;p&gt;A particularly effective way of making the time, I’ve found, is starting “work” a little early to give you 40-mins to an hour to focus your projects before you have a full day doing actual work. This way you’re working on your projects when you’re most fresh and not drained from the 9-to-5.&lt;/p&gt;

&lt;p&gt;The bonus of having more hours of the day to myself and not spent on a train is that I get to spend more time at home with my partner and seeing family. It’s the best of both worlds.&lt;/p&gt;

&lt;h3&gt;
  
  
  You want a long lunch?
&lt;/h3&gt;

&lt;p&gt;Go for it. As long as you don’t have a call or anything then who's going to see?&lt;/p&gt;

&lt;p&gt;&lt;span&gt;𝓣𝓻𝓮𝓪𝓽 𝔂𝓸' 𝓼𝓮𝓵𝓯&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qxHJfMfB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media4.giphy.com/media/lAbxg2qCfOwKY/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qxHJfMfB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media4.giphy.com/media/lAbxg2qCfOwKY/giphy.gif" alt="Treat yo’ self" width="245" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Micro-managing is a thing of the past
&lt;/h3&gt;

&lt;p&gt;There’s no one to come and breathe down your neck and ask whether the feature is done or the bug is nearly solved or any of that off-putting stuff. Essentially, it’s liberating. I feel trusted to do good work and know that if I need to then I can reach out and ask someone but other than that, as long as I deliver, I can make the whole process as collaborative or as independent as I like.&lt;br&gt;
And I can spend all day on a call to a colleague just chatting shit if I like (hypothetically of course, I wouldn’t dream of it)&lt;/p&gt;

&lt;h3&gt;
  
  
  To sum it up
&lt;/h3&gt;

&lt;p&gt;In the end, it all boils down to freedom. The freedom to work at your pace and do it on your terms makes the world of difference when it comes to work-life balance and my general attitude towards work. There are also so many fewer possible stresses. If I have a bad day, then it’s because of something at work and not just an idiot on the drive home. I feel great not having had to travel for an hour and a half each way to my office and, on the odd occasion that I work late, I’m at least not getting home at 10PM anymore.&lt;/p&gt;

&lt;p&gt;If you’re debating working from home and think that these reasons sound good enough to you, then I wholeheartedly recommend it! Welcome to the club. We don’t have membership cards yet but I’ll get my people on it 😉&lt;/p&gt;

&lt;p&gt;How do you find working remotely? Love it or loathe it, let me know over on twitter &lt;a href="https://twitter.com/allmanajD"&gt;@allmanajD&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;That’s all from me, have an awesome day. ✌️&lt;/p&gt;

</description>
      <category>remote</category>
      <category>working</category>
      <category>development</category>
      <category>morale</category>
    </item>
    <item>
      <title>Launching my first Saas Product</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Fri, 10 Apr 2020 11:02:36 +0000</pubDate>
      <link>https://dev.to/allmanaj/launching-my-first-saas-product-3582</link>
      <guid>https://dev.to/allmanaj/launching-my-first-saas-product-3582</guid>
      <description>&lt;h1&gt;
  
  
  What is it?
&lt;/h1&gt;

&lt;p&gt;In short, PyHost is a server provisioning tool for Django apps. Basically, it gets your Django apps deployed in minutes with no need to even touch the command line. It can create a new server for you or connect to an existing one, install everything you need to host Django apps, and manage your sites, SSH keys, environment variables and databases. Whether you have a new domain or just want to use a subdomain is up to you but PyHost accommodates both.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why did I build it?
&lt;/h1&gt;

&lt;p&gt;I've played with a load of web frameworks over the years and always had a bit of a soft spot for Django. I spent MONTHS building an app with a Django API but when it came to deploying it I just couldn't. It took me weeks of learning about Linux servers and Apache and SSH and a number of other technologies which, for someone new to Sys-Admin, were incredibly intimidating to even get anywhere close to having a setup I was happy with and that wasn't breaking constantly. &lt;/p&gt;

&lt;p&gt;Over the next year I naturally absorbed information about servers and deployment through my job at an agency called &lt;a href="https://purrgroup.com"&gt;Purr Group&lt;/a&gt;. I then decided that I'd had enough of messing around with servers and it taking hours to deploy a site so I built PyHost (which meant messing around with servers and spending countless hours deploying sites for over a year, but it felt worth it!).&lt;/p&gt;

&lt;h1&gt;
  
  
  Who is it for?
&lt;/h1&gt;

&lt;p&gt;I've built PyHost for absolutely anyone who uses Django (and maybe Flask too in the future - but that's a whole different blog post). It makes deploying your very first Django application a breeze but also saves more experienced developers time by taking care of the boring stuff so they can spend more time on what they want to be doing - building.&lt;/p&gt;

&lt;h1&gt;
  
  
  How can I use it?
&lt;/h1&gt;

&lt;p&gt;To use it, head to &lt;a href="https://pyhost/io"&gt;pyhost.io&lt;/a&gt; and click on 'Sign up now!'. The docs are located at &lt;a href="https://docs.pyhost.io"&gt;docs.pyhost.io&lt;/a&gt; and should contain most information you need to get going! I'm also happy to answer any questions either here in the comments, or via email at &lt;a href="//mailto:admin@pyhost.io"&gt;admin@pyhost.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Leave any comments below, I can't wait to hear what people think!&lt;/p&gt;

</description>
      <category>launch</category>
      <category>saas</category>
      <category>django</category>
      <category>deployment</category>
    </item>
    <item>
      <title>So what actually is Nginx? (Linux Sys-Admin for web devs)</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Fri, 07 Feb 2020 17:46:01 +0000</pubDate>
      <link>https://dev.to/allmanaj/so-what-actually-is-nginx-linux-sys-admin-for-web-devs-5138</link>
      <guid>https://dev.to/allmanaj/so-what-actually-is-nginx-linux-sys-admin-for-web-devs-5138</guid>
      <description>&lt;h1&gt;
  
  
  We've all been there
&lt;/h1&gt;

&lt;p&gt;Getting to the point of having a site looking beautiful and polished with only one problem... no one can actually see it yet. This is where the whole painful deployment process kicks off. A search for "How to deploy a &lt;em&gt;your stack&lt;/em&gt; site" will return a slew of options but some things seem to crop up time and time again no matter what tech you're using. &lt;strong&gt;Nginx&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is it?
&lt;/h1&gt;

&lt;p&gt;The official word (from the Nginx site) is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NGINX is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, and more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Put simply, it's the thing that handles communication between the web server and your site. Whether that be reading the domain that's been requested by the user and handling it by pointing the request to the correct files, or sending it elsewhere (reverse proxy). &lt;/p&gt;

&lt;p&gt;When you access a website, say &lt;code&gt;ilovenginx.com&lt;/code&gt;, it always sends a request to a server somewhere in the world (for more info on how this works read about &lt;a href="https://dev.to/allmanaj/sys-admin-for-web-devs-intro-to-dns-5h1c"&gt;DNS&lt;/a&gt;). Now that the request's reached the server it needs to know what to do with it and that's where Nginx comes in. Using it you can create config files that contain instructions for what to do when a request to &lt;code&gt;ilovenginx.com&lt;/code&gt; arrives at the server.&lt;/p&gt;

&lt;h1&gt;
  
  
  Hit the ground running
&lt;/h1&gt;

&lt;p&gt;Nginx creates a load of files in the &lt;code&gt;/etc/nginx&lt;/code&gt; directory as soon as it's installed. This is where you want to create your config files because without them Nginx is useless and won't do a thing.&lt;/p&gt;

&lt;p&gt;Inside &lt;code&gt;/etc/nginx&lt;/code&gt; and you'll see a myriad of files and folders but the ones we want are &lt;code&gt;sites-enabled&lt;/code&gt;, and &lt;code&gt;sites-available&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sites-available&lt;/code&gt; is where we create and edit our Nginx config files and &lt;code&gt;sites-enabled&lt;/code&gt; contains symbolic links (symlinks) to our config files in &lt;code&gt;sites-available&lt;/code&gt;. The point of this is that you can have as many config files as you want &lt;em&gt;available&lt;/em&gt; to use but only actually have the important ones which your site(s) use &lt;em&gt;enabled&lt;/em&gt;. &lt;/p&gt;

&lt;h1&gt;
  
  
  The config files
&lt;/h1&gt;

&lt;p&gt;If you head into the directory &lt;code&gt;/etc/nginx/sites-available&lt;/code&gt; there will be a file named &lt;code&gt;000-default.conf&lt;/code&gt;. If you want you can open that up and take a look at the base config file template. &lt;/p&gt;

&lt;p&gt;I'm fairly sure that these config files look bewildering to even the most experienced developers and I'll be creating a line-by-line breakdown of one of these files in another blog post (coming soon) but let's not get bogged down in the details here. Fundamentally, these files are a list of instructions that tell Nginx what to do with requests that arrive depending on which domain they're for and what port they arrive at (usually port 80 for HTTP requests, or port 443 for HTTPS).&lt;/p&gt;

&lt;h1&gt;
  
  
  A brief rundown
&lt;/h1&gt;

&lt;p&gt;As with all systems like this, there is a great deal which I could discuss here and an endless list of varying commands which do plenty of different, unique things, however below, I’ve listed a few of the most important lines from a config file with a brief explanation of what they do.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;server {}&lt;/code&gt; - Creates a new Nginx server to handle requests (all Nginx commands should be within a server block)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;listen&lt;/code&gt; - Defines which port the this &lt;code&gt;server&lt;/code&gt; should handle requests from.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;root&lt;/code&gt; - Points to the directory which your site is stored in. The path will usually contain &lt;code&gt;/var/www&lt;/code&gt; if you use Nginx's defaults.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;index&lt;/code&gt; - Tells Nginx a list of files in the &lt;code&gt;root&lt;/code&gt; directory to use to run the site. You can use space-separated file names in the order which they should be tried&lt;/p&gt;

&lt;p&gt;&lt;code&gt;server_name&lt;/code&gt; - Defines the domain name that you want this &lt;code&gt;server&lt;/code&gt; block to handle requests for. You can list multiple domains here e.g:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server_name example.com www.example.com;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;That just about does it for the basics of Nginx! While it can seem complicated and like something that only advanced devs know there’s no need for it to stay that way. What it does under the hood is all kinds of magic but at its core it’s an elegant way to tell your server how to handle requests, get your site live and show it to the world.  As I mentioned there will be another post coming soon which will be a deep dive into a real Nginx config file and how it does its wizardry line-by-line. If there is anything you feel could be added to this post or you have any questions then leave them in the comments below! &lt;/p&gt;

</description>
      <category>nginx</category>
      <category>deployment</category>
      <category>servers</category>
      <category>whatisnginx</category>
    </item>
    <item>
      <title>Sys-Admin for Web Devs (Intro to DNS)</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Wed, 23 Oct 2019 18:56:50 +0000</pubDate>
      <link>https://dev.to/allmanaj/sys-admin-for-web-devs-intro-to-dns-5h1c</link>
      <guid>https://dev.to/allmanaj/sys-admin-for-web-devs-intro-to-dns-5h1c</guid>
      <description>&lt;p&gt;I’ve bought a domain and built a site… now what?&lt;/p&gt;

&lt;p&gt;At some point in the process of building and deploying a site, you’ll need to dig into the dark confusing world that is DNS. DNS stands for Domain Name System (you'll usually find it in the settings of a domain which you own, possibly under Advanced DNS) and handles the translation of a URL that you type into the browser to an IP address that the computer can visit in order to load a website.&lt;/p&gt;

&lt;p&gt;There are several different types of DNS records that you’ll more than likely encounter throughout your site deployment journey. DNS can handle translation, redirection, email and a whole host of other things but for now, I’ll just cover the most commonly used ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anatomy of a DNS Record
&lt;/h2&gt;

&lt;p&gt;DNS Records are made up of 3 main parts: &lt;strong&gt;type&lt;/strong&gt;, &lt;strong&gt;host&lt;/strong&gt;, and &lt;strong&gt;value&lt;/strong&gt;. &lt;em&gt;Type&lt;/em&gt; will be the name of the record and there may be a dropdown to choose it from, both &lt;em&gt;host&lt;/em&gt; and &lt;em&gt;type&lt;/em&gt; should be strings made up of letters, numbers, and punctuation. You may sometimes see an '@' symbol in the host field. This means that the &lt;em&gt;host&lt;/em&gt; is set to the domain on which you’re editing the DNS. For example, if you see an A Record which looks like the following... (Screenshots come from &lt;a href="https://www.namecheap.com" rel="noopener noreferrer"&gt;Namecheap&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuwkyzik8z3b0iiw1tgtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuwkyzik8z3b0iiw1tgtw.png" alt="An A Record"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;...then it’s pointing the domain you’re editing to the IP address in the &lt;em&gt;value&lt;/em&gt; section of the record. You’ll also see that there’s a &lt;strong&gt;TTL&lt;/strong&gt; field. This stands for Time to Live and acts as a sort of expiration date for the record and “dictates how long the &lt;strong&gt;record&lt;/strong&gt; will be cached by resolving nameservers, browsers, etc.” ( &lt;a href="https://help.dnsmadeeasy.com/what-is/ttl/" rel="noopener noreferrer"&gt;dnsmadeeasy.com&lt;/a&gt; )&lt;/p&gt;

&lt;h2&gt;
  
  
  A Records
&lt;/h2&gt;

&lt;p&gt;These are the simplest record which I’ve already kind of explained but I'll run over it again with a bit more detail.&lt;br&gt;
Firstly, the 'A' stands for 'address' and according to &lt;a href="https://support.dnsimple.com/articles/a-record/" rel="noopener noreferrer"&gt;DNSimple&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An A record is used to find the IP address of a computer connected to the internet from a name.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When someone goes to a web address, the A record acts as a signpost and points the request to the IP address which is in the value of the record. To create a new A record you need to choose 'A' as the type from the dropdown and define either '@' or the subdomain name you wish you point to an IP in the &lt;em&gt;host&lt;/em&gt; and then the IP in question in the &lt;em&gt;value&lt;/em&gt; field. For example, if you have a site called myblog.com and you want a subdomain which you use for development called dev.myblog.com then you can use an A record to define it by putting "dev" into the &lt;em&gt;host&lt;/em&gt; field and adding the IP of the server where your code is into the &lt;em&gt;value&lt;/em&gt; field.&lt;/p&gt;

&lt;h2&gt;
  
  
  CNAME
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CNAME&lt;/strong&gt; (Canonical Name) records can be used to alias one name to another. A CNAME record has to point to another domain and should never point to an IP address. If you take domain.com and &lt;a href="http://www.domain.com" rel="noopener noreferrer"&gt;www.domain.com&lt;/a&gt; as examples then, domain.com would have an A record that points it to an IP whereas &lt;a href="http://www.domain.com" rel="noopener noreferrer"&gt;www.domain.com&lt;/a&gt; would have a CNAME record with the &lt;em&gt;value&lt;/em&gt; domain.com or '@' (remember this symbol points to the domain that you are currently working with).&lt;/p&gt;

&lt;h2&gt;
  
  
  TXT Records
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TXT&lt;/strong&gt; Records are more or less just a way to store extra data in the DNS or a domain. They allow a kind of key/value store at the domain level and are useful when using your domain with 3rd party services. Online services like &lt;a href="https://www.mailgun.com/" rel="noopener noreferrer"&gt;Mailgun&lt;/a&gt; (a great tool for email management) or &lt;a href="https://firebase.google.com/" rel="noopener noreferrer"&gt;Firebase&lt;/a&gt;(great for serverless app development and data storage) may ask you to add these records to your DNS to make sure that you own the domain. This way they can query the DNS and look for the TXT record that they're after.  &lt;/p&gt;

&lt;h2&gt;
  
  
  MX Records
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;MX&lt;/strong&gt; (mail exchange) records are used to tell email delivery agents where to deliver emails to. In other words, these are what you need to configure in order to be able to use a domain in an email address.&lt;br&gt;
Systems like &lt;a href="https://www.mailgun.com/" rel="noopener noreferrer"&gt;Mailgun&lt;/a&gt;, &lt;a href="https://google.com/" rel="noopener noreferrer"&gt;Google&lt;/a&gt; and other email providers talk you through the process of configuring these when you set up a new email domain.&lt;br&gt;
You can supply multiple different MX records, as you can with all DNS records, but the difference here is that you can specify a priority level. The priority level means that if the MX record with the highest priority fails to send the email, then it will try the record with the next highest priority and so on. If all of them fail then the email doesn’t send.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;That just about does it for a quick intro to DNS and the most commonly used records. There's plenty more that can be said about DNS (most of which I don't even know yet) but at the very least I hope you've come away from this knowing more than you did when you started reading. If there are any questions or you just want to say 'hi' then leave a comment below! If you're interested in more of this content then let me know and give me a follow on twitter &lt;a href="https://twitter.com/allmanajD" rel="noopener noreferrer"&gt;@allmanajD&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dns</category>
      <category>sysadmin</category>
      <category>dev</category>
      <category>ip</category>
    </item>
    <item>
      <title>Sys-Admin for Web Devs (File Permissions)</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Tue, 23 Apr 2019 17:48:12 +0000</pubDate>
      <link>https://dev.to/allmanaj/linux-sys-admin-for-web-devs-file-permissions-lo</link>
      <guid>https://dev.to/allmanaj/linux-sys-admin-for-web-devs-file-permissions-lo</guid>
      <description>&lt;h1&gt;
  
  
  Sysadmin can be a tough nut to crack
&lt;/h1&gt;

&lt;p&gt;It's something that we all come across at one point or another so I thought why not try to de-mystify the basics a little bit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fundamentals
&lt;/h2&gt;

&lt;p&gt;When it comes down to it, all files and directories on a server have a few things in common:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They belong to a user&lt;/li&gt;
&lt;li&gt;They belong to a group&lt;/li&gt;
&lt;li&gt;They have access permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are 3 types of permission which a user can have for a file/directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read - The file can be read&lt;/li&gt;
&lt;li&gt;Write - The file can be written to&lt;/li&gt;
&lt;li&gt;Execute - The user can execute the file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are also 3 different groups of users in terms of their relationship to the file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;owner&lt;/em&gt; of the file&lt;/li&gt;
&lt;li&gt;The &lt;em&gt;group&lt;/em&gt; of users who can access the file&lt;/li&gt;
&lt;li&gt;The rest of the world&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
   What this actually means
&lt;/h2&gt;

&lt;p&gt;Typing &lt;code&gt;ls -la&lt;/code&gt; in almost any directory will show you all of this information. It will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rwxrwx--- 2 admin dev-team 4096 Apr 23 06:22 file-for-my-group
drwx------ 2 admin admin    4096 Apr 23 06:21 my-private-files
drwxrwxr-x 2 admin admin    4096 Apr 23 06:21 public-files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've set up this example to show file/directory permissions and users/groups.&lt;/p&gt;

&lt;p&gt;That long sequence of letters breaks down the permissions which each user has for (in this case) that directory.&lt;/p&gt;

&lt;p&gt;This breaks down into 4 groups of file permissions. As an example, let's take a look at the permissions of the &lt;code&gt;public-files&lt;/code&gt; directory and break it down:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;drwxrwxr-x&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;d&lt;/code&gt; shows that the file is a directory (a normal file will just have a dash in this first spot)&lt;/li&gt;
&lt;li&gt;The following 3 letters (&lt;code&gt;rwx&lt;/code&gt;) shows that the user who &lt;em&gt;owns&lt;/em&gt; the file can read from, write to, and execute the file&lt;/li&gt;
&lt;li&gt;The second set of 3 letters (again &lt;code&gt;rwx&lt;/code&gt;) shows that all users in the same group as the file can read from, write to, and execute the file&lt;/li&gt;
&lt;li&gt;The final 3 characters (&lt;code&gt;r-x&lt;/code&gt;) shows that all other users (those who aren't the owner or in the group) can only read from and execute that file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, it looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7ug6fAfR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wbegzc9vjahyhs6nhy87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7ug6fAfR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wbegzc9vjahyhs6nhy87.png" alt="File Permissions Breakdown Diagram" width="640" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing Permissions
&lt;/h2&gt;

&lt;p&gt;Now that we know how the server knows what we can and can't access, let's look at changing it.&lt;/p&gt;

&lt;p&gt;Remember the example from before?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rwxrwx--- 2 admin dev-team 4096 Apr 23 06:22 file-for-my-group
drwx------ 2 admin admin    4096 Apr 23 06:21 my-private-files
drwxrwxr-x 2 admin admin    4096 Apr 23 06:21 public-files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say that I now want anyone who's not in the correct group to access the &lt;code&gt;file-for-my-group&lt;/code&gt; document. At the moment, you can see that people outside of the group cannot read, write, or execute this file, but I now want to allow anyone to be able to read it.&lt;/p&gt;

&lt;p&gt;I would use the &lt;code&gt;chmod&lt;/code&gt; command to do this. This command takes several arguments which looks as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod [options] [permission] [file to change]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By &lt;code&gt;permission&lt;/code&gt; I mean a sequence of 3 numbers which denotes the access levels and the information that we've been through above. We make this code by assigning each of the different permissions (read, write and execute) a number&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read - 4&lt;/li&gt;
&lt;li&gt;write - 2&lt;/li&gt;
&lt;li&gt;execute - 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I want to read, write and execute the file, the number used will be&lt;code&gt;7&lt;/code&gt;&lt;br&gt;
(4 + 2 + 1). If I only want to allow reading and execution, the number will be &lt;code&gt;5&lt;/code&gt; (4 + 1) and, logically, if I don't want to allow any of the above the number will be &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Knowing this, we can now assemble the three numbers we need in order to denote these new permissions. If I want the owner to have full access (&lt;code&gt;7&lt;/code&gt;), the group to have full access (&lt;code&gt;7&lt;/code&gt;) and the rest of the world to only have read access (&lt;code&gt;4&lt;/code&gt;) then the number will be &lt;code&gt;774&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To use this in the case of the chmod command it will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 774 file-for-my-group
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;And there we have it! A brief rundown of how server permissions work on Linux systems. There is much more depth to go into (security risks, making entire directories inaccessible, and changing the permissions of an entire directory of files etc.) but this was just meant to be an introduction to get you up and running with Linux and how its files work. Any questions or comments at all leave them down below!&lt;/p&gt;

</description>
      <category>sysadmin</category>
      <category>linux</category>
      <category>server</category>
      <category>dev</category>
    </item>
    <item>
      <title>How to Deploy a Django Site in 2022</title>
      <dc:creator>Angus Allman</dc:creator>
      <pubDate>Mon, 22 Sep 0003 00:00:00 +0000</pubDate>
      <link>https://dev.to/allmanaj/how-to-deploy-a-django-site-in-2022-3938</link>
      <guid>https://dev.to/allmanaj/how-to-deploy-a-django-site-in-2022-3938</guid>
      <description>&lt;p&gt;It’s a confusing place out there. You’ve built a great site with Django and the next step is getting it in front of people… but where to start?&lt;/p&gt;

&lt;p&gt;A quick google of “Deploy Django Site” shows a whole host of responses and so today I’m going to try and break down the main ones and my personal favourite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Heroku
&lt;/h2&gt;

&lt;p&gt;Firstly, there’s one of the biggest names in the deployment space: &lt;a href="https://www.heroku.com/"&gt;Heroku&lt;/a&gt;.&lt;br&gt;
Heroku offers hosting solutions on their servers and is mostly managed through the terminal. They are tried and tested industry-level hosting perfect for professionals. &lt;/p&gt;

&lt;p&gt;Heroku offers free plans as well as a very flexible pricing model allowing the user to pay for only what is used.&lt;/p&gt;

&lt;p&gt;While this is an elegant solution for some, it’s daunting for people who haven’t got much exposure to the command line and tutorials online can be unclear, in my experience. &lt;/p&gt;

&lt;h2&gt;
  
  
  Digitalocean Marketplace
&lt;/h2&gt;

&lt;p&gt;Up next is &lt;a href="https://digitalocean.com"&gt;DigitalOcean&lt;/a&gt;. DigitalOcean offers a solution in their Marketplace which creates a new &lt;a href="https://marketplace.digitalocean.com/apps/django"&gt;“Django Droplet”&lt;/a&gt; for you in their system, allowing you to upload your site to their containers, configure it and deploy. &lt;br&gt;
This is a great solution for those who are comfortable with the command line and managing linux systems but, let’s be honest, it’s no mean feat to learn all you need to know about managing linux servers through the terminal.&lt;br&gt;
This solution is also a one-time thing. It spins up the droplet for you and that’s it. Any further systems administration which is needed is done manually which can be time-consuming and confusing (I’ve been there). &lt;/p&gt;

&lt;p&gt;The cost for the droplet is no more than a regular DigitalOcean droplet with all the same options, however, it’s worth noting that these "Django Droplets" can only be spun up in the San Francisco data center which may not be ideal for some users in other parts of the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  PyHost
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pyhost.io"&gt;PyHost&lt;/a&gt; offers a comprehensive system for deployment &lt;em&gt;and&lt;/em&gt; system management.&lt;/p&gt;

&lt;p&gt;The system allows users to create a server on DigitalOcean in any of their available data centers. It’s also possible to manually connect a VPS from another provider as long as it’s the correct OS and version (Debian 11). PyHost dynamically generates and runs scripts on your server, in addition to server setup like DigitalOcean provides, it also allows deploying of individual sites from Github, Bitbucket and Gitlab. If you don’t want to you’ll never have to access your server’s command line to get a simple site up and running. You are able to create new databases and manage users, get 1-click SSLs for your sites and configure environment variables through the system’s UI.  Extensive documentation is available &lt;a href="https://docs.pyhost.io"&gt;here&lt;/a&gt; and will guide you through the whole process.&lt;/p&gt;

&lt;p&gt;You host the site yourself, maintaining all the power while never needing to bother with the terminal ( although that option is available, should you want it). Win/win!&lt;/p&gt;

&lt;p&gt;PyHost boasts a free plan which allows deployment of one site with an auto-generated subdomain, as well as paid plans with more flexibility and power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;In summary, there are lots of options available to the modern Django developer in 2022. Deployment is a confusing and often intimidating process that isn’t helped by the amount of choice on offer. &lt;/p&gt;

&lt;p&gt;If you are comfortable with the terminal and want something that does a few things well, then Heroku and DigitalOcean are your best bets. However, if you want to spend as little time worrying about systems administration as possible then PyHost is the one you want. I truly believe that PyHost takes the weight off the developer and allows them to focus on what matters to them, the code. So get out there and build amazing apps and don’t sweat about hosting anymore because PyHost’s got your back&lt;/p&gt;

</description>
      <category>deployment</category>
      <category>django</category>
      <category>python</category>
      <category>heroku</category>
    </item>
  </channel>
</rss>
