6 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

9 comments

  1. tomf
    Link
    I dipped my toes into python for the first time. I've modified stuff before, but this was the first from near-scratch. Its an F1 plugin for Limnoria (irc bot.) It pulls all of these for all years...

    I dipped my toes into python for the first time. I've modified stuff before, but this was the first from near-scratch. Its an F1 plugin for Limnoria (irc bot.)

    It pulls all of these for all years available with the API

    • calendar
    • champ standings
    • constructor standings
    • gp - grand prix results + fastest lap
    • race - the next race

    Tonight I need to figure out how to check if the argument (?) is either blank or within a certain range so I can throw a better error back. e.g. if they enter @gp 40, it should tell them to either return a blank or a number between 1-22.

    I doubt I'll be doing AOC with python this year, but who knows.

    5 votes
  2. [4]
    FluffyKittens
    (edited )
    Link
    I've got a side project (web service) that's nearing launch, but before I go live, my immediate goal is to get my shit together infrastructure-wise, as my dev setup is a bit of a mess. For...

    I've got a side project (web service) that's nearing launch, but before I go live, my immediate goal is to get my shit together infrastructure-wise, as my dev setup is a bit of a mess. For context, each environment is hosted as its own VPS instance, running a whole Postgres/Flask/Caddy stack on one Debian box. I have a shell script with commented notes partially outlining how I set up the environments, but it's far from complete, and has a lot of manual steps to it. I'm also manually rsyncing code changes over to each box, and (re)starting the Flask app + my background ETL script on the server manually.

    Questions:

    1. How rough is the learning curve on Ansible? Timewise, am I better off fleshing out a full bash solution, or cramming the Ansible docs then cobbling together some existing playbooks if I want a start-to-finish "New Server Setup" solution?
    2. What are options on remotely deploying my code automatically? I've cobbled together my own version of this post-receive hook fiesta in the past, but not crazy about it.
    3. To launch the ETL script and web app automatically, I presume systemd service files are the move?
    4. If going with systemd service files, I presume I also need to make service accounts so my Python code isn't running as root. Never had to do that myself before - anything required beyond useradd --system <account name>?
    3 votes
    1. [2]
      archevel
      Link Parent
      I read this blog: https://blog.danslimmon.com/2019/07/15/do-nothing-scripting-the-key-to-gradual-automation/ about do-nothing-scripts to gradually automate repetetive tasks and I find the approach...

      I read this blog:
      https://blog.danslimmon.com/2019/07/15/do-nothing-scripting-the-key-to-gradual-automation/

      about do-nothing-scripts to gradually automate repetetive tasks and I find the approach makes a lot of sense. It provides good documentation and can mix both manual and cleanly automated steps. Ansible et al. might be a better approach longterm if tou have a larger team working on many different things, but to me it seems overkill for a side project (unless you are already comfortable with it or just want to learn it).

      As for deploying code, most continous integration systems have a bunch of plugins for this kind of thing. It is kind of dependnet on your infrastructure. I'm sure e.g. github actions could be used to trigger a deploy.

      useradd --system <account name> seems to be the way to go when adding the service accounts. Creating these could go into your do-nothing-script :)

      5 votes
      1. FluffyKittens
        Link Parent
        Thanks so much for the response - very helpful on all fronts!

        Thanks so much for the response - very helpful on all fronts!

        2 votes
    2. silfilim
      Link Parent
      Some two cents on 1. and 2.: I'd say the learning curve is on the shallower side for stuff like installing packages and creating directories and users. Setup required is minimal: no need to run...

      Some two cents on 1. and 2.:

      1. I'd say the learning curve is on the shallower side for stuff like installing packages and creating directories and users. Setup required is minimal: no need to run any agents on the remote servers, just be able to SSH in and have Python installed. The official reference for the builtin modules lists lots of configurable parameters for each module, but you can probably get by with just looking up a handful that's needed to do what you want.
      2. You need something that triggers the automatic deployment, and something that carries out the deployment. For the trigger, GitHub Actions would also be what I'd reach for. For the deployment process itself, Fabric is a nice abstraction for working with remote servers. It gives you primitives for connecting to a remote server (or a group of them), running commands on them, and/or transferring files to them, and so on. Looks like there are GitHub repos that use this combo of GitHub Actions and Fabric :D
        • Going a step further, creating separate directories for each version of the code and symlinking to the latest one will give clean separation of versions and easy rollback - Capistrano-style as some may call it. (The linked repo is a bit old. May or may not work with the latest version of Fabric.)
      3 votes
  3. [3]
    Bullmaestro
    Link
    Does anybody have any advice or good books/guides on building a database driven website? My last foray into website programming was a sixth form computing project where I built a site using MySQL,...

    Does anybody have any advice or good books/guides on building a database driven website? My last foray into website programming was a sixth form computing project where I built a site using MySQL, PHP and HTML. But that was fifteen years ago.

    I feel like I want to try my hand at building a lightweight social news aggregator of my own. This may be a big first project...

    2 votes
    1. FlippantGod
      Link Parent
      BCHS sounds like a good place to start. Just substitute your own components. Python's cgi server is really convenient, so HTML, SQLite, Python is a good starting point. Plus, Python might make it...

      BCHS sounds like a good place to start. Just substitute your own components. Python's cgi server is really convenient, so HTML, SQLite, Python is a good starting point. Plus, Python might make it easier to transition off of cgi and into more modern practices down the road.

      3 votes
    2. FluffyKittens
      Link Parent
      LAMP stack still works fine, especially for a small, homemade news aggregator! My advice would be to start building off the existing skills you know, and progressively add in new tools that...

      LAMP stack still works fine, especially for a small, homemade news aggregator! My advice would be to start building off the existing skills you know, and progressively add in new tools that interest you.

      The easiest next step from basic LAMP to a more modern setup would be moving from inline PHP to Laravel for the interactive portions of your site. If frontend seems like your thing, you can try out Tailwind, React, or even build up a solid base of vanilla JS knowledge.

      Alternatively, if you’re looking for a more all-in-one, gold standard, greenfield solution and don’t mind ditching PHP, Python’s Django framework is known for having really good documentation and a solid developer experience (though expect a several week learning curve). Like Laravel, it’s the sort of tool that will stick around for the next twenty years, and learning Python will probably give you greater ROI when it comes to day-to-day computing activities than will PHP.

      3 votes
  4. acdw
    Link
    I just wrote a quote of the day server in scheme last night. It's an old protocol defined by RFC 865, and was pretty easy to write--- most of my struggles were figuring out libraries and stuff,...

    I just wrote a quote of the day server in
    scheme
    last night. It's an old protocol
    defined by RFC 865, and was pretty easy to write--- most of my struggles were
    figuring out libraries and stuff, since I'm new to chicken. Was fun though!

    You can see my QOTD by

    nc acdw.net 17
    
    2 votes