prasmussen / glot-snippets Goto Github PK
View Code? Open in Web Editor NEWAPI for storing code snippets
Home Page: https://snippets.glot.io/
License: MIT License
API for storing code snippets
Home Page: https://snippets.glot.io/
License: MIT License
Hello @prasmussen,
I had followed your instructions for compiling glot-snippets and glot-run, and while app runs with a few tweaks, it always return HTTP 500
for each request. The error log is so cryptic. Here is an example:
(error doesn't have \n
so everything is in a single line)
08:08:39.692 [error] Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.782.0> exit with reason: [{reason,{noproc,{gen_server,call,[snippet_srv,{list_public_excl_untitled,{20,0}}]}}},{mfa,{snippets_resource,list,2}},{stacktrace,[{gen_server,call,2,[{file,"gen_server.erl"},{line,204}]},{snippets_resource,list_public,4,[{file,"src/resources/snippets_resource.erl"},{line,103}]},{snippets_resource,list,2,[{file,"src/resources/snippets_resource.erl"},{line,88}]},{cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,976}]},{cowboy_rest,set_resp_body,2,[{file,"src/cowboy_rest.erl"},{line,858}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port<0.7288>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.782.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{10,168,3,1},50790}},{host,<<"snippets.glot.svc.cluster.local">>},{host_info,undefined},{port,80},{path,<<"/snippets">>},{path_info,undefined},{qs,<<"page=1&per_page=20&include_untitled=false">>},{qs_vals,undefined},{bindings,[]},{headers,[{<<"host">>,<<"snippets.glot.svc.cluster.local">>},{<<"accept-encoding">>,<<"gzip">>},{<<"content-type">>,<<"application/json">>},{<<"user-agent">>,<<"haskell wreq-0.4.1.0">>}]},{p_headers,[{<<"if-modified-since">>,undefined},{<<"if-none-match">>,undefined},{<<"if-unmodified-since">>,undefined},{<<"if-match">>,undefined},{<<"accept">>,undefined}]},{cookies,undefined},{meta,[{media_type,{<<"application">>,<<"json">>,'*'}},{charset,undefined}]},{body_state,waiting},{buffer,<<>>},{multipart,undefined},{resp_compress,false},{resp_state,waiting},{resp_headers,[{<<"content-type">>,[<<"application">>,<<"/">>,<<"json">>,<<>>]}]},{resp_body,<<>>},{onresponse,#Fun<http_util.log_response.4>}]},{state,{state,<<"anonymous">>,{1,20}}}]
CouchDB is running fine, but I'm thinking if it needs some kind of initialization. At first, I thought the problem was with the database connection chain, but I also saw a similar error on glot-run which doesn't use any database:
08:01:36.822 [error] Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.1108.0> exit with reason: [{reason,{noproc,{gen_server,call,[language_srv,{list}]}}},{mfa,{language_resource,resource_exists,2}},{stacktrace,[{gen_server,call,2,[{file,"gen_server.erl"},{line,204}]},{language,list_names,0,[{file,"src/models/language.erl"},{line,49}]},{language,is_supported,1,[{file,"src/models/language.erl"},{line,35}]},{language_resource,resource_exists,2,[{file,"src/resources/language_resource.erl"},{line,34}]},{cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,976}]},{cowboy_rest,expect,6,[{file,"src/cowboy_rest.erl"},{line,960}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port<0.7380>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.1108.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{10,168,3,1},41064}},{host,<<"run.glot.svc.cluster.local">>},{host_info,undefined},{port,80},{path,<<"/languages/bash">>},{path_info,undefined},{qs,<<>>},{qs_vals,undefined},{bindings,[{name,<<"bash">>}]},{headers,[{<<"host">>,<<"run.glot.svc.cluster.local">>},{<<"accept-encoding">>,<<"gzip">>},{<<"content-type">>,<<"application/json">>},{<<"user-agent">>,<<"haskell wreq-0.4.1.0">>}]},{p_headers,[{<<"accept">>,undefined}]},{cookies,undefined},{meta,[{media_type,{<<"application">>,<<"json">>,'*'}},{charset,undefined}]},{body_state,waiting},{buffer,<<>>},{multipart,undefined},{resp_compress,false},{resp_state,waiting},{resp_headers,[{<<"content-type">>,[<<"application">>,<<"/">>,<<"json">>,<<>>]}]},{resp_body,<<>>},{onresponse,#Fun<http_util.log_response.4>}]},{state,{state,undefined}}]
I'm using erlang 18. I forked your repos for making some tweaks to make it work. You can check them out here:
https://github.com/javierprovecho/glot-run
https://github.com/javierprovecho/glot-snippets
https://github.com/javierprovecho/glot-www
I also created Dockerfiles for quicker deployment. If you use Docker, you can pull the images from here and experiment the same errors I see:
docker pull javierprovecho/glot-run
docker pull javierprovecho/glot-snippets
docker pull javierprovecho/glot-www
I look forward to make your project easier to deploy.
Thanks in advance for your support.
I'm curious if snippets are deleted after some amount of time. Could this be put on the website / GitHub? Thanks!
Accept URLs (github, gists) in the "files" array when creating a snippet via the API
It would be interesting to either save the editor theme when I save the snippet or to be able to specify it when embedding a snippet.
./make_release.sh
===> Verifying dependencies...
===> Compiling glot
===> Compiling /root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl failed
/root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl:27: syntax error before: '{'
/root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl:2: function root/2 undefined
===> Verifying dependencies...
===> Compiling glot
===> Compiling /root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl failed
/root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl:27: syntax error before: '{'
/root/glot/glot-snippets/_build/default/lib/glot/src/resources/admin_root_resource.erl:2: function root/2 undefined
./make_release.sh: line 8: cd: _build/default/rel: No such file or directory
tar: glot: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.