cambecc / grib2json

converts GRIB2 files to JSON
MIT License
356 stars 154 forks source link

What if I want to deploy it for a server #40

Open yarielg opened 4 years ago

yarielg commented 4 years ago

It works pretty good on local I want to deploy it as a server, so that I can get recent data as I want What are the steps to do that? mvn, java environment variables and so on

nicolas2162 commented 4 years ago

i have the same concern here

yarielg commented 4 years ago

My server is laravel and runs on gcp vm. We installed jdk8 on gcp, and moved grib2json.cmd and grib2json.jar to /usr/local/bin, so that the vm can use the command. If you navigate the grib2json in node_modules, you can find those files

and to run the command, I used this

$process = Process::fromShellCommandline(
 'grib2json -- data --names --output a.json a.grib2',
 null,
 ['JAVA_HOME' => '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java']
);

The third parameter is to set the environment variable when run the grib2json command. Note that as I run it on laravel, I didn't use npm grib2json directly

claustres commented 4 years ago

Maybe you can have a look to our fork. In https://github.com/weacast/weacast-loader we use it on a server through docker images. More specifically we install what we need in the image to run it as a global command that is used by our ETL.