Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during deploy #24

Open
minibikini opened this issue Nov 2, 2017 · 3 comments
Open

Error during deploy #24

minibikini opened this issue Nov 2, 2017 · 3 comments

Comments

@minibikini
Copy link

Hi,

Strangely, I can’t deploy java apps at all, here is what I get:

 p/n/java-test nanobox deploy dry-run                                                                  (261ms)
Preparing environment :
  ✓ Mounting codebase
--------------------------------------------------------------------------------
+ HEADS UP:
+ This is the first build for this project and will take longer than usual.
+ Future builds will pull from the cache and will be much faster.
--------------------------------------------------------------------------------
Building runtime :
  ✓ Starting docker container
  ✓ Preparing environment for build
  ✓ Gathering requirements
  ✓ Mounting cache_dirs
  ✓ Installing binaries and runtimes
  ✓ Packaging build
Compiling application :
  ✓ Starting docker container
  ✓ Preparing environment for compile
  ! Compiling code
    - Cleaning up any previous releases...
    - Copying code...
    ! FAILED TO COMPILE APP !
    Exit
     1
    Command
     su - gonano -c "cd /opt/nanobox/engine/bin; export PATH=\"/data/sbin:/data/bin:/opt/gonano/sbin:/opt/gonano/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"; export CODE_DIR=\"/app\"; export DATA_DIR=\"/data\"; export APP_DIR=\"/mnt/app\"; export CACHE_DIR=\"/mnt/cache\"; export ETC_DIR=\"/data/etc\"; export ENV_DIR=\"/data/etc/env.d\"; stdbuf -o0 /opt/nanobox/engine/bin/compile '{\"code_dir\":\"/app\",\"data_dir\":\"/data\",\"app_dir\":\"/mnt/app\",\"cache_dir\":\"/mnt/cache/app\",\"etc_dir\":\"/data/etc\",\"env_dir\":\"/data/etc/env.d\",\"config\":{}}'"
Error   : failed to execute hook (compile) on b9a806ddb15d7f3c29d71f46522ee87190736f0fdafbd83619788064b5719705: util:Exec:/opt/nanobox/hooks/compile: bad exit code(1):
Context : failed to compile the code -> failed to run the (compile)compile hook

I have tried to nanobox destroy. I've even tried to deploy an empty java app, where boxfile.yml was the only file in the project/directory and it contained these two lines only:

run.config:
  engine: java

Nanobox Version 2.3.0-171031T1616 (80207fe)
macos 10.13 High Sierra 😢

 ~ nanobox config ls
{
  "provider": "docker-machine",
  "ci-mode": false,
  "ci-sync-verbose": false,
  "mount-type": "native",
  "netfs-mount-opts": "",
  "cpus": 4,
  "ram": 4,
  "disk": 102400,
  "external-network-space": "192.168.99.50/24",
  "docker-machine-network-space": "172.21.0.1/16",
  "native-network-space": "172.20.0.1/16",
  "ssh-key": "default",
  "ssh-encrypted-keys": false,
  "anonymous": false,
  "lock-port": 12345
}
@bnunamak
Copy link

Hello,

I haven't deployed a java app yet, but I am testing with one, so I hope I can help.

What does your boxfile look like? Are you using maven as a build tool? Are you packaging your application into a final fat .jar? Are you using any kind of framework, like http://sparkjava.com/?

I generate a fat jar file with maven and have it configured so I can run a server with nanobox run "mvn exec:exec@run-app". This is my standard boxfile:

run.config:
  engine: java
  engine.config:
    runtime: oracle-jdk8
    maven_version: '3.3'

deploy.config:
  extra_steps:
    - mvn clean package

web.site:
  start: mvn exec:exec@run-app

data.queue:
  image: nanobox/redis:3.2
  config:
    databases: 4

It might be faster / get more awareness if you ask around in the #java channel on slack.

@minibikini
Copy link
Author

Hi @bnunamak,

thanks for the reply!

I'm not a java dev, I was just trying to deploy Graylog which is a bunch of jar files.

Turns out I was missing these strings:

  engine.config:
    runtime: oracle-jdk8
    gradle_version: '4.2'

So only

run.config:
  engine: java

is not enough, and engine.config is required. Not sure if it's bug or feature but it's undocumented.

Here is my boxfile for Graylog:

run.config:
  engine: java

  engine.config:
    compile: 'echo "skip compile"'
    runtime: oracle-jdk8
    gradle_version: '4.2'

  extra_path_dirs:
    - dist/bin

data.elasticsearch:
  image: nanobox/elasticsearch:5

data.mongodb:
  image: nanobox/mongodb:3.4

data.storage:
  image: nanobox/unfs

web.main:
  start: graylogctl run
  network_dirs:
    data.storage:
      - server
  ports:
    # Plaintext UDP
    - udp:5555:5555

    # nginx via Syslog UDP
    - udp:12401:12401
    - udp:12402:12402

deploy.config:
  transform:
    - bash ./setup.sh # generates config file from env vars

@rgoomar
Copy link
Contributor

rgoomar commented Dec 5, 2017

@minibikini Good catch. This is actually a use-case to allow users to disable the compile step so you can just use pre-built JARs that don't require compilation.

cc @sanderson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants