• 0 Posts
  • 47 Comments
Joined 1 year ago
cake
Cake day: July 28th, 2023

help-circle
  • Anafroj@sh.itjust.workstoSelfhosted@lemmy.worldCost-cutting tips?
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    1 year ago

    That’s the same thing. :) If you reduce computing load, you reduce the need for costly hardware and you reduce the need for energy, thus you reduce the amount of money needed to build and run your setup. There’s a saying in (software) engineering : “reducing energy consumption and increasing performances requires the same optimizations”. Make your code faster (by itself, not by buffing up hardware) and it consumes less energy. Make your application simpler, and it will run faster, and it will consume less energy. It’s not an absolute truth (it sometimes happen that you make your code faster and it consumes more energy), but it’s true most of the time.


  • Anafroj@sh.itjust.workstoSelfhosted@lemmy.worldCost-cutting tips?
    link
    fedilink
    English
    arrow-up
    13
    ·
    edit-2
    1 year ago

    Basically, yes. You can configure most cron programs to mail task output to you (it’s usually done by setting the MAILTO variable in the crontab, provided sendmail is available on your system).

    I use that to do things like:

    0 9 11 10 * echo 'lunch with John Doe at 12:20'
    

    It sends me a mail, and I can see the upcoming events with crontab -l. If it’s not a recurring event, I then delete the rule.


  • Anafroj@sh.itjust.workstoSelfhosted@lemmy.worldCost-cutting tips?
    link
    fedilink
    English
    arrow-up
    24
    arrow-down
    2
    ·
    1 year ago

    My favorite cost cutting tip is to avoid big webapps running on docker, and instead do with small UNIX utilities (cron instead of a calendar, text files instead of note taking app, rsync instead of a filehosting dropbox-like app, simple static webserver for file sharing, etc). This allows me to run my server on a simple Raspberry Pi, with less than 500mb of used RAM in average, and mininal energy consumption. So, total cost of the setup:

    • Raspberry Pi : 77€ x 2 = 144€ (I bought two to have a backup if the first one fails)
    • MicroSD 64gb : 13€ x 2 = 26€ (main and backup)
    • average energy consumption : 0.41€ (2kWh) per month

    With that, I run all services I need on a single machine, and I have a backup plan for recovery of both hardware and software.

    Getting used to a UNIX shell and to UNIX philosophy can take some time, but it’s very rewarding in making everything more simple (thus more efficient).



  • “Git hosting” would be more appropriate. Unless that by frontend, you mean specifically web frontend, but that would be weird, because forges also provide the web backend part.

    Sourceforge was the biggest FOSS host in the 2000s, before GitHub (mainly because there was not much centralization to begin with). That train is long gone. :) Sure, the name and website Sourceforge still exist. Myspace, Digg and Yahoo do too. They are basically web ghosts, only an echo of what they once were.


  • Actually, I do use git bare repos for CD too. :) The ROOT/hooks/post-update executable can be anything, which allows to go wild : on my laptop, a push to a bare repos triggers deploy to all the machines needing it (on local or remote networks), by pushing through ssh to other bare repos hosted there, which builds and installs locally, given they all have their own post-update scripts ; all of that thanks to a git push and scripts at the proper paths. I don’t think any forge could do it more conveniently.

    For me the main interest of forges is to publish my code and get it discovered (before GitHub, getting people to find your repos hosted on your blog’s server was a nightmare). Even for the collaboration, I could do with emails. That being said, most people aren’t on top of their inbox, in which mails from family are mixed with work mails and commercial spam in one giant pile of unread items, so it’s a good thing for them we have those issue trackers.







  • Take back the control on your data, that’s the whole point… :) Where are you regularly saving data? Those are the prime candidates. Look at self-hosted alternatives for those services. I know big webapps hosted in docker containers managed by kubernetes is all the rage around here, but you can often find Unix style equivalent for such services, the main advantage of putting it on a server being to be able to access it from multiple devices. But you do you, if you prefer hosting big webapps, that’s fine too. :)


  • I organize my crontab by having group of tasks (the programs, the holidays, the housecleaning, etc). And of those groups, the events (the non recurring tasks) come last. So I just list the crontab (crontab -l) and the list of things to come print to the screen, that block being at the end of the file. It’s hard to do better than a text file to list things. :)

    I don’t know if there is a program that lists like “what is coming this month” if you really want to filter out the rest, but it should be easy enough to write, given the format of cron rules:

    crontab -l | grep '*' | awk '{print $4 "," $3 "," $2 "," $1 " " $0 }' | sort -n | grep -E "^$(date '+%-m')"
    
    • crontab -l : list the crontab
    • grep '*' : keeps only rules (removing blank lines and comments)
    • awk […] : print the whole line ($0), prepend by the 4th field (the month), the 3rd (the day), the 2nd (the hour) and the 1st (the minutes)
    • sort -n : sort everything numerically, so that all tasks are now in their execution date order (I made awk seperate the fields with a , character so it keeps sorting numerically past the first number)
    • date '+%-m : prints the current month, not zero padded (thanks to the ‘-’)
    • grep -E '^date' : keep only lines which starts with the current month number

    You put that in a script (like ~/bin/upcoming_events) and you’re done. And then, you can call it from cron every monday get what’s coming next mailed to you. :)

    This could but refined further to display dates in a more friendly format. But as usual, Unix is your friend. :)


  • I’m going to pass for the crazy person around, but so be it : cron.

    Cron can be easily configured to send mails (MAILTO variable when using standard cron), provided sendmail is available on the system. If a command called by cron outputs anything, it will send a mail with the content, which is useful by itself to warn when something goes wrong with a cron task, but also allows to do things like this:

    0 9 28 9 * echo birthday John
    

    It’s really easy to get used to the syntax, it’s just going from more precise to less precise, so it’s “minute, hour, day, month, *”. The last one can usually be ignored (it’s the day of the week, I must have used it twice in my life). So here, “0 9 28 9”, you read it backward and it gives : September, 28th, 9:00. Piece of cake when you get a bit of practice. And cron is everywhere, so no need to install anything. Although, since I run it on my laptop, I use fcron, which has a nice feature to run ASAP tasks which should have ran if the computer was not shut down. This way, I never miss an alert.

    I use it for recurring notes (like birthday, paperwork, house cleaning tasks, holidays, etc), but also as reminders of specific dates when I expect a delivery, have a meeting, etc. For the most important messages, I make it use a script that will make a destkop notification (with notify-send) and have a voice read the message (with mimic). And of course, I also use it to actually launch programs. :)





  • Anafroj@sh.itjust.workstoSelfhosted@lemmy.worldMy own mail server
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I do have to say for the purpose of tinkering I love these bigger projects because you learn so much on the way. Now having read your answer I am even more exited to try it out :D

    That’s awesome to hear! Welcome, and have fun! :)

    I haven’t heard of most of your abbreviations/term till now

    Oh, my apologies. Here is a definition list :

    • SMTP : Simple Mail Transfer Protocol : the base of any mail system, it’s the server you contact to send emails, which relays your mail to an other SMTP server (where your contact is hosted), which stores the mail for user to retrieve
    • IMAP : Internet Message Access Protocol : one of the protocols that can be used to retrieve emails from your mailserver (the other one being POP3)
    • SPF : Sender Policy Framework, a configuration on your domain name specifying which machines are allowed to send mails in its name
    • DKIM : DomainKeys Identified Mail : a signing process (signing each mail) to validate the “From” email address is indeed authorized from the domain it pretends to
    • DMARC : a warning system to let you know when someone pretended to be you (also giving instructions about what to do with emails when SPF and/or DKIM are missing or wrong)

  • I guess slapping it on my local raspberry pi wouldn’t be enough no?

    Oh no, that would be way not enough. :) Managing a mailserver is a sysadmin task by itself. While you don’t need to do much once it works (which often is a perk of sysadmin work, compensating for the fact that when it does not work, they may have to wake in the middle of the night to fix it), it’s notoriously difficult to get right : you have the configuration of the mailserver to get right first, so that you can send emails, but nobody else can and you don’t become a spam relay without knowing it. Then you have a lot of configuration to do to be able to retrieve your emails from your server, which uses other protocols that you must learn about. Then you have “optional” things that you must setup (SPF, DKIM and DMARC), which you won’t be able to send mails to gmail or outlook if you don’t set them up properly. And when you will have got all of that right, you will have enough experience to be hired as a sysadmin. :)

    I can’t provide a good resource for learning it, I learned it 15 years ago when it was way more simple (before SPF and DKIM), and picked every addition as they appeared, but any course on how to manage a mail system will do. There is no difference in doing it for your self-hosted server and for a company (except maybe that for a company, they’ll make you handle users in a database, which you can forego for your own needs). I would recommend to learn how to use postfix first, then any imap server (courier-imap is a top runner), and when you’re comfortable with that, you can learn about SPF, then DKIM, then DMARC. But be aware before going through it that this is basically learning a new skill (sysadmin). You can find docker images that setup everything automatically for you, but I would recommend against that, because at some point, things will break and you will have no idea how to fix them. And if you try to fix them while not knowing well what you’re doing, that’s a good way to end up being a spam relay. Plus, those docker images are difficult to customize, which quite defeats the point of managing your own mail system to begin with.


  • Anafroj@sh.itjust.workstoSelfhosted@lemmy.worldMy own mail server
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    1 year ago

    Well I didn’t want google to read my mails

    Sadly, it only works if no one in the recipients of the mail is on gmail (or if everyone use pgp, which I would tend to think is even more rare).

    I host my own mailserver as well, and I would add as benefits:

    • creating as many email address as you want easily, possibly regexp based address (awesome to give every site a different address and know where the spam comes from, without using the well known schema username+something@host). That also makes routing/filtering mails way more easy, you just have to match the recipient address.
    • delivering mails to software, to put email at the center of interapps messaging (basically, that means that postfix pass a matching email to the executable of your choice on your system instead of storing it in your mailbox)
    • advanced rules for handling emails. When I want to block a spammer that managed to get my real email, I use regexps to match their mails and reject it with a “REJECT 5.1.1 Recipient address rejected: User unknown in local recipient table” error, imitating the error for unknown users, which often triggers a mail system to remove your address from their database
    • easily configure apps to send me email. When I write an application that will send emails to me and only me, I configure it to use my smtp on port 25 without authentication instead of the usual smtps configuration they expect. It connects to it and asks to send a mail to me, which is accepted since I’m a local user. It makes everything way easier (try to do that with gmail and get your IP banned)
    • easy backups. Both of the mail system (I backup the whole sdcard of the pi) and of the emails. Never lose an email again.