Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Deploy Gogs Demo App to Fly.io! 🚀 #3

Closed
nelsonic opened this issue May 11, 2022 · 8 comments
Closed

Deploy Gogs Demo App to Fly.io! 🚀 #3

nelsonic opened this issue May 11, 2022 · 8 comments
Assignees
Labels
awaiting-review An issue or pull request that needs to be reviewed chore a tedious but necessary task often paying technical debt enhancement New feature or request priority-1 Highest priority issue. This is costing us money every minute that passes. T1h Time Estimate 1 Hour

Comments

@nelsonic
Copy link
Member

The demo app in this repo already shows displaying content from Gogs.
But I want to show updating content e.g ...
Once that is done, we should immediately deploy it to Fly.io to showcase it!

@nelsonic nelsonic added enhancement New feature or request T1h Time Estimate 1 Hour priority-1 Highest priority issue. This is costing us money every minute that passes. chore a tedious but necessary task often paying technical debt labels May 11, 2022
@nelsonic nelsonic self-assigned this May 11, 2022
@nelsonic
Copy link
Member Author

1 desired, 1 placed, 0 healthy, 1 unhealthy
v2 failed - Failed due to unhealthy allocations - no stable job version to auto revert to
***v2 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v3

Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

Re-reading: https://fly.io/docs/getting-started/troubleshooting

@nelsonic
Copy link
Member Author

https://fly.io/apps/gogs-demo
image

this is tedious ...

@nelsonic
Copy link
Member Author

Log:

Recent Events
TIMESTAMP           	TYPE      	MESSAGE
2022-05-12T21:40:07Z	Received  	Task received by client
2022-05-12T21:40:07Z	Task Setup	Building Task Directory
2022-05-12T21:40:14Z	Started   	Task started by client

2022-05-12T21:40:08Z   [info]Starting instance
2022-05-12T21:40:09Z   [info]Configuring virtual machine
2022-05-12T21:40:09Z   [info]Pulling container image
2022-05-12T21:40:12Z   [info]Unpacking image
2022-05-12T21:40:13Z   [info]Preparing kernel init
2022-05-12T21:40:14Z   [info]Configuring firecracker
2022-05-12T21:40:14Z   [info]Starting virtual machine
2022-05-12T21:40:14Z   [info]Starting init (commit: 252b7bd)...
2022-05-12T21:40:14Z   [info]Preparing to run: `bin/app start` as nobody
2022-05-12T21:40:14Z   [info]2022/05/12 21:40:14 listening on [fdaa:0:5cce:a7b:a9a:d6:e7f5:2]:22 (DNS: [fdaa::3]:53)
2022-05-12T21:40:15Z   [info]Reaped child process with pid: 549, exit code: 0
2022-05-12T21:40:17Z   [info]Warning: the `dialyxir` application's start function was called, which likely means you
2022-05-12T21:40:17Z   [info]did not add the dependency with the `runtime: false` flag. This is not recommended because
2022-05-12T21:40:17Z   [info]it will mean that unnecessary applications are started, and unnecessary applications are most
2022-05-12T21:40:17Z   [info]likely being added to your PLT file, increasing build time.
2022-05-12T21:40:17Z   [info]Please add `runtime: false` in your `mix.exs` dependency section e.g.:
2022-05-12T21:40:17Z   [info]{:dialyxir, "~> 0.5", only: [:dev], runtime: false}
2022-05-12T21:40:17Z   [info]Reaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
--> v8 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v9

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

@SimonLab
Copy link
Member

Current error:
image

  • Are all env variables defined on Fly? (We should maybe raised an error on gogs if they aren't.)

@nelsonic
Copy link
Member Author

I've borrowed from our successful deployment to Fly: https://github.com/dwyl/hits/pull/128/files

This time deploy worked:

n@MBP gogs-demo % flyctl deploy --verbose
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-shy-sunset-4953 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 13.5s (0/1)
[+] Building 63.5s (24/24) FINISHED
 => [internal] load remote build context                                                      0.0s
 => copy /context /                                                                           0.8s
 => [internal] load metadata for docker.io/library/alpine:3.13.3                              0.9s
 => [internal] load metadata for docker.io/hexpm/elixir:1.12.1-erlang-24.0.1-alpine-3.13.3    0.9s
 => [build  1/14] FROM docker.io/hexpm/elixir:1.12.1-erlang-24.0.1-alpine-3.13.3@sha256:4eef  0.0s
 => [app 1/5] FROM docker.io/library/alpine:3.13.3@sha256:826f70e0ac33e99a72cf20fb0571245a8f  0.0s
 => CACHED [build  2/14] RUN apk add --no-cache build-base npm                                0.0s
 => CACHED [build  3/14] WORKDIR /app                                                         0.0s
 => CACHED [build  4/14] RUN mix local.hex --force &&     mix local.rebar --force             0.0s
 => CACHED [build  5/14] COPY mix.exs mix.lock ./                                             0.0s
 => [build  6/14] COPY config config                                                          0.2s
 => [build  7/14] RUN mix deps.get --only prod &&     mix deps.compile                       54.2s
 => [build  8/14] COPY priv priv                                                              0.0s
 => [build  9/14] COPY assets assets                                                          0.0s
 => [build 10/14] RUN mix assets.deploy                                                       2.3s
 => [build 11/14] RUN mix phx.digest                                                          1.4s
 => [build 12/14] COPY lib lib                                                                0.0s
 => [build 13/14] COPY rel rel                                                                0.0s
 => [build 14/14] RUN mix do compile, release                                                 3.0s
 => CACHED [app 2/5] RUN apk add --no-cache libstdc++ openssl ncurses-libs                    0.0s
 => CACHED [app 3/5] WORKDIR /app                                                             0.0s
 => CACHED [app 4/5] RUN chown nobody:nobody /app                                             0.0s
 => [app 5/5] COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/app ./             0.2s
 => exporting to image                                                                        0.2s
 => => exporting layers                                                                       0.2s
 => => writing image sha256:cd7784ee671f6ae4dfb1035bc5809360c43fae35c55c58578c103831965f6987  0.0s
 => => naming to registry.fly.io/gogs-demo:deployment-1652430611                              0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/gogs-demo]
2643d50a555d: Pushed
18c9d9e3d463: Layer already exists
6730b158cab8: Layer already exists
79ee22496eec: Layer already exists
0f7b3ff8b310: Layer already exists
deployment-1652430611: digest: sha256:622e88f7b825a004a303d1721c896aab1e7beaaaf0c24d22886e7662856def23 size: 1364
--> Pushing image done
image: registry.fly.io/gogs-demo:deployment-1652430611
image size: 23 MB
==> Creating release
--> release v10 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment

 1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 1 total, 1 passing]
--> v10 deployed successfully

But the app throws the following error: https://gogs-demo.fly.dev/
image

2022-05-13T08:32:06Z app[416650a5] lhr [info]Server: gogs-demo.fly.dev:80 (http)
2022-05-13T08:32:06Z app[416650a5] lhr [info]Request: GET /
2022-05-13T08:32:06Z app[416650a5] lhr [info]** (exit) an exception was raised:
2022-05-13T08:32:06Z app[416650a5] lhr [info]    ** (CaseClauseError) no case clause matching: []
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (hackney 1.18.1) /app/deps/hackney/src/hackney_url.erl:248: :hackney_url.parse_netloc/2
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (hackney 1.18.1) /app/deps/hackney/src/hackney.erl:351: :hackney.request/5
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (httpoison 1.8.1) lib/httpoison/base.ex:846: HTTPoison.Base.request/6
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (gogs 1.0.1) lib/gogs.ex:105: Gogs.remote_render_markdown_html/4
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:9: AppWeb.PageController.index/2
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:1: AppWeb.PageController.action/2
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:1: AppWeb.PageController.phoenix_controller_pipeline/2
2022-05-13T08:32:06Z app[416650a5] lhr [info]        (phoenix 1.6.8) lib/phoenix/router.ex:354: Phoenix.Router.__call__/2
2022-05-13T08:32:34Z runner[00d6e7f5] lhr [info]Shutting down virtual machine
2022-05-13T08:32:34Z app[00d6e7f5] lhr [info]Sending signal SIGTERM to main child process w/ PID 515
2022-05-13T08:32:34Z app[00d6e7f5] lhr [info]08:32:34.380 [info] SIGTERM received - shutting down
2022-05-13T08:32:37Z app[00d6e7f5] lhr [info]Main child exited normally with code: 0
2022-05-13T08:32:37Z app[00d6e7f5] lhr [info]Starting clean up.
2022-05-13T08:32:47Z app[416650a5] lhr [info]08:32:47.489 request_id=Fu6dBzAgTKuegE8AAADh [info] GET /
2022-05-13T08:32:47Z app[416650a5] lhr [info]08:32:47.489 request_id=Fu6dBzAgTKuegE8AAADh [info] Sent 500 in 619µs
2022-05-13T08:32:47Z app[416650a5] lhr [info]08:32:47.490 [error] #PID<0.1491.0> running AppWeb.Endpoint (connection #PID<0.1490.0>, stream id 1) terminated
2022-05-13T08:32:47Z app[416650a5] lhr [info]Server: gogs-demo.fly.dev:80 (http)
2022-05-13T08:32:47Z app[416650a5] lhr [info]Request: GET /
2022-05-13T08:32:47Z app[416650a5] lhr [info]** (exit) an exception was raised:
2022-05-13T08:32:47Z app[416650a5] lhr [info]    ** (CaseClauseError) no case clause matching: []
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (hackney 1.18.1) /app/deps/hackney/src/hackney_url.erl:248: :hackney_url.parse_netloc/2
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (hackney 1.18.1) /app/deps/hackney/src/hackney.erl:351: :hackney.request/5
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (httpoison 1.8.1) lib/httpoison/base.ex:846: HTTPoison.Base.request/6
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (gogs 1.0.1) lib/gogs.ex:105: Gogs.remote_render_markdown_html/4
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:9: AppWeb.PageController.index/2
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:1: AppWeb.PageController.action/2
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (app 0.1.0) lib/app_web/controllers/page_controller.ex:1: AppWeb.PageController.phoenix_controller_pipeline/2
2022-05-13T08:32:47Z app[416650a5] lhr [info]        (phoenix 1.6.8) lib/phoenix/router.ex:354: Phoenix.Router.__call__/2

@SimonLab
Copy link
Member

SimonLab commented May 13, 2022

flyctl secrets list
image
missing some environment variables.

However because some environment variables are defined in fly.toml, I don't think we are really missing environment variables:

gogs-demo/fly.toml

Lines 38 to 43 in dd0ac26

[env]
PHX_HOST = "gogs-demo.fly.dev"
PORT = "4000"
LOG_LEVEL = "debug"
GOGS_URL = "gogs-server.fly.dev"
GOGS_SSH_PORT = 10022

We can see the list of all the environment variables with fly ssh console -C "env"
see https://community.fly.io/t/fetch-running-instance-environment/1553

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

Deployed: https://gogs-demo.fly.dev/ 🚀
image

Working. ✅

nelsonic added a commit that referenced this issue May 13, 2022
@nelsonic nelsonic assigned SimonLab and unassigned nelsonic May 13, 2022
@nelsonic nelsonic added the awaiting-review An issue or pull request that needs to be reviewed label May 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting-review An issue or pull request that needs to be reviewed chore a tedious but necessary task often paying technical debt enhancement New feature or request priority-1 Highest priority issue. This is costing us money every minute that passes. T1h Time Estimate 1 Hour
Projects
None yet
Development

No branches or pull requests

2 participants