Problem deploying Phoenix app to Gigalixir: "No file named server#127.0.0.1" - phoenix-framework

I am trying to deploy Hashrockets TIL Phoenix App to Gigalixir.
This is what I get after push to Gigalixir:
2020-08-23T05:58:55.071975+00:00 til[gigalixir-run]: Attempting to start 'til' on host 'til-6c4c5d7854-ddpfh'
2020-08-23T05:58:55.071987+00:00 til[gigalixir-run]: Attempting health checks on port 4000
2020-08-23T05:58:55.874467+00:00 til[til-6c4c5d7854-ddpfh]: web.1 | started with pid 49
2020-08-23T05:58:57.568099+00:00 til[til-6c4c5d7854-ddpfh]: web.1 | No file named server#127.0.0.1
2020-08-23T05:58:57.976006+00:00 til[til-6c4c5d7854-ddpfh]: web.1 | exited with code 1
2020-08-23T05:58:57.976034+00:00 til[til-6c4c5d7854-ddpfh]: system | sending SIGTERM to all processes
I cannot make sense of the error message No file named server#127.0.0.1. What can I do now?

The reason for this problem is, that the Procfile coming with the project is probably meant to be used with Heroku and contains
web: MIX_ENV=prod elixir --cookie $OTP_COOKIE --name server#127.0.0.1 --erl '-kernel inet_dist_listen_min 9000' --erl '-kernel inet_dist_listen_max 9000' -S mix phx.server
Renaming the file to Procfile.disabled and thus making Gigalixir use its default Procfile solves this problem.

Related

pdm-installed streamlit fails to launch a server

I have installed streamlit on my Mac with pdm and launched the command streamlit hello to view the demos. The command returns the following:
❯ pdm run streamlit hello
2022-03-21 11:43:45.812 WARNING streamlit.config:
Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.
As a result, 'server.enableCORS' is being overridden to 'true'.
More information:
In order to protect against CSRF attacks, we send a cookie with each request.
To do so, we must specify allowable origins, which places a restriction on
cross-origin resource sharing.
If cross origin resource sharing is required, please disable server.enableXsrfProtection.
2022-03-21 11:43:45.816 DEBUG streamlit.logger: Initialized tornado logs
2022-03-21 11:43:45.818 DEBUG matplotlib.pyplot: Loaded backend agg version unknown.
2022-03-21 11:43:45.819 DEBUG streamlit.bootstrap: Setting up signal handler
2022-03-21 11:43:45.819 DEBUG asyncio: Using selector: KqueueSelector
2022-03-21 11:43:45.827 DEBUG streamlit.server.server: Starting server...
2022-03-21 11:43:45.827 DEBUG streamlit.server.server: Serving static content from the Node dev server
2022-03-21 11:43:45.830 DEBUG streamlit.server.server: Server started on port 8501
2022-03-21 11:43:45.831 DEBUG streamlit.server.server: Server state: State.INITIAL -> State.WAITING_FOR_FIRST_BROWSER
2022-03-21 11:43:46.029 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.041 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.054 DEBUG git.cmd: Popen(['git', 'version'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
2022-03-21 11:43:46.066 DEBUG git.cmd: Popen(['git', 'rev-parse', '--show-toplevel'], cwd=<my/working/directory>, universal_newlines=False, shell=None, istream=None)
Welcome to Streamlit. Check out our demo in your browser.
Local URL: http://localhost:3000
Network URL: http://192.168.1.117:3000
Ready to create your own Python apps super quickly?
Head over to https://docs.streamlit.io
May you create awesome apps!
However, when I connect to the local URL, the connection is rejected:
I tried switching to Brave Browser and Firefox, but I got the same error.
From other SO questions, I tried the following:
❯ apachectl configtest
AH00557: httpd: apr_sockaddr_info_get() failed for Lucas-MacBook-Air.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
I also ran this:
ps -ax | grep 'httpd'
124 ?? 0:00.85 /usr/sbin/httpd -D FOREGROUND
517 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
6627 ttys002 0:00.01 grep httpd
I tried launching other stuff that creates a local server, e.g. Jupyter Notebooks, and they work.
The problem is known: streamlit does not support pdm at the time of writing, as mentioned by #cye18 on the parallel issue opened on pdm's github page.
The problem is that, while streamlit configs default to server port 8501, the server is launched on the port 3000. You can force this behaviour in two ways.
The first is by manually changing streamlit's settings, which lies in ~/.streamlit/config.toml or locally in your project directory.
[server]
serverPort = 8501
Alternatively, you can add the following flag to the streamlit command when launching it:
pdm run streamlit run app.py --server.port 8501
Either way, streamlit will complain by saying that server.port does not work when global.developmentMode is true. Once again, this can be solved by adding the flag --global.developmentMode false. The final command will look like this: pdm run streamlit run app.py --server.port 8501 --global.developmentMode false.
Alternatively, the local settings will look like the following:
[server]
port = 8501
[global]
developmentMode = false

Warning: require(/var/www/vendor/autoload.php):

I am good with API creation but not so good when it comes to set up the system, I was trying to learn setting laravel with docker and was referring:
https://medium.com/#shakyShane/laravel-docker-part-1-setup-for-development-e3daaefaf3c
I followed all the steps correctly but on running:
docker-compose exec app php artisan key:generate
I am getting error:
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
Am I wrong to assume that this problem is because the composer hasn't run!!
My Project folder is in Desktop
my docker-compose.yml is written like:
# The Application
`app:`
`build:`
`context: ./`
`dockerfile: app.dockerfile`
`working_dir: /var/www`
`volumes:`
`- ./:/var/www``
` environment:`
`- "DB_PORT=3306"`
`- "DB_HOST=database"`
# The Web Server
`web:`
`build:`
`context: ./`
`dockerfile: web.dockerfile`
`working_dir: /var/www`
`volumes_from:`
`- app`
`ports:`
`- 8080:80`
I checked other solutions on the web but I couldn't quite understand how I need to do.
I think it is not a good idea to follow the steps provided in the website since the
composer image is DEPRECATED
you must use the newest one from here

Try to update hyperledger-composer version,but still not compatible with the client version

I just a new beginner of Hyperledger Composer.So I try to deploy REST server using Docker by following this guide
Deploying the REST server for a business network
Then when i run docker, it show this error on docker logs
docker logs rest
0|composer | WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
0|composer | WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
0|composer | Discovering types from business network definition ...
0|composer | D0831 07:04:36.180952003 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | D0831 07:04:37.574385287 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | Connection fails: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | It will be retried for the next request.
0|composer | Exception: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | at _checkRuntimeVersions.then.catch (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
PM2 | App [composer-rest-server] with id [0] and pid [24], exited with code [1] via signal [SIGINT]
PM2 | Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
PM2 | App name:composer-rest-server id:0 online
So i try to update the version by following on this guide on the same doc
Updating Hyperledger Composer
But after I stop/reboot fabric, redeploy the chaincode again and run the docker, the error still exist.
Can anyone please tell me what i've missing?
Note: I try this solution too but still have the same problem.
Ok i've solve the problem. I remove all docker image and start new fabric to download image again,and it works!!
docker rmi $(docker images -q)

Erlang/Webmachine doesn't start on heroku

I've been trying to setup a Webmachine app on Heroku, using the buildpack recommended. My Procfile is
# Procfile
web: sh ./rel/app_name/bin/app_name console
Unfortunately this doesn't start the dyno correctly, it fails with
2015-12-08T16:34:55.349362+00:00 heroku[web.1]: Starting process with command `sh ./rel/app_name/bin/app_name console`
2015-12-08T16:34:57.387620+00:00 app[web.1]: Exec: /app/rel/app_name/erts-7.0/bin/erlexec -boot /app/rel/app_name/releases/1/app_name -mode embedded -config /app/rel/app_name/releases/1/sys.config -args_file /app/rel/app_name/releases/1/vm.args -- console
2015-12-08T16:34:57.387630+00:00 app[web.1]: Root: /app/rel/app_name
2015-12-08T16:35:05.396922+00:00 app[web.1]: 16:35:05.396 [info] Application app_name started on node 'app_name#127.0.0.1'
2015-12-08T16:35:05.388846+00:00 app[web.1]: 16:35:05.387 [info] Application lager started on node 'app_name#127.0.0.1'
2015-12-08T16:35:05.399281+00:00 app[web.1]: Eshell V7.0 (abort with ^G)
2015-12-08T16:35:05.399283+00:00 app[web.1]: (app_name#127.0.0.1)1> *** Terminating erlang ('app_name#127.0.0.1')
2015-12-08T16:35:06.448742+00:00 heroku[web.1]: Process exited with status 0
2015-12-08T16:35:06.441993+00:00 heroku[web.1]: State changed from starting to crashed
But when I run the same command via heroku toolbelt, it starts up with the console.
$ heroku run "./rel/app_name/bin/app_name console"
Running ./rel/app_name/bin/app_name console on tp-api... up, run.4201
Exec: /app/rel/app_name/erts-7.0/bin/erlexec -boot /app/rel/app_name/releases/1/app_name -mode embedded -config /app/rel/app_name/releases/1/sys.config -args_file /app/rel/app_name/releases/1/vm.args -- console
Root: /app/rel/app_name
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
16:38:43.194 [info] Application lager started on node 'app_name#127.0.0.1'
16:38:43.196 [info] Application app_name started on node 'app_name#127.0.0.1'
Eshell V7.0 (abort with ^G)
(app_name#127.0.0.1)1>
Is there way to start the node, maybe as a daemon on the dyno(s)?
Note I've tried to use start instead of console, but that did not yield any success.
So after much tinkering, trial and error, figured out what was wrong. Heroku does not like the interactive shell to be there - hence the crash on starting the Erlang app through console fails.
I've adjusted my Procfile, to the following:
# Procfile
web: erl -pa $PWD/ebin $PWD/deps/*/ebin -noshell -boot start_sasl -s reloader -s app_name -config ./rel/app_name/releases/1/sys
Which boots up the application app_name, using the the release's sys.config configuration file. What was crucial here, is to have the -noshell option in the command, that allows heroku to run the process as they expect it.

Heroku Procfile not working

I'm trying use Nginx + Phalcon. So I have the root folder (app) and my public folder (app/public).
Inside the root (app) I have the Procfile:
web: vendor/bin/heroku-php-nginx -C nginx_app.conf public/
And inside my public folder I have my index.php
<?php exit('hello');
With this simple example, shouldn't print hello when I access the url myapp.herokuapp.com?
If my thought is right, which is not working. My second problem is that the nginx_app.conf seems that are not been reading by the server. Because every f* page that I tried access I got 404.
So, what am I doing wrong?
[UPDATED]
Here's the log:
heroku[web.1]: State changed from down to starting
heroku[web.1]: Starting process with command `php -S 0.0.0.0:57262`
heroku[web.1]: State changed from starting to up
app[web.1]: [Tue Apr 7 11:08:07 2015] 10.185.81.31:28258 Invalid request (Unexpected EOF)
app[web.1]: [Tue Apr 7 11:08:07 2015] 172.19.28.141:33686 Invalid request (Unexpected EOF)
heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=d39f119a-fd95-4887-809f-74712925606f fwd="200.221.158.131" dyno=web.1 connect=2ms service=4ms status=404 bytes=668
app[web.1]: [Tue Apr 7 11:08:44 2015] 10.61.196.230:38679 [404]: / - No such file or directory
[UPDATED]
$ git push ...
[...]
remote: -----> Discovering process types
remote: Procfile declares types -> web
$ heroku run bash
$ cat Procfile
~ $ : vendor/bin/heroku-php-nginx public/~ $
And according the documentation should be
heroku run bash
Running `bash` attached to terminal... up, run.5662
$ cat Procfile
web: vendor/bin/heroku-php-apache2
A little detail that I have tried:
cat Procfile
~ $ vendor/bin/heroku-php-nginx public/c/~ $
vendor/bin/heroku-php-nginx public/
DOCUMENT_ROOT changed to 'public/'
Optimzing defaults for 1X dyno...
4 processes at 128MB memory limit.
Starting php-fpm...
Starting nginx...
I'm waiting... let's see what happens
Something is wrong with your Procfile; as you can see, Heroku is booting in the default php -S mode. This happens when a Procfile is present, but no "web" process type is declared; this should also be written out in a message towards the very end of a git push heroku master (something about the Procfile not declaring a "web" process type and it then using a default).
That rules out your Procfile not being checked into Git or having the wrong name (e.g. lowercase procfile).
The culprit is very, very likely a Unicode Byte Order Mark that the editor you're using is inserting at the beginning of the file: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
So your Procfile doesn't look like this:
web: vendor/bin/heroku-php-nginx -C nginx_app.conf public/
but actually like this:
\0xEF\0xBB\0xBFweb: vendor/bin/heroku-php-nginx -C nginx_app.conf public/
Your editor (and most editors for that matter) simply don't display the BOM.
To fix the issue, save your Procfile without a BOM (and, while your at it, configure your editor to never save a UTF-8 BOM, because its use is highly discouraged and causes myriads of problems just like this one).

Resources