APM is a process manager for Golang applications.


A(guia) P(rocess) M(anager)

# APM - Aguia Process Manager APM is a lightweight process manager written in Golang for Golang applications. It helps you keep your applications alive forever, reload and start them from the source code.

ReportCard GoDoc

Starting an application is easy:

$ ./apm bin app-name --source="github.com/topfreegames/apm"

This will basically compile your project source code and start it as a daemon in the background. The application will have already be downloaded into GOPATH issuing something like

go get github.com/topfreegames/apm

You will probably be able to run anything in any directory, as long as it is under GOPATH

Install APM

$ go get github.com/topfreegames/apm

Start APM

In order to properly use APM, you always need to start a server. This will be changed in the next version, but in the meantime you need to run the command bellow to start using APM.

$ apm serve

If no config file is provided, it will default to a folder '.apmenv' where apm is first started.

Stop APM

$ apm serve-stop

Starting a new application

If it's the first time you are starting a new golang application, you need to tell APM to first build its binary. Then you need to first run:

$ apm bin app-name --source="github.com/yourproject/project"

This will automatically compile, start and daemonize your application. If you need to later on, stop, restart or delete your app from APM, you can just run normal commands using the app-name you specified. Example:

$ apm stop app-name
$ apm restart app-name
$ apm delete app-name

Main features

Commands overview

$ apm serve --config-file="config/file/path.toml"
$ apm serve-stop --config-file="config/file/path.toml"

$ apm bin app-name --source="github.com/topfreegames/apm"   # Compile, start, daemonize and auto restart application.
$ apm start app-name                                        # Start, daemonize and auto restart application.
$ apm restart app-name                                      # Restart a previously saved process
$ apm stop app-name                                         # Stop application.
$ apm delete app-name                                       # Delete application forever.

$ apm save                                                  # Save current process list
$ apm resurrect                                             # Restore previously saved processes

$ apm status                                                # Display status for each app.

Managing process via HTTP

You can also use all of the above commands via HTTP requests. Just set the flag --dns together with ./apm serve and then you can use a remote client to start, stop, delete and query status for each app.

Owner
TFG Co
TFG is a leading gaming company for mobile. Check our open positions at https://boards.greenhouse.io/wildlifestudios
TFG Co
Comments
  • Create interfaces for proc_container and proc_preparable

    Create interfaces for proc_container and proc_preparable

    The main goal here is to add tests to the APM. When implementing tests, I noticed that Golang is not mocking friendly, which makes it hard to implement tests the way APM is structured right now.

    The first step to make it test-friendly is to make APM more interface oriented. This means we should create interface for our main modules and work with them. By doing this we gain the ability to easily mock the interface and create more robust tests the way we like.

    The first tests I want to create are tests for the proc_container which controls the logic for each APM process. So this pull request basically creates an interface for it and for proc_preparable as well.

    The only problem when making APM more interface oriented is that it makes encoding/decoding structs more hard. For instance, when we make calls from the remote client to the remote server, the RPC module will encode and then decode the object we want to send through. The problem with that is that interfaces can't be decoded, since there's no way to access its fields as interfaces in golang only exposes modules and not exported fields. We have this exactly same problem when encoding/decoding the master from/to the TOML file.

    The first solution that I had in mind was:

    • Create a struct with the exactly same fields as the struct we want to encode/decode, and then use it to receive and send data. After we receive this data, we just copy and paste it onto the actual object we are gonna handle. This solution can be seen by looking at the structs: DecodableMaster and ProcDataResponse.
    • The problem with this solution is that we will always have to keep the auxiliar structs sync with the actual structs. This won't scale when we have more fields, but it solves the problem for now.

    Besides that, this change was manually tested against all possible cases, and it seems to be working just fine.

  • can apm start a local app ?

    can apm start a local app ?

    apm bin myApp --keep-alive --source="" The source param must be a remove source of git lib? I want to try start my app just in local testting env, then the source param should be?

  • Unrecognized command: start

    Unrecognized command: start

    i have a local repo named Durotan under GOPATH/src, and i do the following:

    cd $GOPATH/src/Durotan
    
    apm start Durotan
    
    

    and got following:

    
    Unrecognized command: start
    
  • Add unit tests for Watcher and Master

    Add unit tests for Watcher and Master

    • [x] Create interfaces for ProcPreparable and ProcContainer. PR #3
    • [ ] Create ProcPreparable and ProcContainer mock instances
    • [ ] Implement unit tests for Watcher
    • [ ] Implement unit tests for Master

    Creating interfaces for ProcPreparable, ProcContainer and file_util is essential to make unit testing easier. After that we can easily create mock instances and apply it on master and watcher. The tests should mainly test the following:

    • Starting processes serially
    • Starting processes in parallel
    • Killing processes serially
    • Killing processes in parallel
    • Killing keep-alive processes
    • Killing non-keep-alive processes
    • Trying to build non-compilable projects

    The main idea is to test how APM behaves when facing possible race condition situations and how it handle errors.

  • Some issues: keep-alive, silence when the application fails to start, no specification of the TOML file and what it does, and not clear how to use environment variables

    Some issues: keep-alive, silence when the application fails to start, no specification of the TOML file and what it does, and not clear how to use environment variables

    Well, that's pretty much it. Maybe a bit of more explanation:

    • This error when running

      apm: error: required flag --keep-alive not provided, try --help

    • Specify in documentation what, if anything, is needed to include in the config.toml file

    • Do you always have to start the server?

    • How can I add environment variables? Are they sent through to the running process?

    • Not clear if the program has failed to start. I have to use apm status to find out something.

exo: a process manager & log viewer for dev
 exo: a process manager & log viewer for dev

exo: a process manager & log viewer for dev exo- prefix – external; from outside. Features Procfile compatible process manager.

Dec 28, 2022
A minimal configuration manager for Go applications.

Confetti A simple config manager for Go applications. Install Use the following: go get -u github.com/shivanshkc/confetti/v2 When to use Confetti Con

Dec 7, 2021
SigNoz helps developer monitor applications and troubleshoot problems in their deployed applications
SigNoz helps developer monitor applications and troubleshoot problems in their deployed applications

SigNoz helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc. ?? ??

Dec 27, 2022
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go
A flexible process data collection, metrics, monitoring, instrumentation, and tracing client library for Go

Package monkit is a flexible code instrumenting and data collection library. See documentation at https://godoc.org/gopkg.in/spacemonkeygo/monkit.v3 S

Dec 14, 2022
gosivy - Real-time visualization tool for Go process metrics
 gosivy - Real-time visualization tool for Go process metrics

Gosivy tracks Go process's metrics and plot their evolution over time right into your terminal, no matter where it's running on. It helps you understand how your application consumes the resources.

Nov 27, 2022
Monitor a process and trigger a notification.
Monitor a process and trigger a notification.

noti Monitor a process and trigger a notification. Never sit and wait for some long-running process to finish. Noti can alert you when it's done. You

Jan 3, 2023
Example of trace instrumentation in Golang applications :bar_chart:
Example of trace instrumentation in Golang applications :bar_chart:

go-opentelemetry-example Example of trace instrumentation in Golang applications using the opentelemetry. Requirements/dependencies Docker Docker-comp

Jun 4, 2022
xlog is a logger for net/context aware HTTP applications
xlog is a logger for net/context aware HTTP applications

⚠️ Check zerolog, the successor of xlog. HTTP Handler Logger xlog is a logger for net/context aware HTTP applications. Unlike most loggers, xlog will

Sep 26, 2022
BTFS - The First Scalable Decentralized Storage System - A Foundational Platform for Decentralized Applications

go-btfs What is BTFS? BitTorrent File System (BTFS) is a protocol forked from IPFS that utilizes the TRON network and the BitTorrent Ecosystem for int

Jan 1, 2023
Simple and blazing fast lockfree logging library for golang
Simple and blazing fast lockfree logging library for golang

glg is simple golang logging library Requirement Go 1.11 Installation go get github.com/kpango/glg Example package main import ( "net/http" "time"

Nov 28, 2022
Logging library for Golang

GLO Logging library for Golang Inspired by Monolog for PHP, severity levels are identical Install go get github.com/lajosbencz/glo Severity levels Deb

Sep 26, 2022
a golang log lib supports level and multi handlers

go-log a golang log lib supports level and multi handlers Use import "github.com/siddontang/go-log/log" //log with different level log.Info("hello wo

Dec 29, 2022
LogVoyage - logging SaaS written in GoLang
LogVoyage - logging SaaS written in GoLang

No longer maintained, sorry. Completely rewritten v2 is going to be released soon. Please follow http://github.com/logvoyage LogVoyage - fast and simp

Sep 26, 2022
An golang log lib, supports tracking and level, wrap by standard log lib

Logex An golang log lib, supports tracing and level, wrap by standard log lib How To Get shell go get gopkg.in/logex.v1 source code import "gopkg.in/

Nov 27, 2022
Utilities for slightly better logging in Go (Golang).

logutils logutils is a Go package that augments the standard library "log" package to make logging a bit more modern, without fragmenting the Go ecosy

Dec 16, 2022
Dead simple, super fast, zero allocation and modular logger for Golang

Onelog Onelog is a dead simple but very efficient JSON logger. It is one of the fastest JSON logger out there. Also, it is one of the logger with the

Sep 26, 2022
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets.

ozzo-log Other languages 简体中文 Русский Description ozzo-log is a Go package providing enhanced logging support for Go programs. It has the following fe

Dec 17, 2022
Golang logging library
Golang logging library

Golang logging library Package logging implements a logging infrastructure for Go. Its output format is customizable and supports different logging ba

Dec 27, 2022
A feature-rich and easy to use logger for golang
A feature-rich and easy to use logger for golang

A feature-rich and easy to use logger for golang ?? Install ?? Common Logs lumber.Success() lumber.Info() lumber.Debug() lumber.Warning()

Dec 31, 2022