Skip to content

Commit f72b03b

Browse files
authored
Merge pull request #23 from picostack/refactor
general refactor of codebase
2 parents ae75d6c + e98140c commit f72b03b

21 files changed

+403
-253
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
.psenvrc
2121

2222
# The binary
23-
picobot
23+
pico
2424
dist
2525
.env
2626
cache

.goreleaser.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project_name: picobot
1+
project_name: pico
22
builds:
33
- env:
44
- CGO_ENABLED=0
@@ -22,13 +22,13 @@ changelog:
2222
- "^test:"
2323
dockers:
2424
- image_templates:
25-
- picostack/picobot:{{ .Tag }}
26-
- picostack/picobot:v{{ .Major }}
27-
- picostack/picobot:v{{ .Major }}.{{ .Minor }}
28-
- picostack/picobot:latest
25+
- picostack/pico:{{ .Tag }}
26+
- picostack/pico:v{{ .Major }}
27+
- picostack/pico:v{{ .Major }}.{{ .Minor }}
28+
- picostack/pico:latest
2929
nfpms:
3030
- vendor: Southclaws
31-
homepage: https://github.com/picostack/picobot
31+
homepage: https://github.com/picostack/pico
3232
maintainer: Southclaws <[email protected]>
3333
description: |
3434
A docker-compose application manager that deploys and maintains a set of

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM docker/compose
2-
COPY picobot /bin/picobot
3-
ENTRYPOINT ["picobot"]
2+
COPY pico /bin/pico
3+
ENTRYPOINT ["pico"]

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Picobot
1+
# Pico
22

33
_The little git robot of automation!_
44

5-
[![Build Status](https://travis-ci.org/picostack/picobot.svg?branch=master)](https://travis-ci.org/picostack/picobot)
5+
[![Build Status](https://travis-ci.org/picostack/pico.svg?branch=master)](https://travis-ci.org/picostack/pico)
66

7-
Picobot is a git-driven task runner to automate the application of configs.
7+
Pico is a git-driven task runner to automate the application of configs.
88

99
## Overview
1010

11-
Picobot is a little tool for implementing [Git-Ops][git-ops] in single-server environments. It's analogous to
11+
Pico is a little tool for implementing [Git-Ops][git-ops] in single-server environments. It's analogous to
1212
[kube-applier][kube-applier], [Terraform][terraform], [Ansible][ansible] but for automating lone servers that do not
1313
need cluster-level orchestration.
1414

15-
Instead, Picobot aims to be extremely simple. You give it some Git repositories and tell it to run commands when those
15+
Instead, Pico aims to be extremely simple. You give it some Git repositories and tell it to run commands when those
1616
Git repositories receive commits and that's about it. It also provides a way of safely passing in credentials from
1717
[Hashicorp's Vault][vault].
1818

@@ -21,16 +21,16 @@ Git repositories receive commits and that's about it. It also provides a way of
2121
### Linux
2222

2323
```sh
24-
curl -s https://raw.githubusercontent.com/picostack/picobot/master/install.sh | bash
24+
curl -s https://raw.githubusercontent.com/picostack/pico/master/install.sh | bash
2525
```
2626

2727
Or via Docker:
2828

2929
```sh
30-
docker pull picostack/picobot:v1
30+
docker pull picostack/pico:v1
3131
```
3232

33-
See the docker section below and the image on [Docker Hub](https://hub.docker.com/r/picostack/picobot).
33+
See the docker section below and the image on [Docker Hub](https://hub.docker.com/r/picostack/pico).
3434

3535
### Everything Else
3636

@@ -39,22 +39,22 @@ Windows/Mac usage is probably just local testing so just use `go get` for these
3939

4040
## Usage
4141

42-
Currently, Picobot has a single command: `run` and it takes a single parameter: a Git URL. This Git URL defines the
43-
"Config Repo" which contains Picobot configuration files. These configuration files declare where Picobot can find
44-
"Target Repos" which are the repos that contain all the stuff you want to automate. The reason Picobot is designed
45-
this way instead of just using the target repos to define what Picobot should do is 1. to consolidate Picobot config
42+
Currently, Pico has a single command: `run` and it takes a single parameter: a Git URL. This Git URL defines the
43+
"Config Repo" which contains Pico configuration files. These configuration files declare where Pico can find
44+
"Target Repos" which are the repos that contain all the stuff you want to automate. The reason Pico is designed
45+
this way instead of just using the target repos to define what Pico should do is 1. to consolidate Pico config
4646
into one place, 2. separate the config of the tools from the applications and 3. keep your target repos clean.
4747

48-
Picobot also has a Docker image - see below for docker-specific information.
48+
Pico also has a Docker image - see below for docker-specific information.
4949

5050
### Configuration
5151

52-
The precursor to Picobot used JSON for configuration, this was fine for simple tasks but the ability to provide a
52+
The precursor to Pico used JSON for configuration, this was fine for simple tasks but the ability to provide a
5353
little bit of logic and variables for repetitive configurations is very helpful. Inspired by [StackExchange's
54-
dnscontrol][dnscontrol], Picobot uses JavaScript files as configuration. This provides a JSON-like environment with
54+
dnscontrol][dnscontrol], Pico uses JavaScript files as configuration. This provides a JSON-like environment with
5555
the added benefit of conditional logic.
5656

57-
Here's a simple example of a configuration that should exist in the Picobot config repo that re-deploys a Docker
57+
Here's a simple example of a configuration that should exist in the Pico config repo that re-deploys a Docker
5858
Compose stack whenever it changes:
5959

6060
```js
@@ -71,7 +71,7 @@ T({
7171

7272
The `T` function declares a "Target" which is essentially a Git repository. In this example, the repository
7373
`[email protected]:username/my-docker-compose-project` would contain a `docker-compose.yml` file for some application
74-
stack. Every time you make a change to this file and push it, Picobot will pull the new version and run the command
74+
stack. Every time you make a change to this file and push it, Pico will pull the new version and run the command
7575
defined in the `up` attribute of the target, which is `docker-compose up -d`.
7676

7777
You can put as many target declarations as you want in the config file, and as many config files as you want in the
@@ -133,23 +133,23 @@ have a bunch of compose configs that all mount data to some path on the machine,
133133

134134
See the `docker-compose.yml` file for an example and read below for details.
135135

136-
You can run Picobot as a Docker container. If you're using it to deploy Docker containers via compose, this makes the
137-
most sense. This is quite simple and is best done by writing a Docker Compose configuration for Picobot in order to
136+
You can run Pico as a Docker container. If you're using it to deploy Docker containers via compose, this makes the
137+
most sense. This is quite simple and is best done by writing a Docker Compose configuration for Pico in order to
138138
bootstrap your deployment.
139139

140-
The Picobot image is built on the `docker/compose` image, since most use-cases will use Docker or Compose to deploy
140+
The Pico image is built on the `docker/compose` image, since most use-cases will use Docker or Compose to deploy
141141
services. This means you must mount the Docker API socket into the container, just like Portainer or cAdvisor or any of
142142
the other Docker tools that also run inside a container.
143143

144144
The socket is located by default at `/var/run/docker.sock` and the `docker/compose` image expects this path too, so you
145145
just need to add a volume mount to your compose that specifies `/var/run/docker.sock:/var/run/docker.sock`.
146146

147-
Another minor detail you should know is that Picobot exposes a `HOSTNAME` variable for the configuration script.
147+
Another minor detail you should know is that Pico exposes a `HOSTNAME` variable for the configuration script.
148148
However, when in a container, this hostname is a randomised string such as `b50fa67783ad`. This means, if your
149-
configuration performs checks such as `if (HOSTNAME === 'server031')`, this won't work. To resolve this, Picobot will
149+
configuration performs checks such as `if (HOSTNAME === 'server031')`, this won't work. To resolve this, Pico will
150150
attempt to read the environment variable `HOSTNAME` and use that instead of using `/etc/hostname`.
151151

152-
This means, you can bootstrap a Picobot deployment with only two variables:
152+
This means, you can bootstrap a Pico deployment with only two variables:
153153

154154
```env
155155
VAULT_TOKEN=abcxyz
@@ -158,7 +158,7 @@ HOSTNAME=server012
158158

159159
### Docker Compose and `./` in Container Volume Mounts
160160

161-
Another caveat to running Picobot in a container to execute `docker-compose` is the container filesystem will not
161+
Another caveat to running Pico in a container to execute `docker-compose` is the container filesystem will not
162162
match the host filesystem paths.
163163

164164
If you mount directories from your repository - a common strategy for versioning configuration - `./` will be expanded

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: "3"
22

33
services:
4-
picobot:
5-
image: picostack/picobot
4+
pico:
5+
image: picostack/pico
66
environment:
77
HOSTNAME: ${HOSTNAME}
88
DEBUG: "1"

go.mod

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
module github.com/picostack/picobot
1+
module github.com/picostack/pico
22

33
go 1.13
44

55
require (
66
github.com/Southclaws/gitwatch v1.3.2
77
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
8+
github.com/eapache/go-resiliency v1.2.0
89
github.com/frankban/quicktest v1.4.1 // indirect
910
github.com/go-test/deep v1.0.2 // indirect
1011
github.com/google/go-cmp v0.3.1 // indirect
@@ -20,16 +21,17 @@ require (
2021
github.com/sergi/go-diff v1.1.0 // indirect
2122
github.com/stretchr/testify v1.4.0
2223
github.com/urfave/cli v1.22.2
23-
go.uber.org/atomic v1.5.1 // indirect
24-
go.uber.org/multierr v1.4.0 // indirect
25-
go.uber.org/zap v1.13.0
26-
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678 // indirect
27-
golang.org/x/lint v0.0.0-20200130185559-910be7a94367 // indirect
28-
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
29-
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect
24+
go.uber.org/multierr v1.5.0 // indirect
25+
go.uber.org/zap v1.14.0
26+
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 // indirect
27+
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
28+
golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect
29+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
30+
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
3031
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
31-
golang.org/x/tools v0.0.0-20200213200052-63d1300efe97 // indirect
32+
golang.org/x/tools v0.0.0-20200304024140-c4206d458c3f // indirect
3233
gopkg.in/sourcemap.v1 v1.0.5 // indirect
3334
gopkg.in/square/go-jose.v2 v2.4.1 // indirect
3435
gopkg.in/src-d/go-git.v4 v4.13.1
36+
honnef.co/go/tools v0.0.1-2020.1.3 // indirect
3537
)

0 commit comments

Comments
 (0)