This message was deleted.
# general
s
This message was deleted.
b
hello! welcome!
Looking at your ansible repo, it seems what you're trying to build is an off-the-shelf way of deploying/provisioning wordpress, is that about right?
s
A whole raft of WordPresses, yes.
With custom plug-ins and themes
www.epfl.ch is built that way out of 900+ WordPress instances (and a menu system that papers over that fact, so that it appears as one and the same website)
My team’s yearly objective is to restore the whole shebang out of infrastructure-as-code and a backup in less than 6 hours
i
AFAIK pulumi does only the cloud stuff, and doesn't really have support for touching stuff on the host, short of
user_data
and
cloud-init
stuff
s
What would it take to write plug-ins to teach it how,
?
i
I don't know enough about pulumi, but I'm a saltstack fanboi ;)
s
Ruby is a bit of a tough sell to my team
i
Ruby?
s
Hmm, my bad — I was working from a wrong impression here.
b
you can do provisioning on the host if you need to with a dynamic provider: https://github.com/pulumi/examples/blob/master/aws-py-ec2-provisioners/provisioners.py
i
You might be thinking of Chef. I'm talking about https://docs.saltstack.com/en/latest/ which is python
s
Right, my bad
i
But, since it's a different place - I'll gladly answer questions, but won't try to evangelise ;)
s
Fair enough 🙂
b
@shy-helmet-71712 I think if you're provisioning lots of wordpress instances, creating a componentresource would be a good way to think about it: https://www.pulumi.com/blog/creating-and-reusing-cloud-components-using-package-managers/
s
Thanks @billowy-army-68599, reading this now
... So, it looks like https://github.com/chrsmith/static-website-aws/blob/master/index.ts does its job by creating a number of resources in existing classes; which apparently consists of constructing them and then dropping them on the floor.
In my case though, the primitive building blocks probably don’t exist.
How do I create a “file on NFS” resource class, or a “MySQL database” resource class?
b
mysql database resource class would use the mysql provider: https://www.pulumi.com/docs/intro/cloud-providers/mysql/
file on NFS is trickier because pulumi exists at a different abstraction layer, but it's doable with a dynamic provider or with the native file write of your chosen programming language
if you're doing a lot of heavy lifting at the OS layer, I would stick with ansible for those parts
s
So, I would need to write roughly half the lines of code in golang it seems?
(assuming I select only one of the script languages, and drop the others for “pulumi-nfs”)
@billowy-army-68599 I need to enforce postconditions on MySQL databases, files on NFS (incl. permissions and symlinks), and Kubernetes objects. I’d rather only write shell scripts when I have to — So not that much at “OS level”, I think?
(Another requirement is that the secrets should be stored as-code, with version control and everything, but encrypted with a master key that lives on Keybase)
b
you can define the mysql database and Kubernetes resources natively with pulumi using the mysql provider and the kubernetes provider. You'd wrap both of those things inside a "component resource" which would allow you to create an abstraction that can be reused without having to write lots of code.
s
And of course, the job needs to be done fast, and produce a spiffy report at the end?
.
b
i'm not following your question re: writing in Go, you wouldn't need to write any Go unless you wanted to
the only thing we dont have native support for is writing files to NFS, but you can achieve the same result by creating a dynamic provider which is a little more legwork, but can be done
s
That’s what perplexes me in this whole Pulumi project so I’m glad you are making this remark ☺️
Is Pulumi basically N times the very same thing, in N languages?
Is the only shared code between the implementations in the cloud? (Oh BTW, I need the thing to work out of a private cloud — No leaking info on what we push when)
b
yes, when you create your "pulumi project" you pick a language and write your stuff in that. The MySQL provider is written in Go and it creates an SDK which you consume in all our supported languages
Go also happens to be one our supported SDKs, so I can see the confusion
s
So doing the Go thing is just the easiest way to get bindings in all supported languages, and that’s what “core” modules would do. But I can just issue syscalls etc. out of (say) JS and be on my merry way. Correct?
In that case, where can I find info on the class contract for a provider that is not based on golang?
Coming from my Ansible background, I assume a provider class needs to 1) tell its caller whether the postcondition is enforced (to distinguish between “green” and “yellow” states), and 2) enforce the postcondition
(and optionally: give off diffs, profiling info, and feedback used by subsequent tasks)
b
perhaps I'm not explaining things very well, so I apologise for that. There are two things I'm talking about here. 1) Pulumi has multiple providers that interact with cloud resources like an API. These providers are always written in Go. They generate an SDK which is consumed by our users in all our supported languages. You can read more about this here: https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/ there's no "provider class" and you wouldn't need to write a provider for your particular use case. 2) The providers register resources in the pulumi state. You write these resources in your language of choice (for example, python). If you want to do things on the filesystem, as you said before, you're quite free to interact with any of the language constructs like syscalls AS WELL as interacting with the pulumi SDK inside your pulumi program
s
It might be me who doesn’t understand well, therefore no need to apologize ☺️
Thanks for the link, things are now a lot clearer to me.
And I see there is also a creation / deletion order graph maintained by the engine.
That sounds close to the puppet design (“catalog”). Does the provider get control at execution time (in the form of a callback)?
Dinner time — Thanks for your help again @billowy-army-68599!