takarajapaneseramen.com

Successfully Deploying Strapi: A Comprehensive Guide to Security

Written on

Chapter 1: The Challenge of Transitioning to Strapi

The frontend team opted to replace our current storefront with Strapi, a rapidly growing headless content management system based in Paris. This transition promises significant enhancements in process management and SEO, making the project's benefits evident.

I swiftly set up the solution within our development environment using AWS CDK, adhering to our standard service architecture:

AWS CDK service architecture diagram

Details:

  • ECS operates with Fargate
  • RDS utilizes PostgreSQL
  • The web layer makes GraphQL requests to Strapi for content retrieval

As we approached the production phase, I had several reservations regarding safety:

  1. RDS Scalability: Would it remain responsive during peak usage, such as during advertising campaigns? Since we primarily use MongoDB Atlas, I was unsure how to manage PostgreSQL without the usual DevOps concerns. Additionally, AWS Aurora Serverless 2 didn’t seem to be a cost-efficient option for our needs.
  2. Page Load Times: Our 90th percentile GraphQL request time was around 400ms, far too sluggish for basic page loads.
  3. Site Vulnerability: Strapi's freemium tier lacks SSO or MFA capabilities, leaving our content only password-protected with a complexity that couldn’t be customized and no automatic lockout feature—definitely concerning!

Chapter 2: Implementing Effective Solutions

The solutions for both the page load and RDS scalability issues were straightforward. We configured caching on our Apollo Client, which operates on the web containers. Additionally, we set it to periodically load all site pages, ensuring that no single user experiences slow read times. This adjustment resulted in a relatively consistent load on PostgreSQL, only varying when the cluster scales.

To address the risk of site defacement, we utilized the capabilities of the AWS Application Load Balancer (ALB). This setup mandates authentication via our Google Workspace account unless the traffic originates from within our VPC:

AWS Application Load Balancer configuration

I had to obscure this image extensively, but all our outbound traffic from the VPC routes through NAT gateways. This allows us to monitor our own traffic even across the public internet.

Video: Everything You Need to Know About Strapi Deployment Options

This video discusses various deployment strategies for Strapi, focusing on best practices and potential pitfalls.

Chapter 3: Reflections on the Deployment Experience

I take pride in how my team and I managed to navigate these critical security challenges during the rapid push to production.

However, this experience of operating a production workload on GraphQL was less than ideal. The slow performance was puzzling. The pg_stat_statements indicated that the query execution was swift, suggesting that the bottleneck might be within the Strapi containers themselves.

Having run numerous production workloads on PostgreSQL, I have a particular affinity for it. Yet, achieving optimal performance in a production environment remains a complex task.

I’m particularly impressed by the capabilities of the AWS ALB, especially when paired with its integrated SSO verification.

Video: How To Deploy Local Data To Strapi Cloud

This tutorial guides viewers through the process of deploying local data to Strapi's cloud environment, ensuring a seamless transition.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Unlock the Potential of Xero with Coda and More

Explore how Coda's Xero pack transforms business workflows and discover valuable resources for bookkeeping and project management.

Embracing Self-Compassion: My Journey to Becoming My Own Best Friend

Discover how self-compassion transformed my life, allowing me to become my own best friend through challenges and self-acceptance.

# Recognizing the Key Indicators of Low Testosterone Levels

Explore the primary signs of low testosterone and understand the importance of seeking medical advice for effective treatment options.

Embrace Joy: Don't Let Life's Little Worries Bring You Down

Focus on the positives in life and let go of small worries to embrace happiness and joy every day.

Vue 3 Application Development Using the PrimeVue Framework

A guide to developing Vue 3 applications with PrimeVue, featuring cards, deferred content, and fieldsets.

# Becoming an Effective Ally to the LGBTQIA+ Community

Learn how to be a supportive ally to the LGBTQIA+ community through understanding and engagement.

The Compact Powerhouse: Apple’s New Mac Studio Explained

Discover how Apple's Mac Studio redefines power and affordability for professionals in creative fields.

Claw Your Way Out: Escape the Abyss of Self-Doubt

Discover how to break free from self-imposed limitations and embrace your true self.