GCP
In this walk-through, you’re going to automate the deployment of your application on GCP using Argonaut. It's aimed at first-time users of Argonaut.
The walk-through assumes that you have and can log into:
Let's begin.
1. Create an Argonaut account
If it’s your first time using Argonaut, you’ll need to sign up for an Argonaut account. Alternatively, if you already have one, log into your account.
2. Create an organization
Each Argonaut account can be connected with multiple GCP projects and organizations.
- Click on the
Settings
icon on your top right. - Click on Cloud Connect.
- Under
Organization Details
, type in a name in theOrganization Name
field. - Click on the
Set
button. - You should see an
Org is set successfully
message.
3. Connect your GCP account
To connect your GCP account with Argonaut:
- Log into your GCP account, if not already logged in.
- Go to Google Cloud Console.
- Create an Organization resource.
- Create a project within your organization resource.
- Attach your project to a billing account.
- Get and copy your organization resource ID.
- Navigate to Argonaut dashboard.
- Click on the Settings icon on top right.
- Click on
Cloud Connect
. - Scroll to
Connect Your Cloud
section. - Under
Google Cloud Platform
, paste your GCP organization resource ID, and clickAdd
. - Copy the shown code snippet.
- Run that code snippet on the provided Cloud Console URL.
- Go back to your Argonaut
Cloud Connect
page and refresh the status of your organization resource. - Verify that the status of the organization now shows
Connected
.
4. Connect your GitHub account
With your GCP account successfully connected, you finally need to connect Argonaut to your GitHub repository.
- Click on the
Settings
icon ⚙ on the top right of the top nav. - Click
Version Control
on the left pane. - Scroll to
GitHub
. - Click
+
. - Click on the GitHub account you’d like to connect with Argonaut. You’ll host your sample application on this account.
- Click on
Install
to installArgonautBot
on your chosen GitHub account. - Enter your password, and click on
Confirm Password
. - On successfully connecting your GitHub account, you’ll be redirected to the
Version Control
page that shows your GitHub account.
5. Create an environment
- Click on
Infrastructure
in top nav bar. - Click on
Environments +
. - Choose
Google Cloud Platform
. - Choose your GCP Org from the dropdown.
- Choose your GCP Project from the dropdown.
note
The chosen GCP project must be attached to a GCP billing account and be a part of a GCP organization.
- Type your environment's name.
- Choose your environment’s region. An environment's region can't be changed later.
- Click on
Create Environment
.
To check if the environment creation was successful, navigate to the Infrastructure page from the top nav bar pane, and look for your environment's name in the list.
6. Create a GKE cluster
To deploy your application on K8s, you need to first create a K8s cluster:
- Navigate to
Infrastructure
→New Resource +
. - Click on
GKE
. - Input the following values:
- Cluster Name as
gcpquickstart
. - Initial Node Count as
3
.
- Cluster Name as
- Click
Add Node Group
.- Set Nodes:
Min
as3
andMax
as5
. - Set
Disk Capacity
as10
.
- Set Nodes:
- Click on
Create GKE
.
- You'll be redirected to the
History
page. - Check the status of the cluster, and ensure that it shows a green checkmark.
7. Set up automatic deployment
Fork the battleships repository into your GitHub account - the same account that you’ve connected to in Argonaut. The rest of the steps assume that the name of the forked repository is also
battleships
.On your Argonaut dashboard, click on
Applications
on your left pane.Click the button
Deployment +
on the top right.Select
Git Source
.This takes you to the
Deployment Details
step.- Choose your GitHub account from the dropdown.
- Choose the
battleships
repository. - Choose the
main
branch. - Click
Next
.
You’ll be taken to the
Select Runtime
step.- Select
Kubernetes
. - Choose your Target Cluster as
gcpquickstart
. - In
Service
, fillgcpquickstart
. - In
Path
, fill./Dockerfile
. - Ensure,
Service Type
is chosen asStateless
. - Under
Network Services
, clickAdd Service
.- Fill your
Hostname
. - Fill the port you want the application to run on in
Container Port
.
- Fill your
- Ensure that
Resource Requests & Limits
have values set by default. - Click
Deploy
.
- Select
After clicking
Deploy
, you’ll be taken to theDeployments
page that shows the deployment logs. Your application is now being deployed.To check if the deployment was complete, look for a green check mark icon against your deployment commit ID, on the
Deployments
page.Once deployed, navigate to the URL you provided as
Hostname
. You should see the following screen:
You’ve successfully deployed your example application using Argonaut! Let’s test whether your application now automatically gets deployed when you push a code change.
8. Test automatic deployment
You’re now ready to test if your app gets deployed automatically whenever any code change is pushed to it. Let’s make a code change, and view the app again.
- Git clone your forked
battleships
repository on your local machine. - Make a code change, and push to remote.
- Check your application’s deployments on Argonaut dashboard:
Applications
→gcpquickstart
→Deployments
- You’ll see an ongoing deployment against your commit ID.
- Once the deployment is complete, navigate to your service URL to test that your code change is live.
That’s it!
You just used Argonaut to successfully set up automatic deployment of an example application on every code push. You can now connect your own app with Argonaut to automate its deployment.