npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cdk-nextjs-standalone-ecs

v0.0.17

Published

A CDK Construct for Next.js to deploy to an ISR capable ECS Fargate Service and Task

Downloads

8

Readme

Next.js Standalone ECS Site

WARNING

Leaving this here in case someone can use it as a jumping off point, but the copying method used breaks at scale. Ends up being a race between the first container and when the others start up, and they can break one another. Recommend a different strategy.

NPM Package

View on Construct Hub

Have a very simple use case for Next.js? Perhaps akin to what you would use a SPA (single page app) for? Check out cdk-nextjs-export-s3-dynamic-routing.

Deploy a Next.js site to AWS ECS supporting all version 13 features, including properly functioning, efficient Incremental Static Regeneration and Image Optimization.

This construct employs AWS EFS to share the .next directory between containers, as is recommended by Vercel.

Getting Started

A full example including custom domain, SSL, and Cloudfront is in the /example folder. This construct can also be used with only a VPC and ALB as well, with no caching or custom domain.

You can see the requirements for this construct there, but they are also spelled out in detail below.

The full API of this construct is available in the API.md file.

Requirements

next.config.?s

  • output must be set to standalone. This is what Vercel recommends for Docker based deployments.
  • experimental.isrMemoryCacheSize must be set to zero. Without this, you can get odd responses when using ISR and having multiple containers.

Scripts

Some minimal scripts that handle moving files around when a new build is created are required. They are available in the docker folder.

Dockerfile

The following should be inserted during the final steps, just after the standalone folder is copied.

# Additions from NextjsStandaloneEcsSite
# We use curl to run the health check on the container
RUN apk add --update curl
# Copy our scripts to the root of the container
COPY --from=builder --chown=nextjs:nodejs app/docker ./
# Move the build out of the way of our .next folder shared across containers
RUN mv ./.next ./.next.currentBuild
RUN mkdir -p ./.next
RUN chown nextjs:nodejs ./.next
# End additions from NextjsStandaloneEcsSite

In addition, the final line in the Dockerfile should be changed to:

ENTRYPOINT ["sh","./startup.sh"]

Instead of any CMD or existing ENTRYPOINT. You can add to startup.sh if you need to run additional commands before the container starts.