Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: topfreegames/apm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: struCoder/pmgo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Mar 30, 2017

  1. Copy the full SHA
    a14608b View commit details
  2. Copy the full SHA
    6476735 View commit details
  3. Copy the full SHA
    64ddc02 View commit details
  4. Update README.md

    struCoder authored Mar 30, 2017
    Copy the full SHA
    5c7f8c0 View commit details

Commits on Mar 31, 2017

  1. Copy the full SHA
    45bf6b3 View commit details
  2. Copy the full SHA
    6264df8 View commit details
  3. Copy the full SHA
    4b07e1d View commit details
  4. Copy the full SHA
    f2df86f View commit details

Commits on Apr 1, 2017

  1. Copy the full SHA
    edb4fff View commit details
  2. Copy the full SHA
    6d8ef5f View commit details
  3. Copy the full SHA
    308c7af View commit details
  4. Copy the full SHA
    2fe230f View commit details
  5. Copy the full SHA
    b913d9f View commit details
  6. Copy the full SHA
    8bcffaa View commit details

Commits on Apr 5, 2017

  1. Copy the full SHA
    f906221 View commit details
  2. Copy the full SHA
    30f3263 View commit details

Commits on Apr 6, 2017

  1. feat(0.0.1): format uptime

    struCoder committed Apr 6, 2017
    Copy the full SHA
    1f6661f View commit details
  2. fix(0.1.0): fix year enum

    struCoder committed Apr 6, 2017
    Copy the full SHA
    2bb41c3 View commit details
  3. Copy the full SHA
    96441e4 View commit details
  4. feat(0.1.0): fmt code

    struCoder committed Apr 6, 2017
    Copy the full SHA
    c6ff0f0 View commit details
  5. Merge pull request #1 from struCoder/0.1.0

    v0.1.0
    struCoder authored Apr 6, 2017
    Copy the full SHA
    23bc1b8 View commit details
  6. Copy the full SHA
    76cb3af View commit details
  7. Merge pull request #2 from struCoder/0.1.0

    fix(0.1.0): fix uptimeFormat
    struCoder authored Apr 6, 2017
    Copy the full SHA
    d8e3759 View commit details
  8. docs(0.1.0): add ci

    struCoder authored Apr 6, 2017
    Copy the full SHA
    b649e28 View commit details
  9. Copy the full SHA
    b1ed66e View commit details

Commits on Apr 7, 2017

  1. Copy the full SHA
    5f1cbab View commit details
  2. Copy the full SHA
    b0229bf View commit details
  3. Merge pull request #3 from struCoder/0.1.0

    add cpu and memory usage
    struCoder authored Apr 7, 2017
    Copy the full SHA
    3adbd9a View commit details

Commits on Apr 10, 2017

  1. feat(0.1.0): fix issues

    struCoder committed Apr 10, 2017
    Copy the full SHA
    6b56c8a View commit details
  2. Copy the full SHA
    aea2cbc View commit details
  3. Copy the full SHA
    d466475 View commit details
  4. Merge pull request #4 from struCoder/0.1.0

    feat(0.1.0): fix issues
    struCoder authored Apr 10, 2017
    Copy the full SHA
    0771e30 View commit details
  5. Copy the full SHA
    1471367 View commit details
  6. Merge pull request #5 from struCoder/0.1.0

    feat(0.1.0): add circle.yml
    struCoder authored Apr 10, 2017
    Copy the full SHA
    0ba2b79 View commit details
  7. Copy the full SHA
    ff8f45e View commit details
  8. fix(master): update circle

    struCoder authored Apr 10, 2017
    Copy the full SHA
    dfa8d48 View commit details
  9. docs(0.1.0): update readme

    struCoder committed Apr 10, 2017
    Copy the full SHA
    6ac7ae4 View commit details
  10. Merge pull request #6 from struCoder/0.1.0

    docs(0.1.0): update readme
    struCoder authored Apr 10, 2017
    Copy the full SHA
    0e9ce8e View commit details

Commits on Apr 11, 2017

  1. Copy the full SHA
    6584eb3 View commit details
  2. Merge pull request #7 from struCoder/0.1.0

    docs(0.1.0): add install.sh and update readme
    struCoder authored Apr 11, 2017
    Copy the full SHA
    7dd843d View commit details
  3. docs(0.1.0): update docs

    struCoder authored Apr 11, 2017
    Copy the full SHA
    ed4c55d View commit details
  4. Copy the full SHA
    b47199b View commit details
  5. docs(0.1.0): add demo image

    struCoder committed Apr 11, 2017
    Copy the full SHA
    0c372c7 View commit details
  6. Merge pull request #8 from struCoder/0.1.0

    docs(0.1.0): add demo image
    struCoder authored Apr 11, 2017
    Copy the full SHA
    407ca22 View commit details
  7. docs(0.1.0): add demo image

    struCoder committed Apr 11, 2017
    Copy the full SHA
    8acb0ee View commit details
  8. Merge pull request #9 from struCoder/0.1.0

    docs(0.1.0): add demo image
    struCoder authored Apr 11, 2017
    Copy the full SHA
    c3a6efc View commit details

Commits on Apr 21, 2017

  1. Copy the full SHA
    725b40e View commit details
  2. Copy the full SHA
    a09c269 View commit details
  3. Copy the full SHA
    1108d6c View commit details
  4. feat(0.2.0): save code

    struCoder committed Apr 21, 2017
    Copy the full SHA
    87a780b View commit details
Showing with 1,116 additions and 453 deletions.
  1. +26 −0 .circleci/config.yml
  2. +1 −0 .gitignore
  3. +98 −49 README.md
  4. +0 −202 apm.go
  5. +19 −0 changelog.md
  6. +18 −0 go.mod
  7. +43 −0 go.sum
  8. +62 −0 install.sh
  9. +82 −61 lib/cli/cli.go
  10. +117 −56 lib/master/master.go
  11. +65 −43 lib/master/remote_master.go
  12. +111 −11 lib/preparable/process.go
  13. +78 −19 lib/process/proc_container.go
  14. +37 −2 lib/process/proc_status.go
  15. +5 −3 lib/utils/file_util.go
  16. +5 −3 lib/utils/filemutex.go
  17. +89 −0 lib/utils/funs.go
  18. +6 −4 lib/watcher/watcher.go
  19. +254 −0 pmgo.go
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/golang:1.15.8
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml
- store_test_results:
path: /tmp/test-reports
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pmgo
147 changes: 98 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,133 @@
<div align="center">
<a>
<img height="400px" width="400px" src="https://cloud.githubusercontent.com/assets/5413599/12247882/2fcb1ca6-b89d-11e5-933e-efade26acf13.jpg">
</a>
<br/>
<b>A</b>(guia) <b>P</b>(rocess) <b>M</b>(anager)
<br/><br/>
<a>
<img src="https://i.loli.net/2018/12/06/5c08b9a294c29.png">
</a>
<br/>
<b>PMGO</b>
<br/><br/>
<a href="https://circleci.com/gh/struCoder/pmgo">
<img src="https://circleci.com/gh/struCoder/pmgo.svg?&style=shield&circle-token=0fa8ccfc85928edc54a0d7d848cbc784e31813ff" alt="Build Status">
</a>

<a href="http://commitizen.github.io/cz-cli">
<img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="Commitizen friendly" />
</a>

<a href="https://gitter.im/getpmgo/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">
<img src="https://badges.gitter.im/getpmgo/Lobby.svg" alt="Join the chat" />
</a>

<a href="https://goreportcard.com/report/github.com/struCoder/pmgo">
<img src="https://goreportcard.com/badge/github.com/struCoder/pmgo" alt="Go Report Card" />
</a>

<a href="https://godoc.org/github.com/struCoder/pmgo">
<img src="https://godoc.org/github.com/struCoder/pmgo?status.svg" alt="GoDoc" />
</a>
<br/><br/>
</div>
# 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](http://goreportcard.com/badge/topfreegames/apm)](http://goreportcard.com/badge/topfreegames/apm)
[![GoDoc](https://godoc.org/github.com/topfreegames/apm?status.svg)](https://godoc.org/github.com/topfreegames/apm)

Starting an application is easy:
```bash
$ ./apm bin app-name --source="github.com/topfreegames/apm"
```
# PMGO
PMGO 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.

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`
## Change log(2020-06-27 updated)

## Install APM
[Change log](./changelog.md)

```bash
$ go get github.com/topfreegames/apm
```

## Start APM
## Install pmgo

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.
```bash
$ apm serve
$ go get github.com/struCoder/pmgo
$ mv $GOPATH/bin/pmgo /usr/local/bin
```
If no config file is provided, it will default to a folder '.apmenv' where `apm` is first started.

## Stop APM

Or
```bash
$ apm serve-stop
git clone https://github.com/struCoder/pmgo.git
cd path/to/struCoder/pmgo
go build -v pmgo.go
mv pmgo /usr/local/bin
```


## 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:
If it's the first time you are starting a new golang application, you need to tell pmgo to first build its binary. Then you need to first run:
```bash
$ apm bin app-name --source="github.com/yourproject/project"
$ pmgo start path/to/source-directory app-name
```

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:
This will automatically compile, start and daemonize your application. If you need to later on, stop, restart or delete your app from PMGO, you can just run normal commands using the app-name you specified. Example:
```bash
$ apm stop app-name
$ apm restart app-name
$ apm delete app-name
$ pmgo stop app-name
$ pmgo restart app-name
$ pmgo delete app-name
```

## Main features

### Commands overview

```bash
$ apm serve --config-file="config/file/path.toml"
$ apm serve-stop --config-file="config/file/path.toml"
$ pmgo kill # kill pmgo daemon process

$ pmgo start source app-name # Compile, start, daemonize and auto restart application.
$ pmgo restart app-name # Restart a previously saved process
$ pmgo stop app-name # Stop application.
$ pmgo delete app-name # Delete application forever.

$ pmgo save # Save current process list

$ pmgo list # Display status for each app.
$ pmgo info app-name # describe importance parameters of a process name
```

### Start your GO-application with parameters
```bash
// pmgo will build your source code folder under $GOPATH/src by default
// Here my tmp folder was: $GOPATH/src/tmp
pmgo start tmp/ test --args "arg1 arg2 arg3"

# In your application
fmt.Println(os.Args[1:])
# Output: [arg1, arg2, arg3]
```

$ 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
### Start application from user input compiled binary

$ apm status # Display status for each app.
```bash
# true means use user input compiled binary path
pmgo start /Users/strucoder/personalPro/goplace/main awesome_name true --args="arg1 arg2 arg3"
```

### Managing process via HTTP
### Demo
![demo](https://i.loli.net/2018/12/06/5c08bbd407b35.png)

### I Love This. How do I Help?

- Simply star this repository :-)
- Help us spread the world on Facebook and Twitter
- Contribute Code!
- I'll be very grateful if you'd like to donate to encourage me to continue maintaining pmgo.


### Contributors
<a href="https://github.com/struCoder/pmgo/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=struCoder/pmgo" />
</a>

### Donate

| **Paypal** | **Alipay** |
| :------------------------: | :------------------------: |
| [![paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/strucoder) | [![alipay](https://img.shields.io/badge/Donate-alipay-blue.svg)](https://i.loli.net/2018/11/29/5bff95e2d29df.png) |

### By The Way
In China Mainland, maybe you can't download some packages in golang.org, thus just click [here](https://goproxy.io/zh/) to set `GOPROXY`
### LICENSE

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.
[MIT](https://github.com/struCoder/pmgo/blob/master/LICENSE)
Loading