SlideShare uma empresa Scribd logo
1 de 62
1 | xpon.ai © 2021 XPON Technologies Pty Ltd
A Cloud Native Approach
to running Silverstripe on
Google Cloud Platform
XPON Technologies
Virtual StripeCon Europe 2021
2 | xpon.ai © 2021 XPON Technologies AU/NZ
@jkersu
@jonathonsu
$whoami
@jker_su
Jon Su
pending….
3 | xpon.ai © 2021 XPON Technologies AU/NZ
$pwd
4 | xpon.ai © 2021 XPON Technologies AU/NZ
XPON is a
technology
company
for the next generation
of marketing and
customer experience
(CX).
An era that is richly immersive,
powered by data and made intelligent
with AI.
5 | xpon.ai © 2021 XPON Technologies AU/NZ
Today’s Talk
A Cloud-Native Approach to running Silverstripe
on Google Cloud Platform
6 | xpon.ai © 2021 XPON Technologies AU/NZ
Overview
1. A Bit of History
2. What is Cloud Native?
3. Integrating Silverstripe and GCP
4. Other things to know...
7 | xpon.ai © 2021 XPON Technologies AU/NZ
Prerequisites
● A basic working Silverstripe 4 project
● GCP Account (because we’re using GCP)
● No infrastructure background required
8 | xpon.ai © 2021 XPON Technologies AU/NZ
A Bit of History
9 | xpon.ai © 2021 XPON Technologies AU/NZ
How hosting used to be done
10 | xpon.ai © 2021 XPON Technologies AU/NZ
Some Problems
● Medium-Sized and Enterprise Projects
● Uptime Guarantee
● Security
● Resource Hogging Applications == Crash!
● Cost vs Scalability
11 | xpon.ai © 2021 XPON Technologies AU/NZ
Deployment
Quick Deployment != Quick Rollback
12 | xpon.ai © 2021 XPON Technologies AU/NZ
Managed Hosting Services
● Have a professional supporting you is great! But…
○ Reliance on 3rd party to install software
packages
○ Cost / Fees
○ Support response time
○ Self-Hosting - Lot of maintenance work
13 | xpon.ai © 2021 XPON Technologies AU/NZ
The Checklist
● Simple but scalable infrastructure
● Robust deployment and rollback
● Most importantly Self-Service
● Backups, Monitoring and Logging
14 | xpon.ai © 2021 XPON Technologies AU/NZ
What is Cloud Native?
An approach in software development that
utilizes cloud computing to “build and run
scalable applications in modern, dynamic
environments such as public, private and hybrid
clouds”.
“
15 | xpon.ai © 2021 XPON Technologies AU/NZ
Serverless
Cloud Native
Fully
Managed Services
Buzzy
Keywords
16 | xpon.ai © 2021 XPON Technologies AU/NZ
Serverless
17 | xpon.ai © 2021 XPON Technologies AU/NZ
Fully Managed Services
● Focus on using a service, not setting it up
● No server / infrastructure management
● Cloud Provider has your back:
○ Hardware Configuration
○ Scaling
○ Maintenance
○ Security Patches
18 | xpon.ai © 2021 XPON Technologies AU/NZ
What is Cloud Native?
● Automation
● Stateless Components
● Managed Services
● Components are separate but integrate with
each other
● Only Constant is Change
19 | xpon.ai © 2021 XPON Technologies AU/NZ
Covers the entire Digital Customer
Experience journey from App
Modernisation to Cloud Martech and
Adtech in the one Cloud.
Why
GCP?
20 | xpon.ai © 2021 XPON Technologies AU/NZ
21 | xpon.ai © 2021 XPON Technologies AU/NZ
Integrating
Silverstripe
with GCP
MVP Approach
22 | xpon.ai © 2021 XPON Technologies AU/NZ
3 Key Services
Assets
Database
Server
23 | xpon.ai © 2021 XPON Technologies AU/NZ
GCP Architecture
24 | xpon.ai © 2021 XPON Technologies AU/NZ
Cloud Storage
● Equivalent to AWS S3 Bucket
● Objects - files, images, video etc
● Priced for storage (duration), network etc
operations
25 | xpon.ai © 2021 XPON Technologies AU/NZ
Setting up Cloud Storage
● Create Bucket
● Create 2 new folders:
○ public/
○ protected/
● New Service Account
○ Give appropriate permission to read/write
26 | xpon.ai © 2021 XPON Technologies AU/NZ
Setting up Cloud Storage
27 | xpon.ai © 2021 XPON Technologies AU/NZ
Configure Silverstripe with Cloud Storage
● Install module: https://github.com/obj63mc/silverstripe-google-
cloud-storage
● Change access for /public and /protected as per repo docs
● Environment variables:
○ GC_BUCKET_NAME
○ GC_KEY_FILE: Service Account JSON string
28 | xpon.ai © 2021 XPON Technologies AU/NZ
Cloud SQL
● Fully Managed Database Service
● MySQL, PostgreSQL, SQL Server
● Failover, replication and backups
● 99.95% uptime - 43s per day
● CPU / RAM / Storage / Networking Pricing
29 | xpon.ai © 2021 XPON Technologies AU/NZ
Alternative
Run a database on a virtual machine
Bad Idea!
30 | xpon.ai © 2021 XPON Technologies AU/NZ
Cloud SQL Auth Proxy
31 | xpon.ai © 2021 XPON Technologies AU/NZ
1. Enable Cloud SQL API
2. Create Cloud SQL instance
3. Create a database
4. Create a database user
5. Connect Silverstripe with Cloud SQL
Setting up
Cloud SQL
32 | xpon.ai © 2021 XPON Technologies AU/NZ
Enable API
33 | xpon.ai © 2021 XPON Technologies AU/NZ
Create Cloud SQL instance
34 | xpon.ai © 2021 XPON Technologies AU/NZ
Create a database
35 | xpon.ai © 2021 XPON Technologies AU/NZ
Create a database user
36 | xpon.ai © 2021 XPON Technologies AU/NZ
Remember the Connection name
37 | xpon.ai © 2021 XPON Technologies AU/NZ
Missing socket and flags parameters...
Credits to https://github.com/elliot-sawyer/silverstripe-mysql-ssl
for showing the workaround!
Connect Silverstripe with Cloud SQL
38 | xpon.ai © 2021 XPON Technologies AU/NZ
Connect Silverstripe with Cloud SQL
39 | xpon.ai © 2021 XPON Technologies AU/NZ
GCP_MySQLDatabase.php
40 | xpon.ai © 2021 XPON Technologies AU/NZ
GCP_MySQLiConnector.php
41 | xpon.ai © 2021 XPON Technologies AU/NZ
Key Silverstripe Env Variables
Variable Description
SS_DATABASE_NAME Name of the database in Cloud SQL to use
SS_DATABASE_PASSWORD Password of user to connect to Cloud SQL with
SS_DATABASE_USERNAME Database user to connect to Cloud SQL with
SS_DATABASE_CLASS Our custom database class
SS_DATABASE_SERVER NULL
SS_DATABASE_PORT 3306
DATABASE_SOCKET Custom ENV variable. The Cloud SQL database socket in format:
cloudsql/[CONNECTION-NAME]
42 | xpon.ai © 2021 XPON Technologies AU/NZ
GCP Compute Options
43 | xpon.ai © 2021 XPON Technologies AU/NZ
App Engine
● Fully Managed Serverless PaaS Offering
● Code-first Platform - Write code and deploy
● Streamline deployment
○ No servers to manually provision -
app.yaml
● Simplify scalability
44 | xpon.ai © 2021 XPON Technologies AU/NZ
Every problem become a code problem!
45 | xpon.ai © 2021 XPON Technologies AU/NZ
App Engine Standard vs Flexible
Standard Flexible
Specific versions of languages supported
(PHP, Python, Java etc)
Any runtime that support HTTP request
No writing to local file system(exc. /tmp) No sandbox restraints
No SSH Can SSH
Limited 3rd party software installations Support for 3rd party binaries
Pay per instance class, with automatic
shutdown
Pay for resource allocation per hour, no
automatic shutdown
All requests time out at 60 seconds Runs in a container
46 | xpon.ai © 2021 XPON Technologies AU/NZ
Versions - Traffic Splitting
47 | xpon.ai © 2021 XPON Technologies AU/NZ
Blue-Green Deployments
48 | xpon.ai © 2021 XPON Technologies AU/NZ
Canary Deployment
49 | xpon.ai © 2021 XPON Technologies AU/NZ
Setting up a Load Balancer
Skip...Built into App Engine!
50 | xpon.ai © 2021 XPON Technologies AU/NZ
Deploying App Engine - app.yaml
Make sure Cloud SQL setting is on!
https://cloud.google.com/sql/docs/mysql/connect-
app-engine-flexible
51 | xpon.ai © 2021 XPON Technologies AU/NZ
Installing Packages
● composer install is ran on deployment
● auth.json in project to read from private repo
52 | xpon.ai © 2021 XPON Technologies AU/NZ
PHP Extensions
● php.ini or composer.json
53 | xpon.ai © 2021 XPON Technologies AU/NZ
gcloud app deploy app.yaml
(*Flags can be passed to command)
54 | xpon.ai © 2021 XPON Technologies AU/NZ
You can visit the App Engine subdomain URL to use the site.
55 | xpon.ai © 2021 XPON Technologies AU/NZ
What happens during a deployment?
56 | xpon.ai © 2021 XPON Technologies AU/NZ
Ignoring files - .gcloudignore
57 | xpon.ai © 2021 XPON Technologies AU/NZ
Other things to know….
● Email - 3rd Party Services (SendGrid, Mailgun etc)
● Time in UTC - Use library like “carbon” to convert
● Logging - GCP Operations Suites + Monolog
● Versions - Delete “unnecessary” versions!
● Managing Secrets
● Just a starting point -> CDN, Cloud Functions, K8s
58 | xpon.ai © 2021 XPON Technologies AU/NZ
Custom Domains
59 | xpon.ai © 2021 XPON Technologies AU/NZ
SSL
60 | xpon.ai © 2021 XPON Technologies AU/NZ
CI / CD
61 | xpon.ai © 2021 XPON Technologies AU/NZ
It’s not hard to start adopting the Cloud!
62 | xpon.ai © 2021 XPON Technologies AU/NZ
Thanks!

Mais conteúdo relacionado

Mais procurados

VMware - Snapshot sessions - Deploy and manage tomorrow's applications today
VMware - Snapshot sessions  - Deploy and manage tomorrow's applications todayVMware - Snapshot sessions  - Deploy and manage tomorrow's applications today
VMware - Snapshot sessions - Deploy and manage tomorrow's applications today
AnnSteyaert_vmware
 

Mais procurados (20)

Cloud-Native Patterns and the Benefits of MySQL as a Platform Managed Service
Cloud-Native Patterns and the Benefits of MySQL as a Platform Managed ServiceCloud-Native Patterns and the Benefits of MySQL as a Platform Managed Service
Cloud-Native Patterns and the Benefits of MySQL as a Platform Managed Service
 
Pivotal Developer-Ready Infrastructure Slides
Pivotal Developer-Ready Infrastructure SlidesPivotal Developer-Ready Infrastructure Slides
Pivotal Developer-Ready Infrastructure Slides
 
Domain-driven Design
Domain-driven DesignDomain-driven Design
Domain-driven Design
 
DevSecOps: Security at the Speed of DevOp
DevSecOps: Security at the Speed of DevOpDevSecOps: Security at the Speed of DevOp
DevSecOps: Security at the Speed of DevOp
 
Fully Orchestrating Applications, Microservices and Enterprise Services with ...
Fully Orchestrating Applications, Microservices and Enterprise Services with ...Fully Orchestrating Applications, Microservices and Enterprise Services with ...
Fully Orchestrating Applications, Microservices and Enterprise Services with ...
 
Enterprise Java on Azure: From Java EE to Spring, we have you covered
Enterprise Java on Azure: From Java EE to Spring, we have you coveredEnterprise Java on Azure: From Java EE to Spring, we have you covered
Enterprise Java on Azure: From Java EE to Spring, we have you covered
 
Spring Tools 4: Bootiful Spring Tooling for the Masses
Spring Tools 4: Bootiful Spring Tooling for the MassesSpring Tools 4: Bootiful Spring Tooling for the Masses
Spring Tools 4: Bootiful Spring Tooling for the Masses
 
Building Kubernetes images at scale with Tanzu Build Service
Building Kubernetes images at scale with Tanzu Build ServiceBuilding Kubernetes images at scale with Tanzu Build Service
Building Kubernetes images at scale with Tanzu Build Service
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native Application
 
“Sh*^%# on Fire, Yo!”: A True Story Inspired by Real Events
“Sh*^%# on Fire, Yo!”: A True Story Inspired by Real Events“Sh*^%# on Fire, Yo!”: A True Story Inspired by Real Events
“Sh*^%# on Fire, Yo!”: A True Story Inspired by Real Events
 
From Pivotal to VMware Tanzu: What you need to know
From Pivotal to VMware Tanzu: What you need to knowFrom Pivotal to VMware Tanzu: What you need to know
From Pivotal to VMware Tanzu: What you need to know
 
VMware - Snapshot sessions - Deploy and manage tomorrow's applications today
VMware - Snapshot sessions  - Deploy and manage tomorrow's applications todayVMware - Snapshot sessions  - Deploy and manage tomorrow's applications today
VMware - Snapshot sessions - Deploy and manage tomorrow's applications today
 
Wisconsin .NET UG - Windows Azure
Wisconsin .NET UG - Windows AzureWisconsin .NET UG - Windows Azure
Wisconsin .NET UG - Windows Azure
 
Faster, more Secure Application Modernization and Replatforming with PKS - Ku...
Faster, more Secure Application Modernization and Replatforming with PKS - Ku...Faster, more Secure Application Modernization and Replatforming with PKS - Ku...
Faster, more Secure Application Modernization and Replatforming with PKS - Ku...
 
Concourse, Spinnaker, Cloud Foundry, Oh My! Creating Sophisticated Deployment...
Concourse, Spinnaker, Cloud Foundry, Oh My! Creating Sophisticated Deployment...Concourse, Spinnaker, Cloud Foundry, Oh My! Creating Sophisticated Deployment...
Concourse, Spinnaker, Cloud Foundry, Oh My! Creating Sophisticated Deployment...
 
DevOps at scale: what we did, what we learned at Societe Generale
DevOps at scale: what we did, what we learned at Societe GeneraleDevOps at scale: what we did, what we learned at Societe Generale
DevOps at scale: what we did, what we learned at Societe Generale
 
DevOps KPIs as a Service: Daimler’s Solution
DevOps KPIs as a Service: Daimler’s SolutionDevOps KPIs as a Service: Daimler’s Solution
DevOps KPIs as a Service: Daimler’s Solution
 
Introduction to KubeSphere and its open source ecosystem
Introduction to KubeSphere and its open source ecosystemIntroduction to KubeSphere and its open source ecosystem
Introduction to KubeSphere and its open source ecosystem
 
Cloud-Native Operations with Kubernetes and CI/CD
Cloud-Native Operations with Kubernetes and CI/CDCloud-Native Operations with Kubernetes and CI/CD
Cloud-Native Operations with Kubernetes and CI/CD
 
A Leader’s Guide to DevOps Practices and Culture
A Leader’s Guide to DevOps Practices and CultureA Leader’s Guide to DevOps Practices and Culture
A Leader’s Guide to DevOps Practices and Culture
 

Semelhante a StripeCon 2021: A Cloud-Native approach to running Silverstripe on Google Cloud Platform

Semelhante a StripeCon 2021: A Cloud-Native approach to running Silverstripe on Google Cloud Platform (20)

Kong Mesh入門編
Kong Mesh入門編Kong Mesh入門編
Kong Mesh入門編
 
Summit 16: Experiences from the Trench: Bringing DOCOMO Multi Vendor NFV Solu...
Summit 16: Experiences from the Trench: Bringing DOCOMO Multi Vendor NFV Solu...Summit 16: Experiences from the Trench: Bringing DOCOMO Multi Vendor NFV Solu...
Summit 16: Experiences from the Trench: Bringing DOCOMO Multi Vendor NFV Solu...
 
PSOCLD 1007 Cisco Hybrid Cloud Platform for Google Cloud
PSOCLD 1007 Cisco Hybrid Cloud Platform for Google CloudPSOCLD 1007 Cisco Hybrid Cloud Platform for Google Cloud
PSOCLD 1007 Cisco Hybrid Cloud Platform for Google Cloud
 
Pivotal Container Service (PKS) at SF Cloud Foundry Meetup
Pivotal Container Service (PKS) at SF Cloud Foundry MeetupPivotal Container Service (PKS) at SF Cloud Foundry Meetup
Pivotal Container Service (PKS) at SF Cloud Foundry Meetup
 
Forecast 2014: EMC Corp - Build a hybrid cloud
Forecast 2014: EMC Corp - Build a hybrid cloudForecast 2014: EMC Corp - Build a hybrid cloud
Forecast 2014: EMC Corp - Build a hybrid cloud
 
Savio Rodrigues - Cloud Enable Your Ent App - 11th September
Savio Rodrigues - Cloud Enable Your Ent App - 11th SeptemberSavio Rodrigues - Cloud Enable Your Ent App - 11th September
Savio Rodrigues - Cloud Enable Your Ent App - 11th September
 
stackconf 2022: Data Management in Kubernetes – Backup, DR, HA
stackconf 2022: Data Management in Kubernetes – Backup, DR, HAstackconf 2022: Data Management in Kubernetes – Backup, DR, HA
stackconf 2022: Data Management in Kubernetes – Backup, DR, HA
 
Operate Containers with AWS Copilot
Operate Containers with AWS CopilotOperate Containers with AWS Copilot
Operate Containers with AWS Copilot
 
NetCom learning webinar start your network foundations with ccna(handouts)
NetCom learning webinar start your network foundations with ccna(handouts)NetCom learning webinar start your network foundations with ccna(handouts)
NetCom learning webinar start your network foundations with ccna(handouts)
 
<iframe src="http://video.yandex.ru/iframe/ya-events/0ro6nfi3fv.5216/" hei...
<iframe src="http://video.yandex.ru/iframe/ya-events/0ro6nfi3fv.5216/" hei...<iframe src="http://video.yandex.ru/iframe/ya-events/0ro6nfi3fv.5216/" hei...
<iframe src="http://video.yandex.ru/iframe/ya-events/0ro6nfi3fv.5216/" hei...
 
The Bridge to Cloud (Peter Gustafsson, Confluent) London 2019 Confluent Strea...
The Bridge to Cloud (Peter Gustafsson, Confluent) London 2019 Confluent Strea...The Bridge to Cloud (Peter Gustafsson, Confluent) London 2019 Confluent Strea...
The Bridge to Cloud (Peter Gustafsson, Confluent) London 2019 Confluent Strea...
 
DevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical IntroductionDevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical Introduction
 
Elevating your Continuous Delivery Strategy Above the Rolling Clouds
Elevating your Continuous Delivery Strategy Above the Rolling CloudsElevating your Continuous Delivery Strategy Above the Rolling Clouds
Elevating your Continuous Delivery Strategy Above the Rolling Clouds
 
OCP U.S. Summit 2017 Presentation
OCP U.S. Summit 2017 PresentationOCP U.S. Summit 2017 Presentation
OCP U.S. Summit 2017 Presentation
 
DELL EMC XTREMIO X2 CSI PLUGIN INTEGRATION WITH PIVOTAL PKS A Detailed Review
DELL EMC XTREMIO X2 CSI PLUGIN INTEGRATION WITH PIVOTAL PKS A Detailed ReviewDELL EMC XTREMIO X2 CSI PLUGIN INTEGRATION WITH PIVOTAL PKS A Detailed Review
DELL EMC XTREMIO X2 CSI PLUGIN INTEGRATION WITH PIVOTAL PKS A Detailed Review
 
Introduction to ActOnMagic
Introduction to ActOnMagicIntroduction to ActOnMagic
Introduction to ActOnMagic
 
XcellHost Cloud Erp Presentation
XcellHost Cloud Erp PresentationXcellHost Cloud Erp Presentation
XcellHost Cloud Erp Presentation
 
Oracle EBS Journey to the Cloud - What is New in 2022 (UKOUG Breakthrough 22 ...
Oracle EBS Journey to the Cloud - What is New in 2022 (UKOUG Breakthrough 22 ...Oracle EBS Journey to the Cloud - What is New in 2022 (UKOUG Breakthrough 22 ...
Oracle EBS Journey to the Cloud - What is New in 2022 (UKOUG Breakthrough 22 ...
 
Isovalent-kloia Cilium Workshop
Isovalent-kloia Cilium WorkshopIsovalent-kloia Cilium Workshop
Isovalent-kloia Cilium Workshop
 
One And Done Multi-Cloud Load Balancing Done Right.pptx
One And Done Multi-Cloud Load Balancing Done Right.pptxOne And Done Multi-Cloud Load Balancing Done Right.pptx
One And Done Multi-Cloud Load Balancing Done Right.pptx
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

StripeCon 2021: A Cloud-Native approach to running Silverstripe on Google Cloud Platform

  • 1. 1 | xpon.ai © 2021 XPON Technologies Pty Ltd A Cloud Native Approach to running Silverstripe on Google Cloud Platform XPON Technologies Virtual StripeCon Europe 2021
  • 2. 2 | xpon.ai © 2021 XPON Technologies AU/NZ @jkersu @jonathonsu $whoami @jker_su Jon Su pending….
  • 3. 3 | xpon.ai © 2021 XPON Technologies AU/NZ $pwd
  • 4. 4 | xpon.ai © 2021 XPON Technologies AU/NZ XPON is a technology company for the next generation of marketing and customer experience (CX). An era that is richly immersive, powered by data and made intelligent with AI.
  • 5. 5 | xpon.ai © 2021 XPON Technologies AU/NZ Today’s Talk A Cloud-Native Approach to running Silverstripe on Google Cloud Platform
  • 6. 6 | xpon.ai © 2021 XPON Technologies AU/NZ Overview 1. A Bit of History 2. What is Cloud Native? 3. Integrating Silverstripe and GCP 4. Other things to know...
  • 7. 7 | xpon.ai © 2021 XPON Technologies AU/NZ Prerequisites ● A basic working Silverstripe 4 project ● GCP Account (because we’re using GCP) ● No infrastructure background required
  • 8. 8 | xpon.ai © 2021 XPON Technologies AU/NZ A Bit of History
  • 9. 9 | xpon.ai © 2021 XPON Technologies AU/NZ How hosting used to be done
  • 10. 10 | xpon.ai © 2021 XPON Technologies AU/NZ Some Problems ● Medium-Sized and Enterprise Projects ● Uptime Guarantee ● Security ● Resource Hogging Applications == Crash! ● Cost vs Scalability
  • 11. 11 | xpon.ai © 2021 XPON Technologies AU/NZ Deployment Quick Deployment != Quick Rollback
  • 12. 12 | xpon.ai © 2021 XPON Technologies AU/NZ Managed Hosting Services ● Have a professional supporting you is great! But… ○ Reliance on 3rd party to install software packages ○ Cost / Fees ○ Support response time ○ Self-Hosting - Lot of maintenance work
  • 13. 13 | xpon.ai © 2021 XPON Technologies AU/NZ The Checklist ● Simple but scalable infrastructure ● Robust deployment and rollback ● Most importantly Self-Service ● Backups, Monitoring and Logging
  • 14. 14 | xpon.ai © 2021 XPON Technologies AU/NZ What is Cloud Native? An approach in software development that utilizes cloud computing to “build and run scalable applications in modern, dynamic environments such as public, private and hybrid clouds”. “
  • 15. 15 | xpon.ai © 2021 XPON Technologies AU/NZ Serverless Cloud Native Fully Managed Services Buzzy Keywords
  • 16. 16 | xpon.ai © 2021 XPON Technologies AU/NZ Serverless
  • 17. 17 | xpon.ai © 2021 XPON Technologies AU/NZ Fully Managed Services ● Focus on using a service, not setting it up ● No server / infrastructure management ● Cloud Provider has your back: ○ Hardware Configuration ○ Scaling ○ Maintenance ○ Security Patches
  • 18. 18 | xpon.ai © 2021 XPON Technologies AU/NZ What is Cloud Native? ● Automation ● Stateless Components ● Managed Services ● Components are separate but integrate with each other ● Only Constant is Change
  • 19. 19 | xpon.ai © 2021 XPON Technologies AU/NZ Covers the entire Digital Customer Experience journey from App Modernisation to Cloud Martech and Adtech in the one Cloud. Why GCP?
  • 20. 20 | xpon.ai © 2021 XPON Technologies AU/NZ
  • 21. 21 | xpon.ai © 2021 XPON Technologies AU/NZ Integrating Silverstripe with GCP MVP Approach
  • 22. 22 | xpon.ai © 2021 XPON Technologies AU/NZ 3 Key Services Assets Database Server
  • 23. 23 | xpon.ai © 2021 XPON Technologies AU/NZ GCP Architecture
  • 24. 24 | xpon.ai © 2021 XPON Technologies AU/NZ Cloud Storage ● Equivalent to AWS S3 Bucket ● Objects - files, images, video etc ● Priced for storage (duration), network etc operations
  • 25. 25 | xpon.ai © 2021 XPON Technologies AU/NZ Setting up Cloud Storage ● Create Bucket ● Create 2 new folders: ○ public/ ○ protected/ ● New Service Account ○ Give appropriate permission to read/write
  • 26. 26 | xpon.ai © 2021 XPON Technologies AU/NZ Setting up Cloud Storage
  • 27. 27 | xpon.ai © 2021 XPON Technologies AU/NZ Configure Silverstripe with Cloud Storage ● Install module: https://github.com/obj63mc/silverstripe-google- cloud-storage ● Change access for /public and /protected as per repo docs ● Environment variables: ○ GC_BUCKET_NAME ○ GC_KEY_FILE: Service Account JSON string
  • 28. 28 | xpon.ai © 2021 XPON Technologies AU/NZ Cloud SQL ● Fully Managed Database Service ● MySQL, PostgreSQL, SQL Server ● Failover, replication and backups ● 99.95% uptime - 43s per day ● CPU / RAM / Storage / Networking Pricing
  • 29. 29 | xpon.ai © 2021 XPON Technologies AU/NZ Alternative Run a database on a virtual machine Bad Idea!
  • 30. 30 | xpon.ai © 2021 XPON Technologies AU/NZ Cloud SQL Auth Proxy
  • 31. 31 | xpon.ai © 2021 XPON Technologies AU/NZ 1. Enable Cloud SQL API 2. Create Cloud SQL instance 3. Create a database 4. Create a database user 5. Connect Silverstripe with Cloud SQL Setting up Cloud SQL
  • 32. 32 | xpon.ai © 2021 XPON Technologies AU/NZ Enable API
  • 33. 33 | xpon.ai © 2021 XPON Technologies AU/NZ Create Cloud SQL instance
  • 34. 34 | xpon.ai © 2021 XPON Technologies AU/NZ Create a database
  • 35. 35 | xpon.ai © 2021 XPON Technologies AU/NZ Create a database user
  • 36. 36 | xpon.ai © 2021 XPON Technologies AU/NZ Remember the Connection name
  • 37. 37 | xpon.ai © 2021 XPON Technologies AU/NZ Missing socket and flags parameters... Credits to https://github.com/elliot-sawyer/silverstripe-mysql-ssl for showing the workaround! Connect Silverstripe with Cloud SQL
  • 38. 38 | xpon.ai © 2021 XPON Technologies AU/NZ Connect Silverstripe with Cloud SQL
  • 39. 39 | xpon.ai © 2021 XPON Technologies AU/NZ GCP_MySQLDatabase.php
  • 40. 40 | xpon.ai © 2021 XPON Technologies AU/NZ GCP_MySQLiConnector.php
  • 41. 41 | xpon.ai © 2021 XPON Technologies AU/NZ Key Silverstripe Env Variables Variable Description SS_DATABASE_NAME Name of the database in Cloud SQL to use SS_DATABASE_PASSWORD Password of user to connect to Cloud SQL with SS_DATABASE_USERNAME Database user to connect to Cloud SQL with SS_DATABASE_CLASS Our custom database class SS_DATABASE_SERVER NULL SS_DATABASE_PORT 3306 DATABASE_SOCKET Custom ENV variable. The Cloud SQL database socket in format: cloudsql/[CONNECTION-NAME]
  • 42. 42 | xpon.ai © 2021 XPON Technologies AU/NZ GCP Compute Options
  • 43. 43 | xpon.ai © 2021 XPON Technologies AU/NZ App Engine ● Fully Managed Serverless PaaS Offering ● Code-first Platform - Write code and deploy ● Streamline deployment ○ No servers to manually provision - app.yaml ● Simplify scalability
  • 44. 44 | xpon.ai © 2021 XPON Technologies AU/NZ Every problem become a code problem!
  • 45. 45 | xpon.ai © 2021 XPON Technologies AU/NZ App Engine Standard vs Flexible Standard Flexible Specific versions of languages supported (PHP, Python, Java etc) Any runtime that support HTTP request No writing to local file system(exc. /tmp) No sandbox restraints No SSH Can SSH Limited 3rd party software installations Support for 3rd party binaries Pay per instance class, with automatic shutdown Pay for resource allocation per hour, no automatic shutdown All requests time out at 60 seconds Runs in a container
  • 46. 46 | xpon.ai © 2021 XPON Technologies AU/NZ Versions - Traffic Splitting
  • 47. 47 | xpon.ai © 2021 XPON Technologies AU/NZ Blue-Green Deployments
  • 48. 48 | xpon.ai © 2021 XPON Technologies AU/NZ Canary Deployment
  • 49. 49 | xpon.ai © 2021 XPON Technologies AU/NZ Setting up a Load Balancer Skip...Built into App Engine!
  • 50. 50 | xpon.ai © 2021 XPON Technologies AU/NZ Deploying App Engine - app.yaml Make sure Cloud SQL setting is on! https://cloud.google.com/sql/docs/mysql/connect- app-engine-flexible
  • 51. 51 | xpon.ai © 2021 XPON Technologies AU/NZ Installing Packages ● composer install is ran on deployment ● auth.json in project to read from private repo
  • 52. 52 | xpon.ai © 2021 XPON Technologies AU/NZ PHP Extensions ● php.ini or composer.json
  • 53. 53 | xpon.ai © 2021 XPON Technologies AU/NZ gcloud app deploy app.yaml (*Flags can be passed to command)
  • 54. 54 | xpon.ai © 2021 XPON Technologies AU/NZ You can visit the App Engine subdomain URL to use the site.
  • 55. 55 | xpon.ai © 2021 XPON Technologies AU/NZ What happens during a deployment?
  • 56. 56 | xpon.ai © 2021 XPON Technologies AU/NZ Ignoring files - .gcloudignore
  • 57. 57 | xpon.ai © 2021 XPON Technologies AU/NZ Other things to know…. ● Email - 3rd Party Services (SendGrid, Mailgun etc) ● Time in UTC - Use library like “carbon” to convert ● Logging - GCP Operations Suites + Monolog ● Versions - Delete “unnecessary” versions! ● Managing Secrets ● Just a starting point -> CDN, Cloud Functions, K8s
  • 58. 58 | xpon.ai © 2021 XPON Technologies AU/NZ Custom Domains
  • 59. 59 | xpon.ai © 2021 XPON Technologies AU/NZ SSL
  • 60. 60 | xpon.ai © 2021 XPON Technologies AU/NZ CI / CD
  • 61. 61 | xpon.ai © 2021 XPON Technologies AU/NZ It’s not hard to start adopting the Cloud!
  • 62. 62 | xpon.ai © 2021 XPON Technologies AU/NZ Thanks!