Many services can host static websites. HOPS' also manages the build process and connects to GitHub, and makes the release process smooth and fast.
First, initialize a new project directory,
my-hops-app, with the
$ npx "create-react-app@~5.0" my-hops-app --template typescript # Output (partial): # Success! Created my-hops-app at /home/mirg/projects/my-hops-app (...) $ cd my-hops-app $ pnpm import && rm -rf node_modules package-lock.json && pnpm install
Unfortunately, there's a bug in one of the 11891 transitive dependencies used by
.npmrc to resolve this before proceeding:
# https://github.com/pnpm/pnpm/issues/4920#issuecomment-1226724790 cat <<EOF > .npmrc public-hoist-pattern=*eslint* public-hoist-pattern=*prettier* public-hoist-pattern=@types* EOF
That's it, we're good to go!
Dockerfile is a recipe for how to create a container image, which is what we use to run applications in HOPS.
In this example, we use a multi-stage build to create a very small image containing just a web server and the packaged code.
Save the following as
Dockerfile in the base your project folder.
HOPS finds this and automatically builds it whenever you commit to your repository.
iterapp.toml file describes how to run our app, and which resources we need to do that.
Because the app is configured to listen to the
HOPS_READINESS_CHECK variables, we can manage this with our environment variables.
We prefer to release our apps straight to production when the
main branch is updated, so we'll specify that.
In addition, we need to opt in to collecting metrics. We'll expose them on an internal port,
This is our
iterapp.toml file for this project:
# iterapp.toml default_environment="prod" [metrics] port = 3001 path = "/metrics"
Create a repository on GitHub under the
iterate organization, and push your code to it.
|V2||✨ V3 ✨|
In Slack, go to
To deploy your app for the first time, go to
The primary means of interacting with HOPS is through the CLI. To register your application from step 1:
To deploy your app for the first time, run
This should deploy your application. Check it out at
🚀 Happy hacking!
You can speed up your builds slightly by adding
# .dockerignore node_modules
If you're using GitHub, you should add an entry to
.github/dependabot.ymlto keep your docker images up to date:
# .github/dependabot.yml version: 2 updates: - package-ecosystem: "docker" directory: "/" schedule: interval: "weekly"
As of Thursday, March 16th 2023.