zip url like bitly/TinyURL/...
doc:中文
ShortEner
myself yet shorten URL service
need Elixir >= 1.9
base Installing Elixir - The Elixir programming language install local develop environment.
$ elixir -v
if see like:
Erlang/OTP 22 [erts-10.5.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.9.1 (compiled with Erlang/OTP 22)
confirm u local environment is ok;
now, let's running:
$ git clone https://gitee.com/alchemists/ziply.git
and creat database path:
$ mkdir priv
now local path will like:
path/2/u/path:
+- priv/
+- ziply/
+- short_ener
+- LICENSE
+- README.md
$ cd ziply/short_ener
enter application path;
$ mix deps.get && mix deps.compile
download and compile all depend module;
$ mix run --no-halt
run by mix , will see terminal export like:
Compiling 11 files (.ex)
Generated short_ener app
15:10:06.079 [debug] will init. in /opt/scm/srv/sp4ias/main_ziply/short_ener/../../priv/mnesia.dev.nonode@nohost
15:10:06.079 [debug] only master init.
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
schema : with 4 records occupying 783 words of mem
links : with 1 records occupying 405 words of mem
counter : with 1 records occupying 318 words of mem
id_seq : with 0 records occupying 5464 bytes on disc
===> System info in version "4.16.1", debug level = none <===
opt_disc. Directory "/opt/scm/srv/sp4ias/main_ziply/short_ener/../../priv/mnesia.dev.nonode@nohost" is used.
use fallback at restart = false
running db nodes = [nonode@nohost]
stopped db nodes = []
master node tables = []
remote = []
ram_copies = []
disc_copies = [counter,links,schema]
disc_only_copies = [id_seq]
[{nonode@nohost,disc_copies}] = [counter,links,schema]
[{nonode@nohost,disc_only_copies}] = [id_seq]
2 transactions committed, 2 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
:ok
15:10:06.257 [info] running ShortEner...at 9081
15:10:06.284 [info] Application mnesia exited: :stopped
now ShortEner
is wait service for u.
MVP yet, only support 3 tiny base functions
$ curl localhost:9081/ping
echo:
pong ;-)
I'm alive.
$ curl localhost:9081/api -X POST -d 'url=https://qq.com/'
if post new URL:
Ziply: t.101.s/qogl ~> https://qq.com/
else deiscover URL exist:
Ziped: t.101.s/qogl ~> https://qq.com/
visit in browser:
-> http://t.101.s/qogl
recommand base mix release:
in u host:
$ cd path/2/u/ziply/short_ener
enter cloned path,
$ mix release.init
initialize release
* creating rel/vm.args.eex
* creating rel/env.sh.eex
* creating rel/env.bat.eex
$ MIX_ENV=prod mix release --overwrite
compile as product;
...
Release created at _build/prod/rel/short_ener!
# To start your system
_build/prod/rel/short_ener/bin/short_ener start
Once the release is running:
# To connect to it remotely
_build/prod/rel/short_ener/bin/short_ener remote
# To stop it gracefully (you may also send SIGINT/SIGTERM)
_build/prod/rel/short_ener/bin/short_ener stop
To list all commands:
_build/prod/rel/short_ener/bin/short_ener
succeed, can see like that, try first:
$ _build/prod/rel/short_ener/bin/short_ener
if read like this, confirm Ziply is already running as one Server:
Usage: short_ener COMMAND [ARGS]
The known commands are:
start Starts the system
start_iex Starts the system with IEx attached
daemon Starts the system as a daemon
daemon_iex Starts the system as a daemon with IEx attached
eval "EXPR" Executes the given expression on a new, non-booted system
rpc "EXPR" Executes the given expression remotely on the running system
remote Connects to the running system via a remote shell
restart Restarts the running system via a remote command
stop Stops the running system via a remote command
pid Prints the OS PID of the running system via a remote command
version Prints the release name and version to be booted
base MIT
RIP
/Joe Armstrong created ErlangSign in for post a comment
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.
Comments ( 1 )