Threw together a self-hosted, simple, low-data URL shortener reddit / selfhosted ---------------------------------------------------------------------- ichdasich · 2023-12-24 02:10 Moin, TL;DR: Got frustrated with self-hosted options for url shortening. Wrote one myself: https://git.as59645.net/AS59645/shrtnr I just had a couple of people asking for a self-hosted url shortener; Going over the options was a choice between "aimed at user monetization" (most), a big behemoth including at least two REST APIs and something with json (far too many), or relatively small, but still a bit too complex for "last updated five years ago". Given that URL shortening is not really _that_ big of a feature set (input URL, get short link, bit of rate limiting; Ideally hand user accounts elsewhere), i figured it should be quick to write (while cobbling some frontend code from another code-base i had around). The result is 'shrtnr'; A few really short PHP files (and could probably be much shorter if I knew what i was doing). So, if anyone else is also looking for a similarly simple self-hosted URL shortener (or wants to send patches... ;-P), here it is: https://git.as59645.net/AS59645/shrtnr ---------------------------------------------------------------------- chin_waghing · 2023-12-24 03:08 I just realised you’ve got your own AS number. Can you elaborate on that? Got a blog post? ---------------------------------------------------------------------- apbt-dad · 2023-12-24 04:06 For people like me... What is an "AS number"? ---------------------------------------------------------------------- a_sugarcane · 2023-12-24 04:48 Found this info about "AS number" > An Autonomous System (AS) is a group of one or more IP prefixes (lists of IP addresses accessible on a network) run by one or more network operators that maintain a single, clearly-defined routing policy. Still not sure how it helps or works. ---------------------------------------------------------------------- ichdasich · 2023-12-24 08:08 https://doing-stupid-things.as59645.net/ << Blogged a bit there; Lately, I was a bit busy, though... so as all blogs go... it's a bit silent. ;-) ---------------------------------------------------------------------- ichdasich · 2023-12-24 08:09 It basically means that i took "this selfhosting thing" a bit too far. ;-) I basically have my own self-hosted piece of the Internet. Own IP address blocks, own servers in rented racks etcetc. ---------------------------------------------------------------------- Simon-RedditAccount · 2023-12-24 16:21 Should probably get IANA PEN as well for OIDs. ---------------------------------------------------------------------- Simon-RedditAccount · 2023-12-24 16:22 I feel you. Sometimes everything on awesome-selfhosted is over- engineered. This is why I wrote my own bookmarking tool. All it does is accepting the url via several methods, and displaying the list (with a removal option, ofc). Works perfectly with iOS shortcuts btw. ---------------------------------------------------------------------- linuxmel · 2023-12-24 16:59 Possibly of this in docker-compose? Great work thanks for sharing. ---------------------------------------------------------------------- ichdasich · 2023-12-24 19:05 Yeah... it is just a trend. Just moremoremore... and often _very_ simple things are... just so fast, easy to audit... and do _exactly_ what they are supposed to do. But,... no iOS here (except for the occasional IOS; But also not proud of that. ;-P) I already feel bad enough for going back to Linux due to better hardware/software support/performance... :-| ---------------------------------------------------------------------- Simon-RedditAccount · 2023-12-24 19:16 > often very simple things are... just so fast, easy to audit... and do exactly what they are supposed to do. Unix philosophy :) ---------------------------------------------------------------------- ichdasich · 2023-12-24 19:27 Uff... so... there are two answers to this; At least with my reading of the question being "do you have a docker-compose.yml you could share?" One answer is a bit longer, one a bit shorter; Please take both of them as being spoken in a friendly tone and with a grain of salt... and most certainly as encouragement. :-) If they don't sound like encouragement, are overly bleak, or i misread you question, I'd like to apologize in advance. :-) The long one: When I am not doing fun things with network connected systems, I actually consider myself kind of a scientist myself(tm). I spend the past decade on research about _how_ the Internet (and more generally: digital infrastructure) works; From humans to technology, the full stack. The gist of the story is: - We are moving towards a ton of shit, and the constant addition of layers upon layers of abstraction does not really help with building more maintainable systems (Fiebig, Tobias, and Doris Aschenbrenner. "13 propositions on an Internet for a" burning world"." Proceedings of the ACM SIGCOMM Joint Workshops on Technologies, Applications, and Uses of a Responsible Internet and Building Greener Internet. 2022, https://dl.acm.org/doi/pdf/10.1145/3538395.3545312 ) - The progressing cloudification, centralization, and abstraction of services leads to a degredation of capabilities to 'actually run stuff' throughout the industry (e.g., Fiebig, Tobias, et al. "Heads in the Clouds? Measuring Universities' Migration to Public Clouds: Implications for Privacy & Academic Freedom." Proceedings on Privacy Enhancing Technologies Symposium. Vol. 2023. No. 2. 2022, https://petsymposium.org/popets/2023/popets-2023-0044.pdf ) And docker, in my personal opinion, is very much one of those tools that _does_ have its uses; Eradication of system specific state. Awesome. However, it is also one of those things often "held wrong", limiting the learning curve of those holding it. At the same time, while I am 100% certain that this codebase will be a breeze to containerize (start mysql container with autoprovisioned DB, start two containers for the two domains, put auth proxy (fourth container?) in front that hands through the X_USER variable to the PHP process... as easy as it gets), it is not something i personally need (my IaC is based on puppet, and applications are often not deeply put into IaC due to the often deeply ingrained updated mechanics anyway [wordpress, nextcloud,... :-|], containers are only there where they are _really_ useful [helloooo only office...]) So, creating a docker compose is certainly something possible, but nothing _I_ would do; I simply don't need it. However, if you can do so, and would like to, I would be more than happy to include a docker-compose.yml you created into the repo (or you can fork it and make the more awesome version of this; It is 3c BSD for a reason ;-)). If you can not create a docker-compose yourself; Well, then given the state of the world I would strongly suggest you give it a shot; Not only for the sake of your own skill set, but because the world will need more people who can do things end-to-end in the future. And the future won't be bright. We need more engineers like you. The specific app is as simple as it gets (beyond any funny hello worold tool); So try, it will be fun .oO( I hope... :-)), and it is a rather simple case to start with. The short answer: See the FAQ, Point 2. ;-) ---------------------------------------------------------------------- ichdasich · 2023-12-24 19:35 Nah, who needs OIDs, SNMP is for old people, people using (L)DAP,... so, in general, people with a tendency of overdoing things... (like me... i guess... ) ---------------------------------------------------------------------- Simon-RedditAccount · 2023-12-24 20:28 Wait until you start spinning [your internal CA](https://www.reddit.co m/r/selfhosted/comments/18pu8la/comment/keqz1q1/?context=3), cannot do it *in a fancy way* 🧐 without OIDs `/s`. ---------------------------------------------------------------------- ichdasich · 2023-12-24 20:33 Yeah, I am mildly crazy (depending on the person heavily crazy), but certainly not THAT crazy. ;-P ---------------------------------------------------------------------- MartinDamged · 2023-12-25 00:15 I personally don't like URL shortings! I want to be able to see the full URL. ---------------------------------------------------------------------- ichdasich · 2023-12-25 01:28 Oh, you will like this one then; It does not straight out send you to the target URL (for the obvious security reasons you are hinting at); Instead, you get to a page saying: ``` This short URL wants to send you to: https://example.com/ | Take me there! | # << this is a clickable button (You can also just copy it and paste it into your browser!) ``` ---------------------------------------------------------------------- ichdasich · 2023-12-25 01:32 .oO( and if you're now wondering why use a shortener at all then... well, for example when doing an (online) talk, a ~15 character URL is a lot nicer to type off of a BBB session than the full deep-link for $etherpad/$.../$whatever_service. ;-) )