Skip to content

Commit

Permalink
Docs: Deploy to Fly.io (#587)
Browse files Browse the repository at this point in the history
* feat: fly.toml

* docs: deploy to fly.io

* fix: Dockerfile fly.io

* fix: monika dockerfly io
  • Loading branch information
dennypradipta authored Jan 31, 2022
1 parent 495fe70 commit 323ddc3
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,6 @@ monika.yaml

# IntelliJ
.idea/

# Fly.io
fly.toml
18 changes: 18 additions & 0 deletions Dockerfile.flyio
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:14-alpine

RUN apk add --no-cache --virtual .gyp python3 make g++

# Setup environment variables
ARG PARAMS
ENV PARAMS=${PARAMS}
ENV CI=true

# Install Monika
USER node
RUN mkdir /home/node/.npm-global
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
RUN npm install -g @hyperjumptech/monika

# Run Monika with Params
CMD ["sh", "-c", "${NPM_CONFIG_PREFIX}/bin/monika ${PARAMS}"]
11 changes: 11 additions & 0 deletions docs/src/manifests/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@
}
]
},
{
"title": "Deployment",
"heading": true,
"routes": [
{
"title": "Deploy to Fly.io",
"path": "/deployment/deploy-to-fly-io",
"editUrl": "/deployment/deploy-to-fly.io.md"
}
]
},
{
"title": "Tutorial",
"heading": true,
Expand Down
45 changes: 45 additions & 0 deletions docs/src/pages/deployment/deploy-to-fly-io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: deploy-to-fly-io
title: Deploy to Fly.io
---

This article covers how to deploy a Monika instance to Fly.io.

1. Go to the [Monika Github repository](https://github.com/hyperjumptech/monika) and download two files: Dockerfile.flyio and fly.toml.example

2. Rename the `fly.toml.example` to fly.toml`.

3. Edit the contents of the fly.toml:

```toml
app = "monika" # Change the app name to the desired name

kill_signal = "SIGINT"
kill_timeout = 5

[build]
dockerfile = "Dockerfile.flyio"

[build.args]
PARAMS = "-v" # Change the parameters according to your needs

[env]
PARAMS = "-v" # Match the content of this PARAMS variable to the one in `build.args` block

[experimental]
auto_rollback = true
```

Refer to the [Fly.io App Configuration Docs](https://fly.io/docs/reference/configuration/) to customize the example TOML even further.

4. Install [Fly.io CLI tools](https://fly.io/docs/flyctl/installing/) (`flyctl`) in your computer

5. a. Proceed to authenticate to Fly.io by running `flyctl auth login` in your terminal.

b. If you haven't signed up to Fly.io yet, you can sign up by running `flyctl auth signup` in your terminal.

6. Create a new Fly.io app by running `flyctl apps create` and enter the app name according to your `fly.toml` you have created before.

7. Deploy Monika to your Fly.io by running `flyctl deploy`

8. Wait until the deployment is finished, and check Monika logs from the Fly.io dashboard to confirm that your Monika instance is running.
18 changes: 18 additions & 0 deletions fly.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
app = "monika"

kill_signal = "SIGINT"
kill_timeout = 5

[build]
dockerfile = "Dockerfile.flyio"

[build.args]
# Insert your Monika parameters
PARAMS = "-v"

[env]
# Insert your Monika parameters
PARAMS = "-v"

[experimental]
auto_rollback = true

0 comments on commit 323ddc3

Please sign in to comment.