Deployment to Google Compute Engine

You did it a couple of times so far I thought… Path/to/release/hello.run foreground.

Yea. But that was in my local machine. On my macbook not in the GCE

Use ssh to connect to your instance and do the sasme over there.

Path/to/release/hello.run foreground is not exist in the GCE instance

How have you got your releases there previously? The file has to exist somewhere.

Now I get it
In the instance-startup.sh stated that it create /app and copy the file that I uploaded into my bucket
so now the file is in /app/hello-release

And I try to run it in foreground

hello_team@hello-instance:/app$ PORT=8080 ./hello-release foreground
/app/tmp/hello/releases/0.1.1/libexec/config.sh: line 54: /app/tmp/hello/var/vm.args: Permission denied

@dazuma any comment on this?

Hi,

Sorry, it’s been tough to follow all the changes here. So let me make sure I understand the current situation.

It looks like you have a GCE instance running, and it looks like your startup script instance-startup.sh has run. I can tell because, as you mentioned, it has successfully downloaded your release. Furthermore, it looks like it has successfully started your release. The Erlang VM is running. I can tell that from the output of netstat: something is listening on port 4369, which is the epmd port. However, nothing is listening on port 8080. That suggests to me that something failed during application startup, and even though OTP is running, your web server failed to start.

Can you post the startup logs for the instance? You can find the command to do so in the tutorial under the step “check the progress of instance creation” just after you create the instance. I’m hoping that any error logs, process crashes, will show up there. (If the logs are too long and the output from the original startup is buried, then delete your instance and create a new one. It should rerun the startup script for the new instance, and you can look at the output then.)

If you’re not able to find anything useful in those logs, then you could try ssh-ing into the instance and running the release manually and seeing what happens, as NobbZ suggests. However, to do that, you need to run it in another directory, not in /app. This is because it has already been extracted there and is already running there, so running it there again will probably attempt to overwrite files and cause a permissions error. (Indeed, I think that’s what you’re observing.) Instead, create a new directory and run in that new directory.

mkdir /app2  # Or wherever you have permission to create a directory
cd /app2
cp /app/hello-release ./hello-release
PORT=8080 ./hello-release foreground
1 Like

Startup logs only for startup-script

Mar 12 06:43:11 hello-instance startup-script: INFO startup-script: + RELEASE_URL=gs://hello-releases/hello-release
Mar 12 06:43:11 hello-instance startup-script: INFO startup-script: + gsutil cp gs://hello-releases/hello-release hello-release

Debian GNU/Linux 9 hello-instance ttyS0

hello-instance login: Mar 12 06:43:16 hello-instance startup-script: INFO startup-script: Copying gs://hello-releases/hello-release...
Mar 12 06:43:17 hello-instance startup-script: INFO startup-script: / [0 files][    0.0 B/ 25.4 MiB]                                                #015-#015- [0 files][  4.1 MiB/ 25.4 MiB]                                                #015\#015\ [1 files][ 25.4 MiB/ 25.4 MiB]
Mar 12 06:43:17 hello-instance startup-script: INFO startup-script: Operation completed over 1 objects/25.4 MiB.
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + chmod 755 hello-release
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: --2019-03-12 06:43:18--  https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: Resolving dl.google.com (dl.google.com)... 74.125.130.136, 74.125.130.93, 74.125.130.91, ...
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: Connecting to dl.google.com (dl.google.com)|74.125.130.136|:443... connected.
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: HTTP request sent, awaiting response... 200 OK
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: Length: 7955768 (7.6M) [application/octet-stream]
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: Saving to: ‘cloud_sql_proxy’
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:      0K .......... .......... .......... .......... ..........  0% 41.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:     50K .......... .......... .......... .......... ..........  1% 30.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    100K .......... .......... .......... .......... ..........  1% 26.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    150K .......... .......... .......... .......... ..........  2% 28.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    200K .......... .......... .......... .......... ..........  3% 31.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    250K .......... .......... .......... .......... ..........  3% 30.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    300K .......... .......... .......... .......... ..........  4% 30.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    350K .......... .......... .......... .......... ..........  5% 29.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    400K .......... .......... .......... .......... ..........  5% 31.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    450K .......... .......... .......... .......... ..........  6% 31.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    500K .......... .......... .......... .......... ..........  7% 29.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    550K .......... .......... .......... .......... ..........  7% 32.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    600K .......... .......... .......... .......... ..........  8% 30.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    650K .......... .......... .......... .......... ..........  9% 30.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    700K .......... .......... .......... .......... ..........  9% 29.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    750K .......... .......... .......... .......... .......... 10% 31.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    800K .......... .......... .......... .......... .......... 10% 31.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    850K .......... .......... .......... .......... .......... 11% 31.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    900K .......... .......... .......... .......... .......... 12% 32.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:    950K .......... .......... .......... .......... .......... 12% 31.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1000K .......... .......... .......... .......... .......... 13% 30.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1050K .......... .......... .......... .......... .......... 14% 31.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1100K .......... .......... .......... .......... .......... 14% 29.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1150K .......... .......... .......... .......... .......... 15% 28.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1200K .......... .......... .......... .......... .......... 16% 31.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1250K .......... .......... .......... .......... .......... 16% 31.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1300K .......... .......... .......... .......... .......... 17% 32.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1350K .......... .......... .......... .......... .......... 18% 30.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1400K .......... .......... .......... .......... .......... 18% 31.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1450K .......... .......... .......... .......... .......... 19% 30.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1500K .......... .......... .......... .......... .......... 19% 30.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1550K .......... .......... .......... .......... .......... 20% 32.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1600K .......... .......... .......... .......... .......... 21% 31.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1650K .......... .......... .......... .......... .......... 21% 31.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1700K .......... .......... .......... .......... .......... 22% 32.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1750K .......... .......... .......... .......... .......... 23% 31.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1800K .......... .......... .......... .......... .......... 23% 30.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1850K .......... .......... .......... .......... .......... 24% 32.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1900K .......... .......... .......... .......... .......... 25% 27.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   1950K .......... .......... .......... .......... .......... 25% 32.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2000K .......... .......... .......... .......... .......... 26% 29.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2050K .......... .......... .......... .......... .......... 27% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2100K .......... .......... .......... .......... .......... 27% 43.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2150K .......... .......... .......... .......... .......... 28% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2200K .......... .......... .......... .......... .......... 28% 41.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2250K .......... .......... .......... .......... .......... 29% 42.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2300K .......... .......... .......... .......... .......... 30% 42.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2350K .......... .......... .......... .......... .......... 30% 38.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2400K .......... .......... .......... .......... .......... 31% 41.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2450K .......... .......... .......... .......... .......... 32% 46.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2500K .......... .......... .......... .......... .......... 32% 40.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2550K .......... .......... .......... .......... .......... 33% 40.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2600K .......... .......... .......... .......... .......... 34% 42.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2650K .......... .......... .......... .......... .......... 34% 40.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2700K .......... .......... .......... .......... .......... 35% 42.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2750K .......... .......... .......... .......... .......... 36% 38.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2800K .......... .......... .......... .......... .......... 36% 44.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2850K .......... .......... .......... .......... .......... 37% 42.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2900K .......... .......... .......... .......... .......... 37% 43.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   2950K .......... .......... .......... .......... .......... 38% 40.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3000K .......... .......... .......... .......... .......... 39% 39.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3050K .......... .......... .......... .......... .......... 39% 42.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3100K .......... .......... .......... .......... .......... 40% 46.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3150K .......... .......... .......... .......... .......... 41% 38.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3200K .......... .......... .......... .......... .......... 41% 36.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3250K .......... .......... .......... .......... .......... 42% 38.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3300K .......... .......... .......... .......... .......... 43% 38.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3350K .......... .......... .......... .......... .......... 43% 40.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3400K .......... .......... .......... .......... .......... 44% 41.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3450K .......... .......... .......... .......... .......... 45% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3500K .......... .......... .......... .......... .......... 45% 40.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3550K .......... .......... .......... .......... .......... 46% 41.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3600K .......... .......... .......... .......... .......... 46% 43.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3650K .......... .......... .......... .......... .......... 47% 40.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3700K .......... .......... .......... .......... .......... 48% 40.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3750K .......... .......... .......... .......... .......... 48% 35.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3800K .......... .......... .......... .......... .......... 49% 41.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3850K .......... .......... .......... .......... .......... 50% 40.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3900K .......... .......... .......... .......... .......... 50% 46.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   3950K .......... .......... .......... .......... .......... 51% 38.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4000K .......... .......... .......... .......... .......... 52% 39.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4050K .......... .......... .......... .......... .......... 52% 42.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4100K .......... .......... .......... .......... .......... 53% 43.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4150K .......... .......... .......... .......... .......... 54% 41.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4200K .......... .......... .......... .......... .......... 54% 44.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4250K .......... .......... .......... .......... .......... 55% 40.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4300K .......... .......... .......... .......... .......... 55% 36.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4350K .......... .......... .......... .......... .......... 56% 37.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4400K .......... .......... .......... .......... .......... 57% 38.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4450K .......... .......... .......... .......... .......... 57% 37.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4500K .......... .......... .......... .......... .......... 58% 37.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4550K .......... .......... .......... .......... .......... 59% 39.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4600K .......... .......... .......... .......... .......... 59% 39.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4650K .......... .......... .......... .......... .......... 60% 45.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4700K .......... .......... .......... .......... .......... 61% 43.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4750K .......... .......... .......... .......... .......... 61% 39.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4800K .......... .......... .......... .......... .......... 62% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4850K .......... .......... .......... .......... .......... 63% 40.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4900K .......... .......... .......... .......... .......... 63% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   4950K .......... .......... .......... .......... .......... 64% 38.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5000K .......... .......... .......... .......... .......... 64% 43.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5050K .......... .......... .......... .......... .......... 65% 42.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5100K .......... .......... .......... .......... .......... 66% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5150K .......... .......... .......... .......... .......... 66% 29.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5200K .......... .......... .......... .......... .......... 67% 35.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5250K .......... .......... .......... .......... .......... 68% 33.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5300K .......... .......... .......... .......... .......... 68% 39.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5350K .......... .......... .......... .......... .......... 69% 38.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5400K .......... .......... .......... .......... .......... 70% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5450K .......... .......... .......... .......... .......... 70% 40.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5500K .......... .......... .......... .......... .......... 71% 42.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5550K .......... .......... .......... .......... .......... 72% 37.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5600K .......... .......... .......... .......... .......... 72% 46.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5650K .......... .......... .......... .......... .......... 73% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5700K .......... .......... .......... .......... .......... 74% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5750K .......... .......... .......... .......... .......... 74% 39.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5800K .......... .......... .......... .......... .......... 75% 40.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5850K .......... .......... .......... .......... .......... 75% 42.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5900K .......... .......... .......... .......... .......... 76% 47.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   5950K .......... .......... .......... .......... .......... 77% 34.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6000K .......... .......... .......... .......... .......... 77% 39.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6050K .......... .......... .......... .......... .......... 78% 37.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6100K .......... .......... .......... .......... .......... 79% 41.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6150K .......... .......... .......... .......... .......... 79% 38.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6200K .......... .......... .......... .......... .......... 80% 41.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6250K .......... .......... .......... .......... .......... 81% 41.7M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6300K .......... .......... .......... .......... .......... 81% 45.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6350K .......... .......... .......... .......... .......... 82% 37.3M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6400K .......... .......... .......... .......... .......... 83% 42.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6450K .......... .......... .......... .......... .......... 83% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6500K .......... .......... .......... .......... .......... 84% 40.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6550K .......... .......... .......... .......... .......... 84% 39.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6600K .......... .......... .......... .......... .......... 85% 42.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6650K .......... .......... .......... .......... .......... 86% 46.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6700K .......... .......... .......... .......... .......... 86% 41.0M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6750K .......... .......... .......... .......... .......... 87% 35.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6800K .......... .......... .......... .......... .......... 88% 37.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6850K .......... .......... .......... .......... .......... 88% 42.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6900K .......... .......... .......... .......... .......... 89% 42.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   6950K .......... .......... .......... .......... .......... 90% 39.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7000K .......... .......... .......... .......... .......... 90% 47.2M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7050K .......... .......... .......... .......... .......... 91% 42.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7100K .......... .......... .......... .......... .......... 92% 42.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7150K .......... .......... .......... .......... .......... 92% 37.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7200K .......... .......... .......... .......... .......... 93% 41.8M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7250K .......... .......... .......... .......... .......... 93% 41.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7300K .......... .......... .......... .......... .......... 94% 37.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7350K .......... .......... .......... .......... .......... 95% 42.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7400K .......... .......... .......... .......... .......... 95% 40.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7450K .......... .......... .......... .......... .......... 96% 40.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7500K .......... .......... .......... .......... .......... 97% 42.1M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7550K .......... .......... .......... .......... .......... 97% 38.6M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7600K .......... .......... .......... .......... .......... 98% 43.4M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7650K .......... .......... .......... .......... .......... 99% 38.5M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7700K .......... .......... .......... .......... .......... 99% 46.9M 0s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script:   7750K .......... .........                                  100% 23.7M=0.2s
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: 2019-03-12 06:43:18 (37.4 MB/s) - ‘cloud_sql_proxy’ saved [7955768/7955768]
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + chmod +x cloud_sql_proxy
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + mkdir /tmp/cloudsql
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + curl -s http://metadata.google.internal/computeMetadata/v1/project/project-id -H Metadata-Flavor: Google
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + PROJECT_ID=hello-project
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + PORT=8080 ./hello-release start
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: + ./cloud_sql_proxy -projects=hello-project -dir=/tmp/cloudsql
Mar 12 06:43:18 hello-instance startup-script: INFO startup-script: 2019/03/12 06:43:18 Rlimits for file descriptors set to {&{8500 8500}}
Mar 12 06:43:23 hello-instance startup-script: INFO startup-script: 2019/03/12 06:43:23 Listening on /tmp/cloudsql/hello-project:asia-southeast1:hello-db/.s.PGSQL.5432 for hello-project:asia-southeast1:hello-db
Mar 12 06:43:23 hello-instance startup-script: INFO startup-script: 2019/03/12 06:43:23 Ready for new connections


Specify --start=98363 in the next get-serial-port-output invocation to get only the new output starting from here.

I tried to copy the release into another folder and start the application
BTW I need to sudo create a new folder and copy the release
I also sudo to start the application on foreground

hello_team@hello-instance:/app2$ sudo PORT=8080 ./hello-release foreground
2019-03-12 07:00:43.078660 Error in process ~p on node ~p with exit value:~n~p~n
        <0.1541.0>
        'hello@127.0.0.1'
        {#{'__exception__'=>true,'__struct__'=>'Elixir.RuntimeError',message=><<65,110,32,101,114,114,111,114,32,111,99,99,117,114,114,101,100,32,119,104,101,110,32,108,111,97,100,105,110,103,32,66,99,114,121,112,11
6,46,10,77,97,107,101,32,115,117,114,101,32,121,111,117,32,104,97,118,101,32,97,32,67,32,99,111,109,112,105,108,101,114,32,97,110,100,32,69,114,108,97,110,103,32,50,48,32,105,110,115,116,97,108,108,101,100,46,10,73,
102,32,121,111,117,32,97,114,101,32,110,111,116,32,117,115,105,110,103,32,69,114,108,97,110,103,32,50,48,44,32,101,105,116,104,101,114,32,117,112,103,114,97,100,101,32,116,111,32,69,114,108,97,110,103,32,50,48,32,11
1,114,10,117,115,101,32,118,101,114,115,105,111,110,32,48,46,49,50,32,111,102,32,98,99,114,121,112,116,95,101,108,105,120,105,114,46,10,83,101,101,32,116,104,101,32,67,111,109,101,111,110,105,110,32,119,105,107,105,
32,102,111,114,32,109,111,114,101,32,105,110,102,111,114,109,97,116,105,111,110,46,10>>},[{'Elixir.Bcrypt.Base',init,0,[{file,"lib/bcrypt/base.ex"},{line,17}]},{init,'-run_on_load_handlers/2-fun-0-',1,[]}]}
2019-03-12 07:00:43.079253 crash_report        #{label=>{proc_lib,crash},report=>[[{initial_call,{supervisor,kernel,['Argument__1']}},{pid,<0.1540.0>},{registered_name,[]},{error_info,{exit,{on_load_function_failed,
'Elixir.Bcrypt.Base'},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,212}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,295}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,
374}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[kernel_sup,<0.1515.0>]},{message_queue_len,0},{messages,[]},{links,[<
0.1517.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,273}],[]]}
2019-03-12 07:00:43.079284 supervisor_report   #{label=>{supervisor,start_error},report=>[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{on_load_function_failed,'Elixir.Bcrypt.Base'}},{offender,
[{pid,undefined},{id,kernel_safe_sup},{mfargs,{supervisor,start_link,[{local,kernel_safe_sup},kernel,safe]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
2019-03-12 07:00:44.097352 crash_report        #{label=>{proc_lib,crash},report=>[[{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.1514.0>},{registered_name
,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,'Elixir.Bcrypt.Base'}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{lin
e,138}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[<0.1513.0>]},{message_queue_len,1},{messages,[{'EXIT',<0.1515.0>,normal}]},{links,[<0.1513.0>,<0.1511.0>]},{dictionary,[]},{tra
p_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,193}],[]]}
2019-03-12 07:00:44.103672 std_info            #{label=>{application_controller,exit},report=>[{application,kernel},{exited,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,'Elixir.Bcrypt.B
ase'}}},{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,'Elixir.Bcrypt.Base'}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,'Elixir.Bcrypt.Base'}}},{kernel,start,[norm

Crash dump is being written to: erl_crash.dump...done

On a first glance this looks like the elixir_bcrypt library was unable to start due to a problem with loading the necessary NIFs.

I guess so. But elixir_bcrypt documentation only mention Alpine image and Vagrant here.
My current Dockerfile is using Debian 8 see here

Im guessing I cannot use Debian 8 for my deployment? Or is there a workaround for this issue?

You have the image, as soon as you can run that one locally, it should do on the remote as well.

But as you are using NIFs, I’m not sure if the NIF or its dependencies are included in the file you uploaded. Or if it is even built for the correct system. As far as I understood, you are building the release on a Mac and you then upload it. So, if the NIF is included, then its binary incompatible with the x64 running your application.

The same issue with this?

Since I do not know how exactly you are building the release, I do not know if it is the same issue. Its only as assumption that you have a mismatch of architecture.

So the easiest is probably to start telling us how you build the release. Are you building it on your host, in a VM, in a docker container, on a build host, something else?

1 Like
  1. Build a release configuration using Distillery mix release.init
  2. Build the assets
  3. Build the release by MIX_ENV=prod mix release --env=prod --executable
  4. Test my release locally on my Mac PORT=8080 _build/prod/rel/hello/bin/hello.run foreground
  5. Build the image for the necessary tools to build a release docker build -t hello-builder . inside /builder
  6. Build the release using Docker docker run --rm -it -v $(pwd):/app hello-builder
  7. Copy the release to my cloud storage
  8. Create a GCE instance and run the startup script to read the file in my cloud storage

Do not do this!

This will also put your artifacts created by your MAC into the container, and the containerized buildtools will actually not do anything because it seems as if everything is in place already. Those tools are not aware of the change of the architecture.

Please do a proper COPY during the docker build step before and do not use a volume. Also make sure that _build and deps are in your .dockerignore.

Do not do this!

Actually, it’s fine. The tutorial explicitly tells you to mix clean --deps before building in docker, in order to prevent artifacts built on the mac from leaking into the release. Just don’t skip that step.

Also:

Please do a proper COPY

Again, no. In the tutorial, you need to get the built release archive outside of docker so you can upload it to cloud storage. So, use a volume as the tutorial specifies.

(I think NobbZ is suggesting an alternative: COPY the app into the docker container (using .dockerignore to prevent Mac-built artifacts from leaking in) rather than mounting a volume. But then this requires you to upload to GCS from docker as well, which means you need to obtain GCS credentials and pass those into the container. This can be done, but it seemed complicated for the tutorial, so I went with the volume approach. You’re right that this can cause confusion for other reasons because you have to clean out builds every time you switch architectures. I’ll think about how we can improve that. But for now the tutorial as written should work.)

We have had a lot of problems discussed here in the forum because of the really bad advice to use volumes here.

Im strictly against using them but prefer to advice to use a pristine container for each build and using docker cp to extract artifacts.

I do not care for the tutorial. If it is giving the advice to do something that is unidiomatic, then I give an advice to do it the idiomatic way.

This will cause a lot less trouble than using a volume incorrectly.

PS: Due to how the compilation of bcrypt_elixir works, mix clean --deps is not enough, since this will only clean artifacts in _build but the actual object file and therefore the file containing the NIF is in deps. So if you insist on the volume, then you have to explicitely rm -rf deps _build.

@NobbZ That’s fine. I’ll consider reworking that part of the tutorial to use docker cp rather than mounting the directory. (Honestly, I was probably not aware of the availability of docker cp when the tutorial was written a year and a half ago.)

That said, because azimlord is working from the tutorial, if we give advice to change the procedure, I think it would help him if we were a bit more specific about what changes we are suggesting and how that might affect subsequent steps. A simple “Do not do this” is a bit scary and doesn’t help someone understand what they do need to do.

Edit: I just saw the PS that you added. That I did not know. Thanks for pointing that out. That’s probably a good argument for avoiding the volume technique.

@azimlord Sorry for the churn on this. I’m not 100% sure the issue is with the architecture of the built NIFs. I’m having a bit of a hard time parsing the log that you posted. If it is the problem, then again, make sure you clean out all the builds (e.g. mix clean --deps, and try also rm -rf deps _build as NobbZ mentions in his PS) before doing the docker run, so that stuff built on your Mac doesn’t leak into your release. That should fix it.

Alternatively, you can modify the procedure as NobbZ has suggested, and avoid mounting your app directory as a volume. That would involve modifying the Dockerfile to copy the app directory (with a suitable .dockerignore to skip the build and deps directories), and then using docker cp to get the hello.run output out of the resulting container. If you’re not sure how to go about doing this, let us know, and I’m sure either NobbZ or I could provide more detailed steps.

On the off-chance that it’s not the NIFs, another thing you can look at is the actual logs emitted by the application at startup. These are probably in the /app/tmp/hello/var/log directory. (Might be called something like erlang.log.1) and see if it looks like the same error as what you posted above.

1 Like

@NobbZ @dazuma
Im not sure if Im doing this correctly or not

  1. Build a release configuration using Distillery mix release.init
  2. Build and digest assets
  3. Build the release by MIX_ENV=prod mix release --env=prod --executable
  4. Test my release locally on my Mac PORT=8080 _build/prod/rel/hello/bin/hello.run foreground
  5. Build the image for the necessary tools to build a release docker build -t hello-builder . inside /builder
  6. Build and digest assets
  7. mix clean --deps
  8. rm -rf deps _build
  9. Build the release using Docker docker run --rm -it -v $(pwd):/app hello-builder
Muhammads-MacBook-Pro:hello Azim$ mix clean --deps
Muhammads-MacBook-Pro:hello Azim$ rm -rf deps _build
Muhammads-MacBook-Pro:hello Azim$ docker run --rm -it -v $(pwd):/app hello-builder
Unchecked dependencies for environment prod:
* bcrypt_elixir (Hex package)
  the dependency is not available, run "mix deps.get"
* ecto_sql (Hex package)
  the dependency is not available, run "mix deps.get"
* gettext (Hex package)
  the dependency is not available, run "mix deps.get"
* jason (Hex package)
  the dependency is not available, run "mix deps.get"
* comeonin (Hex package)
  the dependency is not available, run "mix deps.get"
* bamboo (Hex package)
  the dependency is not available, run "mix deps.get"
* geo_postgis (Hex package)
  the dependency is not available, run "mix deps.get"
* phoenix_html (Hex package)
  the dependency is not available, run "mix deps.get"
* phoenix_pubsub (Hex package)
  the dependency is not available, run "mix deps.get"
* edeliver (Hex package)
  the dependency is not available, run "mix deps.get"
* phoenix (Hex package)
  the dependency is not available, run "mix deps.get"
* postgrex (Hex package)
  the dependency is not available, run "mix deps.get"
* distillery (Hex package)
  the dependency is not available, run "mix deps.get"
* plug_cowboy (Hex package)
  the dependency is not available, run "mix deps.get"
* phoenix_ecto (Hex package)
  the dependency is not available, run "mix deps.get"
** (Mix) Can't continue due to errors on dependencies

Im not sure how to do the alternate way. I would like to know how

BTW the logs in /app/tmp/hello/var/log/erlang.log.1 is the same as the one that I posted above