Sign inSign up

andersjanmyr/counter

By andersjanmyr

•Updated over 8 years ago

Counter is a web application that increases the value of a counter every time it is clicked.

Image
1

2.1K

andersjanmyr/counter repository overview

⁠Counter

Counter is a web application that increases the value of a counter every time it is clicked.

⁠Configuration

⁠Mount Point

The service can be mounted with a specific mount point (prefix path). This path can be forwarded from the load balancer as the header X-Mount-Point or it can be given as a environment variable, COUNTER_MOUNT_POINT, when starting the container.

⁠Stores

The application supports four different stores, they are configured with environment variables.

⁠Memory

This is the default store. It stores the counter in memory and is reset on every restart.

# With binary
$ counter-linux

# With docker
$ docker run -d andersjanmyr/counter
⁠Redis

Stores the counter in Redis. It is configured by setting the environment variable REDIS_URL to a Redis endpoint such as localhost:6379

# With binary and local Redis
$ REDIS_URL=localhost:6379 counter-linux

# With docker and local Redis
$ docker run -d -e REDIS_URL=localhost:6379 andersjanmyr/counter

# Or with link, assuming a Redis container named redis is running
docker run -d --link redis -e REDIS_URL=redis:6379 andersjanmyr/counter
⁠Mongo

Stores the counter in Mongo. It is configured by setting the environment variable MONGO_URL to a Mongo endpoint such as localhost:27017

# With binary and local Mongo
$ MONGO_URL=localhost:27017 counter-linux

# With docker and local Mongo
docker run -d -e MONGO_URL=localhost:27017 andersjanmyr/counter

# Or with link, assuming a Mongo container named mongo is running
docker run -d --link mongo -e MONGO_URL=mongo:27017 andersjanmyr/counter
⁠Postgres

Stores the counter in Postgres. It is configured by setting the environment variable POSTGRES_URL to a postgres endpoint such as postgres://localhost

# With binary and local Postgres
$ POSTGRES_URL=postgres://localhost counter-linux

# With docker and local Postgres
docker run -d -e POSTGRES_URL=postgres://localhost andersjanmyr/counter

# Or with link, assuming a Postgres container named postgres is running
docker run -d --link postgres -e POSTGRES_URL=postgres://postgres@postgres andersjanmyr/counter
⁠HTTP

Uses another counter service as storage. It is configured by setting the environment variable HTTP_URL to another HTTP endpoint as http://localhost:8080/counter

# With binary and local http counter (set PORT to avoid connecting to yourself)
$ PORT=8081 HTTP_URL=http://localhost:8080/counter counter-linux

# With docker and local http counter
docker run -d -e HTTP_URL=http://localhost:8080/counter andersjanmyr/counter

# Or with link, assuming a http container named counter1 is running
docker run -d --link counter1 -e HTTP_URL=http://counter1/counter andersjanmyr/counter

Tag summary

Content type

Image

Digest

sha256:200c6ced2…

Size

3.3 MB

Last updated

over 8 years ago

docker pull andersjanmyr/counter