How can I run executable release build in phoenix? - deployment

We are using distillery to create an executable build release in our
phoenix application. We are using docker to deploy our application on Digital Ocean. Since we don't want to share code with the other machine we want to execute the build compiled file as executable which we can run on some remote machine through command line.
So after some research we found that distillery plugin build executable release which creates a build using
mix release --executable
We are able to create the release. It provides three command to run these
punitjain#apple:project$ _build/dev/rel/project/bin/project foreground
punitjain#apple:project$ _build/dev/rel/project/bin/project start
punitjain#apple:project$ _build/dev/rel/project/bin/project console
I am getting following error after running foreground command
> $ _build/dev/rel/project/bin/project foreground [info] Application
> project exited: Project.start(:normal, []) returned an error:
> shutdown: failed to start child: Project.Endpoint
> ** (EXIT) shutdown: failed to start child: Phoenix.CodeReloader.Server
> ** (EXIT) an exception was raised:
> ** (UndefinedFunctionError) function Mix.Project.config/0 is undefined (module Mix.Project is not available)
> Mix.Project.config()
> (phoenix) lib/phoenix/code_reloader/server.ex:29: Phoenix.CodeReloader.Server.init/1
> (stdlib) gen_server.erl:328: :gen_server.init_it/6
> (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 {"Kernel pid
> terminated",application_controller,"{application_start_failure,project,{{shutdown,{failed_to_start_child,'Elixir.Project.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.CodeReloader.Server',{undef,[{'Elixir.Mix.Project',config,[],[]},{'Elixir.Phoenix.CodeReloader.Server',init,1,[{file,\"lib/phoenix/code_reloader/server.ex\"},{line,29}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}}},{'Elixir.Project',start,[normal,[]]}}}"}
>
> Crash dump is being written to: erl_crash.dump...done Kernel pid
> terminated (application_controller)
> ({application_start_failure,project,{{shutdown,{failed_to_start_child,'Elixir.Project.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.Code
Can you please help me how to resolve this error?
I would also be very happy to hear if anyone is having any better approach to create an executable release file. Which I can use in any Linux based system to deploy without exposing my source code using Docker.
Please let me know if I need to provide more information or do any amendments in question asked.
thanks

The problem is that you are building a release with MIX_ENV=dev, with Phoenix this will mean that the code reloader is included, and the code reloader does not work within a release. You should either build the release with MIX_ENV=prod or disable the code reloader in dev.

Related

Haskell Stack Persistent error, cannot find -llibpq

I have set up a project, which uses Servant and Persistent, using a PostgreSQL backed. Everything works fine, when I run stack ghci, including migration, but when I run stack build, I get the following error:
Linking .stack-work\dist\29cc6475\build\ServantAuthTraining-exe\ServantAuthTraining-exe.exe ...
C://Users//Chris//AppData//Local//Programs//stack//x86_64-windows//ghc-8.8.3//mingw//bin/ld.exe: cannot find -llibpq
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
-- While building package ServantAuthTraining-0.1.0.0 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build lib:ServantAuthTraining exe:ServantAuthTraining-exe --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
I am on windows, and very new to all of the mentioned techs.
I can connect to the database via pgAdmin.
You likely need to pass something like --extra-include-dirs=C:\PostgreSQL\8.4\include --extra-lib-dirs=C:\PostgreSQL\8.4\lib (or whatever path) to stack so it knows where to find libpq. This can also be configured in your stack.yaml as described at https://docs.haskellstack.org/en/latest/yaml_configuration/#extra-include-dirsextra-lib-dirs.

IBM mobile first development server unable to start in eclipse?

Ibm mobilefirst development server failed to start showing error
objc[77281]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
/Users/test/Documents/sathyarajworkspace/eclipse/plugins/com.worklight.worklight-artifacts_7.1.0.00-20151012-1525/liberty/wlp/bin/server: line 764: 77281 Abort trap: 6 "${JAVA_CMD}" "$#"
Since i lost eclipse version of 6.3 i copied eclipse from another mac.
when i tried to run the development server this error shown.
i have also updated to current version of IBM MF still issue exist.
How to fix this issue in mac.
UPDATE:
killall -9 java
Killing java process worked.Thanks
The port is taken.
Try killing the Java process and then start the server again.
in command prompt, run lsof -i :10080
then kill the ports running with kill -9 <port_number>
in the "server" tab in eclipse, delete the "mobilefirst development server"
close eclipse, reopen eclipse, the server should recreate
start the server again

GConf Error: "Failed to contact configuration server ... 1: Not running within active session"

I have installed Gnumeric in CentOS 6.5, then use ssconvert command to convert .xls/.xlsx file to CSV, but I still get the following error:
$ ssconvert
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you
have stale NFS locks due to a system crash. See
http://projects.gnome.org/gconf/ for information. (Details - 1: Not
running within active session)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you
have stale NFS locks due to a system crash. See
http://projects.gnome.org/gconf/ for information. (Details - 1: Not
running within active session)
** (ssconvert:5725): WARNING **: Configured default font 'Sans 10.000000' not available, trying fallback...
** (ssconvert:5725): WARNING **: Fallback font 'Sans 10.000000' not available, trying 'fixed'...
** (ssconvert:5725): WARNING **: Even 'fixed 10' failed ?? We're going to exit now,there is something wrong with your font
configuration
Can you help me?
As this is an old question, the answer is in case someone will get the same error (like me today on CentOS 6.8), you missed to install the Sans font:
yum install gnu-free-sans-fonts
For docker alpine images this might help:
RUN apk add --update \
msttcorefonts-installer fontconfig \
ttf-opensans

DocPad plugin: odd errors when testing, hangs when including in project

I'm trying to write a DocPad plugin to import MongoDB docs into the DocPad database for use in a static website. The source code is at https://github.com/nfriedly/docpad-plugin-mongodb and it's based on https://github.com/docpad/docpad-plugin-tumblr
When I run cake test, I get this output:
cake compile
cake install
npm install (for app)
npm install (for test)
npm install (for docpad tests)
coffee compile
npm test
> docpad-plugin-mongodb#2.0.0 test c:\Users\IBM_ADMIN\docpad-plugin-mongodb
> npm run prepare_test_db && node ./out/mongodb.test.js
> docpad-plugin-mongodb#2.0.0 prepare_test_db c:\Users\IBM_ADMIN\docpad-plugin-mongodb
> mongo test/prepare_database.mongo.js
MongoDB shell version: 2.6.5
connecting to: test
connecting to: docpad_plugin_mongodb_test
mongodb
mongodb > create
notice: If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docpad.org/donate
error: An error occured:
Error: Didn't place the skeleton as the desired structure already exists
at c:\Users\IBM_ADMIN\docpad-plugin-mongodb\node_modules\docpad\out\lib\docpad.js:4107:17
at Object.cb [as oncomplete] (fs.js:168:19)
error: To report the above error, follow the guide at: http://docpad.org/bug-report
mongodb > create OK
mongodb > load plugin mongodb
mongodb > load plugin mongodb OK
mongodb > generate
mongodb > generate > action
warning: You have multiple files being written to c:\Users\IBM_ADMIN\docpad-plugin-mongodb\test\out\testData\1.json, they are:
- testData/1.json:c7
- testData/1.json:c5
Rename one of them to avoid an over-write
FAILURE: 2/3 tests ran successfully; 0 failed, 1 incomplete, 0 errors
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
c:\Users\IBM_ADMIN\docpad-plugin-mongodb\Cakefile:99
throw err;
^
Error: Process exited with error status code
at ChildProcess.<anonymous> (c:\Users\IBM_ADMIN\docpad-plugin-mongodb\Cakefile:88:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
And, when I include the module in my project, it just hangs after this:
$ docpad run
info: Welcome to DocPad v6.69.1 (local installation: c:\Users\IBM_ADMIN\watson-developer-cloud\node_modules\docpad
notice: If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docp
info: Contribute: http://docpad.org/docs/contribute
info: Plugins: eco, mongodb
info: Environment: development
info: DocPad listening to http://0.0.0.0:9778/ on directory c:\Users\IBM_ADMIN\watson-developer-cloud\out
(And if I visit localhost:9778, it just hangs and never loads a page)
It seems like it only displays logs from plugins after the first pass is complete, so I started adding throw statements to see what it was doing. It seems that it imports things from mongo successfully, and it creates the document, but when the plugin calls document.action 'load', (err) ->, that callback is never fired.
Can anyone provide some guidance on what I'm messing up and how to get things working smoothly?
Fixed it. The TaskGroup library (apparently) once had a .once('complete', callback) event that no longer works. Switching it to .done(callback) (and fixing a couple of other small bugs) got me working now.
It still gives me the "Error: Didn't place the skeleton as the desired structure already exists" but the tests all pass now, so I'll call it a win.

Capifony SSH Exception on windows - 998 error code

I am trying to setup Capifony to deploy on windows however when running cap deploy I get the following output.
Spec
ruby 2.0.0p481
capifony v2.7.0
The error message
servers: ["homestead.app"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: homestead.app (Net::SSH::Exception: Creation of file mapping failed with error: 998) connection failed for: homestead.app (Net::SSH::Exception: Creation of file mapping failed with error: 998)
If I close down pageant this issue goes away however I require pageant to load the ssh key for the github repo as it required for doing a git ls-remote locally.
Any suggestions/workarounds?
Related issues found
https://github.com/test-kitchen/test-kitchen/issues/448
Resolved my issue by using an older version of ruby (Ruby 1.9.3-p545).