[MUSIC PLAYING]
SPEAKER 1: OK let's do this.
So, just a little background, I'm from Symph.
Symph is my company.
I'm wearing a t-shirt.
Woo hoo.
But let me show you.
We are Symph.
We're based in the Philippines.
This is our team.
We're kind of wacky.
But we do websites and mobile apps for clients.
We do a lot of projects.
We have a lot of projects over here.
We have a lot of clients.
And for every single client or for every single project,
we build it on App Engine.
We put our code in Bitbucket.
And someone has to do this.
Fork a boilerplate in the repository,
grant user permissions, create a GCP project,
create App Engine application, set up
deployment configuration, repeat these steps again
for the test environment, and that usually
falls on me, the CTO.
So I've been doing that, again and again,
almost like once every week or twice every week.
And it's really getting tiring.
We also use Slack a lot.
So we thought, what if we can initialize and deploy
GCP projects from Slack?
So we did just that.
So it's demo time.
So here we go.
So to make it more exciting, I'm going
to play some epic background music
that I got from YouTube, Royalty-free,
just letting you know.
OK.
There.
All right.
So what we do is we just type Symph bot help.
That's our bot in Slack.
And it tells me all the things I can do,
including this create project, project ID, region, which
will then initialize a project.
So I wrote this documentation.
I didn't expect that you will have
to read it on stage from stage.
So that's a lot of words right there, don't have to read it.
But let's try it out.
So I type create project.
Let's go, Symph, next, demo, let's just put D 19.
Hit Enter.
And so now it's creating a production environment
of this project as well.
And it's doing that, it's forking the repository
and doing that.
Now, I asked this all the time, what
do you do when you're waiting for things that are loading?
Most of the time, you open up another tab, browse Facebook,
and then 30 minutes later, you're still on Facebook.
So what I tell people to do, you do push-ups.
Come on.
Yeah.
So we're done.
[APPLAUSE]
All right.
So the good thing about this, it imploded.
If it fails, I can actually do the same command again
and try it, this time with fingers crossed.
I'm assuming that so many people are
doing projects in the code labs and, I don't know,
maybe it's delaying.
I really have no idea.
I should do push-ups again.
[MUSIC PLAYING]
Woo hoo.
All right.
OK.
So, the second time it errored.
I don't know what's happening really.
It says permissions error fetching application.
But if we go over here, it should have
the project in the console.
Oh.
Resource manager projects get.
OK, so it didn't create the project.
I don't know why.
Let's try to create a project manually.
This worked when I practiced.
Oh.
Google should give me more quota.
So maybe we created too many projects too quickly,
because they're doing this on Slack, and we ran out.
All right.
So I'll continue with the presentation.
I'll just show you how it's actually supposed to be.
Round of applause, please.
[APPLAUSE]
OK.
So let's just imagine it works.
And I'll reduce my background music.
So when we type a command in Slack, create project,
it sends a message to our bot.
You know, a Slack bot, it can be any Slack bot that you have.
And then it sends a POST request to our App Engine app.
I'll go over the code in a little bit.
And it acts as a coordinator.
So what it does is first, it forks the boilerplate
in Bitbucket, then it creates a project
and enabled services, like Vision API, datastore API,
the APIs that we commonly use.
And it also configures a deployment for our deployment
service that's also running Compute Engine,
it's a custom script.
Obviously, we can do this on [INAUDIBLE],, source
repositories, and also cloud build.
But for now, we're running it on a custom deployment
script on Compute Engine.
So where is all of this?
It's in this link.
And I'll go over the code right now.
And apparently I can't click on this thing, so I'll type it up.
GitHub.
Symphco slash GCP slack init.
How am I doing on time?
All right.
So I'm going to go, just briefly, over the code.
I'm assuming most of you are developers.
So here, these are the things you need to put in.
This is public and open source.
It's my first open source project
that I'm releasing to devs like you, so please be kind.
I know these are supposed to be in end and not committed,
but I did.
So, yeah, don't put it in GitHub when you deploy it on your own.
OK.
So you have your--
just put these things in.
And what it does is when it hit--
This is what runs when you hit the endpoint from the Slack
bot.
So first, it forks the repo from Bitbucket.
And then it adds the branch merge permission, so that--
we have customers in the company that people
can't delete the branch or people can't
delete the repository.
That's really good to put in.
And then we create the project in GCP
under a specific folder in our company,
in this case, Symph projects.
And then we also do the same thing,
we create the test project this time.
We just add the word test at the end.
So it's sort of like a convention in the company.
And then we create App Engine.
So I manually add us a sleep for five seconds,
because it takes about five seconds for project creation,
and then you can enable the App Engine service.
You can choose the region where you put it.
[INAUDIBLE] Asia east 2.
We like that, because we're from the Philippines.
And then we also create App Engine test again.
And then this is the part where we add it to our custom
deployment script.
And then we enable datastore.
And for the test project as well.
And you can add other services you want to enable here.
So basically, that's the code base.
And it's available in GitHub.
Feel free to improve it, make it better.
And I hope you find it useful.
And just imagine that when I did the whole demo,
it was really amazing, and I did so much push-ups.
And the thing about the push-ups is
that, at least if your script is slow,
your body is healthy, right?
OK.
If your body's not healthy, at least your script is fast.
So if you want to connect with me, I'm on LinkedIn.
And I'm also-- my email is up there.
I'm happy to share this with anybody who
also wants to use it.
So that's all.
Thank you very much.
[MUSIC PLAYING]