Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Updated README with disclaimer and increment ver. (#11)
Browse files Browse the repository at this point in the history
Updated the version of redis to 7.2.4 from 7.2.1

Signed-off-by: Bill Maxwell <[email protected]>
  • Loading branch information
cloudnautique authored Jan 17, 2024
1 parent cc3eb5d commit a10544d
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 62 deletions.
95 changes: 47 additions & 48 deletions Acornfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,67 @@ services: db: {
}

containers: {
redis: {
name: "Redis"
description: "Container running a Redis server"
image: "redis:7.2.1-alpine"
entrypoint: ["redis-server", "--aclfile", "/etc/users.acl"]
ports: "6379/tcp"
files: {
"/etc/users.acl": "secret://users-acl/template"
}
dirs: {
"/data": "volume://db-data"
}
probes: [
{
type: "liveness"
initialDelaySeconds: 10
timeoutSeconds: 5
tcp:{
url: "tcp://localhost:6379"
}
},
{
type: "readiness"
initialDelaySeconds: 10
exec: command: localData.readinessProbeCommand
},
]
}
redis: {
name: "Redis"
description: "Container running a Redis server"
image: "redis:7.2.4-alpine"
entrypoint: ["redis-server", "--aclfile", "/etc/users.acl"]
ports: "6379/tcp"
files: {
"/etc/users.acl": "secret://users-acl/template"
}
dirs: {
"/data": "volume://db-data"
}
probes: [
{
type: "liveness"
initialDelaySeconds: 10
timeoutSeconds: 5
tcp: {
url: "tcp://localhost:6379"
}
},
{
type: "readiness"
initialDelaySeconds: 10
exec: command: localData.readinessProbeCommand
},
]
}
}

volumes: {
"db-data": {}
"db-data": {}
}

secrets: {
"admin": {
name: "password to be used for the admin user"
type: "token"
params: {
length: 16
characters: "abcdedfhifj01234567890"
}
data: token: ""
}
admin: {
name: "password to be used for the admin user"
type: "token"
params: {
length: 16
characters: "abcdedfhifj01234567890"
}
data: token: ""
}
}

secrets: {
"users-acl": {
type: "template"
data: {
template: """
"users-acl": {
type: "template"
data: {
template: """
user default on >${secret://admin/token} ~* &* +@all
"""
}
}
}
}
}

localData: readinessProbeCommand: [
"/bin/sh",
"-c",
"redis-cli --pass ${secret://admin/token} ping"
"/bin/sh",
"-c",
"redis-cli --pass ${secret://admin/token} ping",
]

localData: info: """
Expand All @@ -92,4 +92,3 @@ localData: info: """
}
}
"""

34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ Redis is an in-memory data store, used as a database, cache, and message broker.
The Acornfile used to create a Redis based Acorn Service is available in the GitHub repository at [https://github.com/acorn-io/redis](https://github.com/acorn-io/redis). This service triggers the creation of a Redis database running in a single container which can easily be used by an application during development.

This Redis instance:

- is backed by a persistent volume
- uses a default (auto generated) password for the admin user

The Acorn image of this service is hosted in GitHub container registry at [ghcr.io/acorn-io/redis:v#.#-#](ghcr.io/acorn-io/redis).
The Acorn image of this service is hosted in GitHub container registry at [ghcr.io/acorn-io/redis:v#.#.#-#](ghcr.io/acorn-io/redis).

Currently this Acorn does not have any configuration options, but some will be added later on like:

- the possibility to indicate the Redis version to use
- the size of the persistent volume

## Usage

The [examples folder](https://github.com/acorn-io/redis/tree/main/examples) contains a sample application using this Service. This app consists in a Python backend based on the FastAPI library, it displays a web page indicating the number of times the application was called, a counter is saved in the underlying Redis database and incremented with each request. The screenshot below shows the UI of the example application.
The [examples folder](https://github.com/acorn-io/redis/tree/main/examples) contains a sample application using this Service. This app consists in a Python backend based on the FastAPI library, it displays a web page indicating the number of times the application was called, a counter is saved in the underlying Redis database and incremented with each request. The screenshot below shows the UI of the example application.

![UI](./examples/images/ui.png)

Expand All @@ -34,20 +36,21 @@ Next we define the application container:

```
containers: app: {
build: {
context: "."
target: "dev"
}
consumes: ["db"]
ports: publish: "8000/http"
env: {
REDIS_HOST: "@{service.db.address}"
REDIS_PASS: "@{service.db.secrets.admin.token}"
}
build: {
context: "."
target: "dev"
}
consumes: ["db"]
ports: publish: "8000/http"
env: {
REDIS_HOST: "@{service.db.address}"
REDIS_PASS: "@{service.db.secrets.admin.token}"
}
}
```

This container is built using the Dockerfile in the examples folder. Once built, the container consumes the Redis service using the address and admin password provided through dedicated variables:

- @{service.db.address}
- @{service.db.secrets.admin.token}

Expand All @@ -59,11 +62,14 @@ acorn run -n app

After a few tens of seconds an http endpoint will be returned. Using this endpoint we can access the application and see the counter incremented on each reload of the page.


## Deploy the app to your Acorn Sandbox

Instead of managing your own Acorn installation, you can deploy this application in the Acorn Sandbox, the free SaaS offering provided by Acorn. Access to the sandbox requires only a GitHub account, which is used for authentication.

[![Run in Acorn](https://acorn.io/v1-ui/run/badge?image=ghcr.io+acorn-io+redis+examples:v%23.%23.%23-%23)](https://acorn.io/run/ghcr.io/acorn-io/redis/examples:v%23.%23.%23-%23)

An application running in the Sandbox will automatically shut down after 2 hours, but you can use the Acorn Pro plan to remove the time limit and gain additional functionalities.
An application running in the Sandbox will automatically shut down after 2 hours, but you can use the Acorn Pro plan to remove the time limit and gain additional functionalities.

## Disclaimer

Disclaimer: You agree all software products on this site, including Acorns or their contents, may contain projects and materials subject to intellectual property restrictions and/or Open-Source license (“Restricted Items”). Restricted Items found anywhere within this Acorn or on Acorn.io are provided “as-is” without warranty of any kind and are subject to their own Open-Source licenses and your compliance with such licenses are solely and exclusively your responsibility. [Redis](https://redis.io) is licensed under three clause BSD license which can be found [here](https://redis.io/docs/about/license/#three-clause-bsd-license) and Acorn.io does not endorse and is not affiliated with Redis. By using Acorn.io you agree to our general disclaimer here: <https://www.acorn.io/terms-of-use>.

0 comments on commit a10544d

Please sign in to comment.