Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gaurav-nelson
Created August 18, 2020 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaurav-nelson/cf2f34f604f81c2960b8b82e3d89af15 to your computer and use it in GitHub Desktop.
Save gaurav-nelson/cf2f34f604f81c2960b8b82e3d89af15 to your computer and use it in GitHub Desktop.
  1. Create a new project with flyctl init by using the default Dockerfile option.
  2. Create a new file called default.vcl with the following content:
    vcl 4.0;
    
    backend default {
        .host = "damp-sound-540.fly.dev:80";
    }
    
  3. Update the Dockerfile to use the official varnish image:
    FROM varnish:6.4 
    COPY default.vcl /etc/varnish/
    
  4. Run flyctl deploy.

Deploy command output

$ flyctl deploy
Deploying red-rain-8172
==> Validating App Configuration
--> Validating App Configuration done
Services
TCP 80/443 ⇢ 8080 

Deploy source directory '/home/gaurav/Documents/draft-blogs/option4'
Docker daemon available, performing local build...
==> Building with Dockerfile
Using Dockerfile: /home/gaurav/Documents/draft-blogs/option4/Dockerfile
Step 1/2 : FROM varnish:6.2
6.2: Pulling from library/varnish
8f91359f1fff: Pull complete 
f6aef082f8a3: Pull complete 
d22a3eb7f0e1: Pull complete 
Digest: sha256:ee5bd915be83fbbd904dcbabccd532e63921ed7eb64f19ca1e729142c002f950
Status: Downloaded newer image for varnish:6.2
 ---> c548db967416
Step 2/2 : COPY default.vcl /etc/varnish/
 ---> 493abe203471
Successfully built 493abe203471
Successfully tagged registry.fly.io/red-rain-8172:deployment-1597742893
--> Building with Dockerfile done
Image: registry.fly.io/red-rain-8172:deployment-1597742893
Image size: 181 MB
==> Pushing Image
The push refers to repository [registry.fly.io/red-rain-8172]
0d21a11c9daf: Pushed 
6de11d217364: Layer already exists 
83a982ab1439: Layer already exists 
e9dc98463cd6: Layer already exists 
deployment-1597742893: digest: sha256:71fdae028ef5007ae243f7eb96a48e665fe7c0b2a00850c767979f6130c96e4e size: 1155
--> Done Pushing Image
==> Optimizing Image
--> Done Optimizing Image
==> Creating Release
Release v1 created
Monitoring Deployment
You can detach the terminal anytime without stopping the deployment

1 desired, 1 placed, 0 healthy, 1 unhealthy
v1 failed - Failed due to unhealthy allocations - no stable job version to auto revert to

Logs

$ flyctl --app red-rain-8172 logs
2020-08-18T06:23:10.245Z 5c577215 sin [warning] Health check status changed to 'critical'
2020-08-18T06:23:10.245Z 5c577215 sin [warning] Health check status changed to 'critical'
2020-08-18T06:23:10.245Z 5c577215 sin [warning] Health check status changed to 'critical'
2020-08-18T06:23:13.176Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Starting init...
2020-08-18T06:23:13.176Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Starting init...
2020-08-18T06:23:13.176Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Starting init...
2020-08-18T06:23:13.176Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Starting init...
2020-08-18T06:23:13.186Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T06:23:13.186Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T06:23:13.186Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T06:23:13.186Z 5c577215 sin [info] [2020-08-18T06:23:13Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T06:23:13.476Z 5c577215 sin [info] Error: Could not resolve -T argument to address
2020-08-18T06:23:13.476Z 5c577215 sin [info] Error: Could not resolve -T argument to address
2020-08-18T06:23:13.476Z 5c577215 sin [info] Error: Could not resolve -T argument to address
2020-08-18T06:23:13.476Z 5c577215 sin [info] Error: Could not resolve -T argument to address
2020-08-18T06:23:13.477Z 5c577215 sin [info] Name or service not known
2020-08-18T06:23:13.477Z 5c577215 sin [info] (-? gives usage)
2020-08-18T06:23:13.477Z 5c577215 sin [info] Name or service not known
2020-08-18T06:23:13.477Z 5c577215 sin [info] Name or service not known
2020-08-18T06:23:13.477Z 5c577215 sin [info] Name or service not known
2020-08-18T06:23:13.477Z 5c577215 sin [info] (-? gives usage)
2020-08-18T06:23:13.477Z 5c577215 sin [info] (-? gives usage)
2020-08-18T06:23:13.477Z 5c577215 sin [info] (-? gives usage)
2020-08-18T06:23:14.482Z 5c577215 sin [info] [    1.601857] reboot: Restarting system
2020-08-18T06:23:14.482Z 5c577215 sin [info] [    1.601857] reboot: Restarting system
2020-08-18T06:23:14.482Z 5c577215 sin [info] [    1.601857] reboot: Restarting system
2020-08-18T06:23:14.482Z 5c577215 sin [info] [    1.601857] reboot: Restarting system
2020-08-18T06:23:21.840Z 5c577215 sin [warning] Health check status changed to 'passing'
2020-08-18T06:23:21.840Z 5c577215 sin [warning] Health check status changed to 'passing'
2020-08-18T06:23:21.840Z 5c577215 sin [warning] Health check status changed to 'passing'
2020-08-18T06:23:21.840Z 5c577215 sin [warning] Health check status changed to 'passing'
2020-08-18T09:29:31.811Z c177da8b sin [info] [2020-08-18T09:29:31Z] Starting init...
2020-08-18T09:29:31.821Z c177da8b sin [info] [2020-08-18T09:29:31Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T09:29:32.102Z c177da8b sin [info] Error: Could not resolve -T argument to address
2020-08-18T09:29:32.102Z c177da8b sin [info] Name or service not known
2020-08-18T09:29:32.102Z c177da8b sin [info] (-? gives usage)
2020-08-18T09:29:33.107Z c177da8b sin [info] [    1.596784] reboot: Restarting system
2020-08-18T09:29:41.777Z c177da8b sin [info] [2020-08-18T09:29:41Z] Starting init...
2020-08-18T09:29:41.787Z c177da8b sin [info] [2020-08-18T09:29:41Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T09:29:42.068Z c177da8b sin [info] Error: Could not resolve -T argument to address
2020-08-18T09:29:42.068Z c177da8b sin [info] Name or service not known
2020-08-18T09:29:42.069Z c177da8b sin [info] (-? gives usage)
2020-08-18T09:29:43.073Z c177da8b sin [info] [    1.593504] reboot: Restarting system
2020-08-18T09:29:51.707Z c177da8b sin [info] [2020-08-18T09:29:51Z] Starting init...
2020-08-18T09:29:51.716Z c177da8b sin [info] [2020-08-18T09:29:51Z] Running: docker-varnish-entrypoint varnishd -F -f /etc/varnish/default.vcl as root
2020-08-18T09:29:51.978Z c177da8b sin [info] (-? gives usage)
2020-08-18T09:29:51.978Z c177da8b sin [info] Error: Could not resolve -T argument to address
2020-08-18T09:29:51.978Z c177da8b sin [info] Name or service not known
2020-08-18T09:29:52.983Z c177da8b sin [info] [    1.588605] reboot: Restarting system
2020-08-18T09:29:58.448Z c177da8b sin [warning] Health check status changed to 'warning'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment