yukihirop / ultraman Goto Github PK
View Code? Open in Web Editor NEWManage Procfile-based applications. (Rust Foreman)โ๏ธ๐จ
License: MIT License
Manage Procfile-based applications. (Rust Foreman)โ๏ธ๐จ
License: MIT License
Add badges
$ bin/foreman help run
Usage:
foreman run COMMAND [ARGS...]
Options:
-e, [--env=ENV] # Specify an environment file to load, defaults to .env
-f, [--procfile=PROCFILE] # Default: Procfile
-d, [--root=ROOT] # Default: Procfile directory
Run a command using your application's environment
Allows you to profile in the development environment
If you are using macOS, run the following in a terminal in recovery mode to release SIP
csrutil enable --without dtrace
e.g)
cargo install flamegraph
sudo -E CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -o flamegraph-`date +%Y%m%d_%H%M%S`.svg --bin=ultraman -- start -f ./tmp/Procfile
Refactor mod:
Is there some equivalent to the .foreman file for setting default options? I tried both .foreman and .ultraman but it doesn't seem to read either.
from https://ddollar.github.io/foreman/
DEFAULT OPTIONS
If a .foreman file exists in the current directory, default options will be read from it. This file should be in YAML format with the long option name as keys. Example:
formation: alpha=0,bravo=1
port: 15000
Even though the default value is 5000, it was handled as Optional for some reason
#[structopt(name = "PORT", short = "p", long = "port")]
pub port: Option<String>,
โ
#[structopt(name = "PORT", short = "p", long = "port", default_value="5000")]
pub port: String,
$ cargo package
Updating git repository `https://github.com/yukihirop/roff-rs`
error: failed to select a version for the requirement `roff = "^0.1.0"`
candidate versions found which didn't match: 0.2.0
location searched: Git repository https://github.com/yukihirop/roff-rs
required by package `ultraman v0.1.0 (/Users/yukihirop/RustProjects/ultraman)`
Versions not registered in creates-io cannot be referenced. I can't get a crate from github
roff = { version = "0.2.0", git = "https://github.com/yukihirop/roff-rs", tag = "v0.2.0" }
There is a method other than crates-io to create a repository and take it from there.
$ ultraman start
22:11:30 system | web.1 start at pid: 91352
22:11:32 web.1 | => Booting Puma
22:11:32 web.1 | => Rails 5.2.4.4 application starting in development
22:11:32 web.1 | => Run `rails server -h` for more startup options
22:11:32 web.1 | Puma starting in single mode...
22:11:32 web.1 | * Version 3.12.6 (ruby 2.5.3-p105), codename: Llamas in Pajamas
22:11:32 web.1 | * Min threads: 5, max threads: 5
22:11:32 web.1 | * Environment: development
22:11:32 web.1 | * Listening on tcp://localhost:4999
22:11:32 web.1 | Use Ctrl-C to stop
22:12:05 web.1 | Started GET "/" for ::1 at 2020-12-25 22:12:05 +0900
port is 5000
$ ultraman --version
ultraman "0.1.2 ( rev: c5d1f03, rustc: 1.48.0, build at: 2020/12/25 12:29:56 )"
Heya, thanks for making this project!
The line from our procfile is web: bundle exec puma -p $PORT -C ./config/puma.rb
, and a .env with PORT=3000
, we see inconsistent results when running.
We're running via ultraman start
.
The server starts on port 3000
The server starts on inconsistent ports, but always a multiple of 100, and always near the correct value of 3000. 3100 and 3200 are common values. Sometimes it is correct with 3000 as well.
e.g.
11:08:01 web.1 | 2023-12-11T19:08:01.393Z pid=103762 tid=2f5u INFO: Sidekiq 7.2.0 connecting to Redis with options {:size=>10, :pool_name=>"internal", :url=>nil}
11:08:01 web.1 | [103762] * Listening on http://0.0.0.0:3100 <--------------------
11:08:01 web.1 | [103762] Use Ctrl-C to stop
11:08:01 web.1 | [103762] - Worker 0 (PID: 104330) booted in 0.01s, phase: 0
11:08:01 web.1 | [103762] - Worker 1 (PID: 104334) booted in 0.01s, phase: 0
11:08:01 web.1 | [103762] - Worker 2 (PID: 104341) booted in 0.01s, phase: 0
11:08:01 web.1 | [103762] - Worker 3 (PID: 104354) booted in 0.0s, phase: 0
Stopping the server, waiting a minute or so, and re-running then puts it on a different port:
11:10:14 web.1 | [108858] * Listening on http://0.0.0.0:3200
Running the bundle exec
line directly in a shell always starts the server on port 3000 as expected. Other foreman implementations also work as expected.
If -p $PORT
is not specified in the procfile, the server consistently starts on port 9292, which is the expected default.
If we hardcode -p 3000
in the procfile, the server starts consistently on port 3000.
ultraman version: 0.3.0
Rust version: 1.74.1
Introduce detailed examples for the following commands
It would be nice if there was an example using the full option
Refactor to rust-like memory-efficient code
As for the lifetime indicator, it also serves as a practice for use.
all=2
formation is not supported...
$ cargo run start -m "all=2"
warning: unused import: `Path`
--> src/cmd/export/upstart.rs:11:17
|
11 | use std::path::{Path, PathBuf};
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: use of deprecated function `dotenv::from_path_iter`: please use `from_path` in conjunction with `var` instead
--> src/env.rs:10:25
|
10 | if let Some(iter) = dotenv::from_path_iter(filepath.as_path()).ok() {
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: 2 warnings emitted
Finished dev [unoptimized + debuginfo] target(s) in 0.24s
Running `target/debug/rustman start -m all=2`
thread 'main' panicked at 'Do not support formation: all=2', src/procfile.rs:63:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Simple reproduce (my env is a bit different, and reproduce the panic 100%)
Profile:
early_out: seq 100
sleep: sleep 20
full 100 lines are displayed to the terminal
only few lines are displayed.
sometimes, a panic happens:
thread '' panicked at 'called Result::unwrap()
on an Err
value: "SendError(..)"', #44 $HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ultraman-0.3.1/src/stream_read.rs:44:38
It looks like there is a race-condition between catch of the SIGCHILD, and completion of the stdout/err processing.
ultraman version:
0.3.1
Rust version:
Implement ultraman check
like foreman check
root
option is not supported as it is not about
$ bin/foreman help start
Usage:
foreman start [PROCESS]
Options:
-c, [--color], [--no-color] # Force color to be enabled
-e, [--env=ENV] # Specify an environment file to load, defaults to .env
-m, [--formation="alpha=5,bar=3"] # Specify what processes will run and how many. Default: "all=1"
-p, [--port=N]
-t, [--timeout=N] # Specify the amount of time (in seconds) processes have to shutdown gracefully before receiving a SIGKILL, defaults to 5.
[--timestamp], [--no-timestamp] # Include timestamp in output
# Default: true
-f, [--procfile=PROCFILE] # Default: Procfile
-d, [--root=ROOT] # Default: Procfile directory
Start the application (or a specific PROCESS)
I like how easy ultraman is to setup and use, but...
ultraman is using 100% of one cpu core. I made a test case that simply execs a bash script that calls sleep 5000
.
$ cat sleep.sh
sleep 5000
$ cat Procfile
sleep1: ./sleep.sh
sleep2: ./sleep.sh
sleep3: ./sleep.sh
$ ultraman start
17:40:53 system | sleep3.1 start at pid: 3208
17:40:53 system | sleep2.1 start at pid: 3210
17:40:53 system | sleep1.1 start at pid: 3209
top, in other shell:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3204 user 20 0 759540 4204 3848 S 100.0 0.0 0:55.90 ultraman
$ which ultraman
/home/user/.cargo/bin/ultraman
$ ultraman --version
ultraman 0.1.2
I built ultraman at commit c5d1f03
I haven't maintained it for a while, so I will upgrade the version of the old deps.
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.