In my role at Highland, I do a lot of things. Developing, light project managing, and some remote tech support since COVID kicked off. Near the end of last year, I also started helping with our DevOps practice. Since then, I’ve learned countless things assisting our DevOps guru, Stu.
在Highland担任职务时,我做了很多事情。 自从COVID开始以来,开发,轻型项目管理和一些远程技术支持。 去年年底,我也开始帮助我们进行DevOps实践。 从那时起,我学到了无数的东西来协助我们的DevOps专家Stu 。
Through my work with Stu and the DevOps team I’ve learned a little bit of this and a little bit of that, and at this point, I’m comfortable standing up a new LAMP server and connecting it to our different services. I’m also fairly proficient in Vim, which is something I never thought I would say.
通过与Stu和DevOps团队的合作,我学到了一些,甚至一点,在这一点上,我很乐意安装新的LAMP服务器并将其连接到我们的不同服务。 我也相当精通Vim ,这是我从未想过要说的。
So when I decided to set up a small server for a personal project, I thought it would be a piece of cake. I just needed to install a simple PHP application on a server. What could go wrong? I had done this before and on a bigger scale. Once I got into the setup, however, I found myself repeatedly hitting walls.
因此,当我决定为个人项目设置小型服务器时,我认为这简直是小菜一碟。 我只需要在服务器上安装一个简单PHP应用程序。 可能出什么问题了? 我以前做过,而且规模更大。 但是,一旦进入设置,我发现自己反复撞墙。
Try to set up the server? Hit a wall.
尝试设置服务器? 打墙。
Google my issue? Hit another wall.
Google我的问题? 撞到另一堵墙。
Try a new approach, hit a wall. Rinse, repeat.
尝试一种新方法,撞墙。 冲洗,重复。
![Old Google search bar collapsing from the top of the page, with all the text and images bouncing on the bottom of the screen](https://i-blog.csdnimg.cn/blog_migrate/602bcdb7e54bb648856fb8fec22b86dc.png)
目标:建立家庭管理ERP (The Goal: set up an ERP for household management)
I’ve been using BigOven for the past year to manage recipes and grocery lists. I like the structure, but the service hasn’t quite been doing it for me, and their API is fairly costly, so I couldn’t just make my own interface. I went looking for an alternative and I found Grocy.
过去一年中,我一直在使用BigOven来管理食谱和杂货清单。 我喜欢这种结构,但是该服务尚未完全为我完成,而且它们的API相当昂贵,因此我不能仅创建自己的接口。 我去寻找替代品,发现了Grocy 。
Grocy is definitely the maximalist approach to grocery and home management. Describing itself as an “ERP beyond your fridge,” it is a “web-based self-hosted groceries & household management solution for your home.” It mimics large scale enterprise resource planning, but for things around your house.
杂货店绝对是杂货店和家庭管理的最大方法。 自称为“冰箱外的ERP”,它是“针对家庭的基于网络的自托管杂货和家庭管理解决方案。” 它模仿大型企业资源规划,但适用于您家周围的事物。
Grocy has been under development for several years now and has several different useful modules. I’m particularly interested in chore management, which is a project I’ve attempted myself. Grocy is open source and has a robust API, so if I think any features are missing, I can add them myself, and I can integrate it with any other service. If this can’t fit all my needs, who knows what can.
Grocy已经开发了几年了,并具有几个不同的有用模块。 我对杂务管理特别感兴趣,这是我自己尝试过的一个项目。 Grocy是开源的并且具有健壮的API,因此,如果我认为缺少任何功能,可以自己添加它们,也可以将其与任何其他服务集成。 如果这不能满足我的所有需求,谁知道可以。
假设1:Google Cloud + Ubuntu + Nginx (Take 1: Google Cloud + Ubuntu + Nginx)
So now that I’ve decided to get myself a copy of Grocy, it is time to set up hosting and get it running. I started with nothing but a domain name that I hadn’t done anything with for years. I’d recently received an offer from Google for $300 worth of hosting, so thought I would start there with their Cloud Platform.
因此,既然我决定为自己准备一份Grocy副本,是时候设置托管并使其运行了。 我最初只是一个域名,多年来一直没有做任何事情。 我最近收到了Google提供的价值300美元的托管服务的报价,因此我想从他们的Cloud Platform开始。
- I set up DNS and point my domain to Google. All good so far. 我设置了DNS,并将我的域指向Google。 到目前为止一切都很好。
- I started working on a VM in Google’s Compute Engine, got it set to a static IP, connected it to my domain through DNS, and connected. 我开始在Google Compute Engine中使用VM,将其设置为静态IP,通过DNS将其连接到我的域,然后连接。
- I started installing the software I would need to run Grocy. 我开始安装运行Grocy所需的软件。
- … and this is where I started running into problems. ……这就是我开始遇到问题的地方。
At Highland, we use AWS for hosting, CentOS for the operating system, and Apache (httpd) for a web server. So of course when I was setting off on my own I decided to use Google Cloud for hosting, Ubuntu for the OS, and Nginx for the webserver! You know, because I hate myself or something. I realized fairly early on that Nginx doesn’t have a built-in PHP interpreter like Apache, so I started Googling for how to make that work. Next, I needed to figure out how to configure Nginx to serve Grocy specifically. Then I started to see comments in the Grocy issues on Github that would come to haunt me.
在Highland,我们使用AWS托管,使用CentOS操作系统,使用Apache (httpd)作为Web服务器。 因此,当我独自一人出发时,我决定使用Google Cloud进行托管,使用Ubuntu进行操作系统,使用Nginx进行网络服务器! 你知道,因为我讨厌自己或其他什么。 我很早就意识到Nginx没有像Apache这样的内置PHP解释器,因此我开始使用Googling来研究如何使之工作。 接下来,我需要弄清楚如何配置Nginx以专门服务Grocy。 然后我开始在Github上的Grocy问题中看到一些评论,这些评论会困扰我。
“If you’re little familiar with webservers in general (and use nginx) … this is really not a special application from the technical perspective.”
“如果您一般不熟悉Web服务器(并使用nginx)……从技术角度来看,这实际上不是一个特殊的应用程序。”
“I still think grocy is a pretty normal PHP application like most of the other ones out there, so a lot of different ways to setup the details.”
“我仍然认为grocy是一个非常普通PHP应用程序,就像其他大多数应用程序一样,因此有很多不同的方法来设置细节。”
I got the PHP interpreter set up, and tada! I can see my PHP test page. I downloaded a copy of Grocy, installed it in place and it started to give me its own warnings.
我安装了PHP解释器,然后tada! 我可以看到我PHP测试页。 我下载了一份Grocy副本,将其安装到位,然后它开始发出自己的警告。
At this point, I’m already giving Google Search a run for its money, but that is to be expected. Each time I received a new error or a missing package, I install, enable, and configure. But now I start having problems I can’t figure out. I start trying to update different Grocy configuration settings, I can’t figure it out. Is it my server? It must be! I must have done something wrong following all those tutorials. Sometime around here I gave up for the first night, thinking I’d wrap it up the next day.
至此,我已经开始努力争取Google Search的资金,但这是可以预料的。 每次收到新错误或缺少软件包时,我都会安装,启用和配置。 但是现在我开始遇到无法解决的问题。 我开始尝试更新不同的Grocy配置设置,但无法弄清楚。 是我的服务器吗? 肯定是! 在所有这些教程之后,我一定做错了什么。 在这里的某个时候,我放弃了第一个晚上,以为我第二天会把它包裹起来。
The next day, after attempting to solve the same problem, I reach a point where I decide to just start over. I had installed enough different things and played with enough configurations that I thought it would be good to have a fresh slate.
第二天,尝试解决相同的问题后,我决定重新开始。 我已经安装了足够多的东西,并且配置了足够的配置,我认为拥有一块新鲜的石板会很好。
![A person walks across their driveway carrying a trash bag with 2020 superimposed over it, and tosses it in the trash.](https://i-blog.csdnimg.cn/blog_migrate/513b71e53896ea208929dcfb96a73bb3.png)
范例2:Google Cloud + Ubuntu + Apache (Take 2: Google Cloud + Ubuntu + Apache)
Somewhere along the line, I found a Github Issue where someone had gotten the installation working with Apache, so I decide to give it a shot in a new direction. Of course, this means I have now lost any of the advice I’d already researched for Nginx, but this time it aligned with what I’m more used to using at work, so that should help. I got through the same process I have before, installing the necessary software, configuring the webserver. This time I also tried making sure I downloaded a stable release of Grocy. I found the most recent release and downloaded the prebuilt application. I installed whatever lingering dependencies there are.
在某个地方,我发现了Github问题,有人在其中安装了与Apache一起使用的安装程序,因此我决定朝一个新的方向进行尝试。 当然,这意味着我现在已经失去了我已经为Nginx研究的任何建议,但是这次与我更习惯于在工作中使用的建议保持一致,因此应该有所帮助。 我完成了与之前相同的过程,安装了必要的软件,配置了Web服务器。 这次,我还尝试确保下载了Grocy的稳定版本。 我找到了最新版本并下载了预构建的应用程序。 我安装了所有缠绵的依赖项。
I ran into the same problem, and I can’t figure it out. I toggle the same settings on and off. I tried to update configurations and I simply cannot figure it out!
我遇到了同样的问题,无法解决。 我打开和关闭相同的设置。 我试图更新配置,但我根本无法弄清楚!
![Google Cloud logs, spanning 24 entries over 3 and a half hours. Each entry shows the time, a wrench or warning, and descript](https://i-blog.csdnimg.cn/blog_migrate/67c798cdd553a4a43d644ec61f039743.png)
取3 —?:感觉徒劳(Take 3 — ?: Feeling futile)
At this point, I’m getting sort of desperate.
此时,我有点绝望了。
I’m moving too quickly. I keep creating VMs with the wrong name or wrong configuration.
我的动作太快了。 我一直使用错误的名称或错误的配置来创建VM。
I went back and took a look at Google Cloud’s logs, and I look like a crazy person. At some point, I finally set up a server using Centos + Apache(httpd) hoping that my work at Highland would help. I get to a point where I’ve decided that it can’t be my servers are the problem, it MUST be how I’m configuring Grocy.
我回头看了看Google Cloud的日志,看起来像个疯子。 在某个时候,我最终使用Centos + Apache(httpd)设置了服务器,希望我在Highland的工作会有所帮助。 我已经确定我的服务器可能不是问题所在,这一定是我配置Grocy的方式。
I see there is a version of Grocy pre-built as a Docker image! I can’t figure out a simple server, but surely bringing containers into the picture will help.
我看到有一个预先构建为Docker映像的Grocy版本! 我想不出一个简单的服务器,但是一定要把容器放入图片中会有所帮助。
拿N:这次的容器 (Take N: Containers this time)
Already having trouble, I decide that it makes sense to bring in another technology I have no familiarity with: Docker!
已经遇到麻烦了,我认为引入另一种我不熟悉的技术是有意义的:Docker!
Grocy has a Docker branch at grocy/grocy-docker and I decide that maybe it will already have the configuration built out enough that I can’t mess it up!
Grocy在grocy / grocy- docker上有一个Docker分支,我决定也许它已经具有足够的配置,以至于我无法搞砸!
I’ve heard of containers plenty and understand the concept, but I’ve never worked with one before. So I find myself again Googling:
我听说过很多容器,并且了解这个概念,但是我以前从未使用过。 所以我再次发现自己在谷歌搜索:
“Setting up containers Google Cloud”
“设置容器Google Cloud”
“Google Cloud docker”
“ Google Cloud泊坞窗”
I find a tutorial on Google that looks promising. I go about setting up all sorts of items I definitely don’t need, but sooner or later I have a Grocy image set up in the Google Cloud Container Registry and am ready to deploy. I keep following the tutorial and realize that somewhere along the line I have set up three large VMs running behind a load balancer and the Grocy configuration still isn’t working correctly. All I wanted was one tiny server!
我在Google上找到了一个很有前途的教程。 我打算设置各种我绝对不需要的项目,但是迟早我会在Google Cloud Container Registry中设置一个Grocy映像,并准备进行部署。 我一直遵循该教程,并意识到在生产线的某个地方,我已经建立了三个在负载均衡器后面运行的大型VM,而Grocy配置仍然无法正常工作。 我只想要一台小型服务器!
It’s somewhere around here that I give up again, and decide to take another look another day.
在这附近的某个地方,我再次放弃,决定改天再看一遍。
N + 1:从头开始 (Take N+1: Starting over from scratch)
I go back to where I started, at the Grocy repo, checking the README. That’s when I find something that gets me to facepalm so hard my hand came out the other side:
我回到开始的地方,在Grocy仓库中,检查README。 那是当我发现某种东西使我变得难以面对时,我的手从另一侧伸出:
![Screengrab that reads “See the website for further installation guides and troubleshooting help: http://grocy.info/links](https://i-blog.csdnimg.cn/blog_migrate/48caa174e45ef6d3000c30baf9c085e4.png)
There it is, a whole page of links with how-tos.
在那里,有一整页的链接与操作方法。
![Grocy’s list of community-contributed help. The author has added a red arrow pointing to the one he chose (Minimal Ubuntu)](https://i-blog.csdnimg.cn/blog_migrate/68d83c97029f5efba88fd67cd5c3272f.png)
I follow the guide almost to the letter and find myself finally seeing a login screen. I did it! I finally did it. This shouldn’t be as exciting as it is, but I’ve built it up for weeks.
我几乎按照指南进行操作,发现自己终于看到了登录屏幕。 我做的! 我终于做到了。 这应该不那么令人兴奋,但是我已经将它建立了几个星期。
设置其他内容(或我如何兑换自己) (Setting other things up (or how I redeem myself))
At this point, I needed to prove to myself that I actually know what I’m doing by setting up all sorts of things to improve the server for myself.
在这一点上,我需要向我证明自己实际上通过设置各种事情来改善自己的服务器而知道自己在做什么。
I set up Cloud Scheduler, set up to call Pub/Sub, and connected to Cloud Functions to turn the server on and off at night to save on some VM hours/cost. (I don’t know why this has to be so complicated but ¯\_(ツ)_/¯ .)
我设置了Cloud Scheduler ,设置为调用Pub / Sub ,并连接到Cloud Functions以在晚上打开和关闭服务器,以节省一些VM小时/成本。 (我不知道为什么它必须如此复杂,而¯\ _(ツ)_ /¯。)
I set up a headless Dropbox installation to backup the database from Grocy’s data directory and wrote a simple backup rotation script to save a few day’s worths of backups in case something goes wrong.
我设置了一个无头Dropbox安装,以从Grocy的数据目录中备份数据库,并编写了一个简单的备份轮换脚本,以在发生问题时节省几天的备份价值。
I even started a Magic Mirror² module to display information from Grocy’s API on a smart display. Somehow I had less trouble writing a new piece of software to integrate with existing software than just setting that up in the first place.
我什至启动了MagicMirror²模块,以在智能显示器上显示Grocy API的信息。 不知何故,我编写新软件以与现有软件集成的麻烦要比仅是首先进行设置就容易。
Finally, I was happy with my installation.
最后,我对安装感到满意。
优先考虑终身学习 (Prioritizing life-long learning)
In this industry, you’re constantly presented with opportunities to learn new things. I’m someone who believes in learning at least a little bit of everything. Each time you understand something new about a subject, you enhance your perspective. I’ve learned a lot in the last year about DevOps, but this experience was a reminder of how much more there is to discover, and the value of getting curious enough to solve a personal problem that will help me in the long run.
在这个行业中,您会不断获得学习新事物的机会。 我是一个相信至少学习一点点东西的人。 每次您了解有关该主题的新知识时,都会增强您的见解。 去年,我学到了很多关于DevOps的知识,但是这种经历提醒着我们发现还有更多的东西,以及足够好奇以解决个人问题的价值,这从长远来看对我有帮助。
Have you tackled any personal at-home DevOps projects? Tell me about them in the comments or send me an email.
您是否处理过任何个人家庭DevOps项目? 在评论中告诉我有关它们的信息,或给我发送电子邮件。
翻译自: https://journal.highlandsolutions.com/how-to-set-up-an-erp-for-household-management-41d8b288a83d