Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
1 | xpon.ai © 2021 XPON Technologies Pty Ltd
A Cloud Native Approach
to running Silverstripe on
Google Cloud Platform
XPON...
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 ...
5 | xpon.ai © 2021 XPON Technologies AU/NZ
Today’s Talk
A Cloud-Native Approach to running Silverstripe
on Google Cloud Pl...
6 | xpon.ai © 2021 XPON Technologies AU/NZ
Overview
1. A Bit of History
2. What is Cloud Native?
3. Integrating Silverstri...
7 | xpon.ai © 2021 XPON Technologies AU/NZ
Prerequisites
● A basic working Silverstripe 4 project
● GCP Account (because w...
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
● Secu...
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…
○...
13 | xpon.ai © 2021 XPON Technologies AU/NZ
The Checklist
● Simple but scalable infrastructure
● Robust deployment and rol...
14 | xpon.ai © 2021 XPON Technologies AU/NZ
What is Cloud Native?
An approach in software development that
utilizes cloud ...
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 serv...
18 | xpon.ai © 2021 XPON Technologies AU/NZ
What is Cloud Native?
● Automation
● Stateless Components
● Managed Services
●...
19 | xpon.ai © 2021 XPON Technologies AU/NZ
Covers the entire Digital Customer
Experience journey from App
Modernisation t...
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 e...
25 | xpon.ai © 2021 XPON Technologies AU/NZ
Setting up Cloud Storage
● Create Bucket
● Create 2 new folders:
○ public/
○ p...
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...
28 | xpon.ai © 2021 XPON Technologies AU/NZ
Cloud SQL
● Fully Managed Database Service
● MySQL, PostgreSQL, SQL Server
● F...
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. C...
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-sa...
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 t...
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 - Wr...
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 languag...
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://clo...
51 | xpon.ai © 2021 XPON Technologies AU/NZ
Installing Packages
● composer install is ran on deployment
● auth.json in pro...
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)
● ...
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!
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
What to Upload to SlideShare
Next
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

Share

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

Download to read offline

In this talk, Jon talks about how a SilverStripe application can be deployed onto Google Cloud Platform as a cloud-native application to take advantage of the full power and benefits of the Cloud.
First presented at StripeCon EU 2021 on 01/10/2021


Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

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

  1. 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. 2 | xpon.ai © 2021 XPON Technologies AU/NZ @jkersu @jonathonsu $whoami @jker_su Jon Su pending….
  3. 3. 3 | xpon.ai © 2021 XPON Technologies AU/NZ $pwd
  4. 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. 5 | xpon.ai © 2021 XPON Technologies AU/NZ Today’s Talk A Cloud-Native Approach to running Silverstripe on Google Cloud Platform
  6. 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. 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. 8 | xpon.ai © 2021 XPON Technologies AU/NZ A Bit of History
  9. 9. 9 | xpon.ai © 2021 XPON Technologies AU/NZ How hosting used to be done
  10. 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. 11 | xpon.ai © 2021 XPON Technologies AU/NZ Deployment Quick Deployment != Quick Rollback
  12. 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. 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. 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. 15 | xpon.ai © 2021 XPON Technologies AU/NZ Serverless Cloud Native Fully Managed Services Buzzy Keywords
  16. 16. 16 | xpon.ai © 2021 XPON Technologies AU/NZ Serverless
  17. 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. 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. 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. 20 | xpon.ai © 2021 XPON Technologies AU/NZ
  21. 21. 21 | xpon.ai © 2021 XPON Technologies AU/NZ Integrating Silverstripe with GCP MVP Approach
  22. 22. 22 | xpon.ai © 2021 XPON Technologies AU/NZ 3 Key Services Assets Database Server
  23. 23. 23 | xpon.ai © 2021 XPON Technologies AU/NZ GCP Architecture
  24. 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. 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. 26 | xpon.ai © 2021 XPON Technologies AU/NZ Setting up Cloud Storage
  27. 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. 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. 29 | xpon.ai © 2021 XPON Technologies AU/NZ Alternative Run a database on a virtual machine Bad Idea!
  30. 30. 30 | xpon.ai © 2021 XPON Technologies AU/NZ Cloud SQL Auth Proxy
  31. 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. 32 | xpon.ai © 2021 XPON Technologies AU/NZ Enable API
  33. 33. 33 | xpon.ai © 2021 XPON Technologies AU/NZ Create Cloud SQL instance
  34. 34. 34 | xpon.ai © 2021 XPON Technologies AU/NZ Create a database
  35. 35. 35 | xpon.ai © 2021 XPON Technologies AU/NZ Create a database user
  36. 36. 36 | xpon.ai © 2021 XPON Technologies AU/NZ Remember the Connection name
  37. 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. 38 | xpon.ai © 2021 XPON Technologies AU/NZ Connect Silverstripe with Cloud SQL
  39. 39. 39 | xpon.ai © 2021 XPON Technologies AU/NZ GCP_MySQLDatabase.php
  40. 40. 40 | xpon.ai © 2021 XPON Technologies AU/NZ GCP_MySQLiConnector.php
  41. 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. 42 | xpon.ai © 2021 XPON Technologies AU/NZ GCP Compute Options
  43. 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. 44 | xpon.ai © 2021 XPON Technologies AU/NZ Every problem become a code problem!
  45. 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. 46 | xpon.ai © 2021 XPON Technologies AU/NZ Versions - Traffic Splitting
  47. 47. 47 | xpon.ai © 2021 XPON Technologies AU/NZ Blue-Green Deployments
  48. 48. 48 | xpon.ai © 2021 XPON Technologies AU/NZ Canary Deployment
  49. 49. 49 | xpon.ai © 2021 XPON Technologies AU/NZ Setting up a Load Balancer Skip...Built into App Engine!
  50. 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. 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. 52 | xpon.ai © 2021 XPON Technologies AU/NZ PHP Extensions ● php.ini or composer.json
  53. 53. 53 | xpon.ai © 2021 XPON Technologies AU/NZ gcloud app deploy app.yaml (*Flags can be passed to command)
  54. 54. 54 | xpon.ai © 2021 XPON Technologies AU/NZ You can visit the App Engine subdomain URL to use the site.
  55. 55. 55 | xpon.ai © 2021 XPON Technologies AU/NZ What happens during a deployment?
  56. 56. 56 | xpon.ai © 2021 XPON Technologies AU/NZ Ignoring files - .gcloudignore
  57. 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. 58 | xpon.ai © 2021 XPON Technologies AU/NZ Custom Domains
  59. 59. 59 | xpon.ai © 2021 XPON Technologies AU/NZ SSL
  60. 60. 60 | xpon.ai © 2021 XPON Technologies AU/NZ CI / CD
  61. 61. 61 | xpon.ai © 2021 XPON Technologies AU/NZ It’s not hard to start adopting the Cloud!
  62. 62. 62 | xpon.ai © 2021 XPON Technologies AU/NZ Thanks!

In this talk, Jon talks about how a SilverStripe application can be deployed onto Google Cloud Platform as a cloud-native application to take advantage of the full power and benefits of the Cloud. First presented at StripeCon EU 2021 on 01/10/2021

Views

Total views

42

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

0

Shares

0

Comments

0

Likes

0

×