Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated several doc files #1

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ignore all Dockerfile copies into the containers since they're not reqiured there
# and speedup delevoping Dockerfiles
**/Dockerfile
.git
.git
.github
52 changes: 50 additions & 2 deletions .github/workflows/docker-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,54 @@ env:
DOCKER_PUSH: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Populate Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_USERNAME }}/pwpush
flavor: |
latest=false
tags: |
type=match,pattern=release
type=schedule,pattern=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern=latest

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
file: ./containers/docker/pwpush/Dockerfile
platforms: linux/amd64,linux/arm64
provenance: false
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush:buildcache,mode=max,ignore-error=${{env.DOCKER_PUSH == 'false'}}

# 'buildObsolete'-job can be completly removed after dropping support
# for old docker images.
buildObsolete:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -77,5 +125,5 @@ jobs:
push: ${{env.DOCKER_PUSH == 'true'}}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush-${{ matrix.dbType }}:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/pwpush-${{ matrix.dbType }}:buildcache,mode=max,ignore-error=${{env.DOCKER_PUSH == 'false'}}
build-args: |
BASEIMAGE=${{ secrets.DOCKER_USERNAME }}/pwpush:${{ steps.meta.outputs.version }}
2 changes: 2 additions & 0 deletions Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ Password Pusher has a pre-compilation step of assets. This is used to fingerpri

If using Docker containers, you can simply set the `PWP_PRECOMPILE=true` environment variable. On container boot, all assets will be precompiled and bundled into `/assets`.

__Note: Precompiling all application assets for a new theme on container boot can add 30-90 seconds to the boot process (depending on the system). Make sure to allow this time in your health checks before declaring the container as unresponsive.__

To manually precompile assets run `bin/rails assets:precompile`.

## Adding an entirely new theme from scratch
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ GEM
autoprefixer-rails (10.4.15.0)
execjs (~> 2)
aws-eventstream (1.2.0)
aws-partitions (1.831.0)
aws-sdk-core (3.185.0)
aws-partitions (1.834.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -170,7 +170,7 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.11.1)
devise-i18n (1.12.0)
devise (>= 4.9.0)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
Expand Down Expand Up @@ -233,7 +233,7 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
ffi (1.16.2)
ffi (1.16.3)
foreman (0.87.2)
forwardable (1.3.3)
gettext (3.4.4)
Expand Down Expand Up @@ -348,7 +348,7 @@ GEM
mysql2 (0.5.5)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.3.7)
net-imap (0.4.0)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -373,7 +373,7 @@ GEM
orm_adapter (0.5.0)
os (1.1.4)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pg (1.5.4)
Expand Down Expand Up @@ -442,7 +442,7 @@ GEM
rdoc (6.5.0)
psych (>= 4.0.0)
regexp_parser (2.8.1)
reline (0.3.8)
reline (0.3.9)
io-console (~> 0.5)
representable (3.2.0)
declarative (< 0.1.0)
Expand All @@ -456,9 +456,9 @@ GEM
retriable (3.1.2)
rexml (3.2.6)
rollbar (3.4.0)
route_translator (14.0.1)
actionpack (>= 6.1, < 7.1)
activesupport (>= 6.1, < 7.1)
route_translator (14.1.0)
actionpack (>= 6.1, < 7.2)
activesupport (>= 6.1, < 7.2)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Password Pusher is also on [on Twitter](https://twitter.com/pwpush), [Gettr](htt

_or_

→ Run your own instance with one command: `docker run -d -p "5100:5100" pglombardo/pwpush-ephemeral:release` then go to http://localhost:5100
→ Run your own instance with one command: `docker run -d -p "5100:5100" pglombardo/pwpush:release` then go to http://localhost:5100

_or_

Expand All @@ -82,35 +82,35 @@ Docker images of Password Pusher are available on [Docker hub](https://hub.docke
**➜ ephemeral**
_Temporary database that is wiped on container restart._

docker run -d -p "5100:5100" pglombardo/pwpush-ephemeral:release
docker run -d -p "5100:5100" pglombardo/pwpush:release

[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#pwpush-ephemeral)
[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#ephemeral)

**➜ using an External Postgres Database**
_Postgres database backed instance._

docker run -d -p "5100:5100" pglombardo/pwpush-postgres:release
docker run -d -p "5100:5100" pglombardo/pwpush:release -e DATABASE_URL=postgres://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db

[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#pwpush-postgres)
[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#postgres)

**➜ using an External MariaDB (MySQL) Database**
_Mariadb database backed instance._

docker run -d -p "5100:5100" pglombardo/pwpush-mysql:release
docker run -d -p "5100:5100" pglombardo/pwpush:release -e DATABASE_URL=mysql2://passwordpusher_user:passwordpusher_passwd@mysql:3306/passwordpusher_db

[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#pwpush-mysql)
[Learn more](https://github.com/pglombardo/PasswordPusher/tree/master/containers/docker#mysql)

_Note: The `latest` Docker container tag builds nightly off of the latest code changes and can occasionally be unstable. Always use the ['release' or version'd tags](https://hub.docker.com/repository/docker/pglombardo/pwpush-ephemeral/tags?page=1&ordering=last_updated) if you prefer more stability in releases._
_Note: The `latest` Docker container tag builds nightly off of the latest code changes and can occasionally be unstable. Always use the ['release' or version'd tags](https://hub.docker.com/r/pglombardo/pwpush/tags?page=1&ordering=last_updated) if you prefer more stability in releases._

## With Docker Compose

**➜ One-liner Password Pusher with a Postgres Database**

curl -s -o docker-compose.yml https://raw.githubusercontent.com/pglombardo/PasswordPusher/master/containers/docker/pwpush-postgres/docker-compose.yml && docker compose up -d
curl -s -o docker-compose.yml https://raw.githubusercontent.com/pglombardo/PasswordPusher/master/containers/docker/pwpush/docker-compose-postgres.yml && docker compose up -d

**➜ One-liner Password Pusher with a MariaDB (MySQL) Database**

curl -s -o docker-compose.yml https://raw.githubusercontent.com/pglombardo/PasswordPusher/master/containers/docker/pwpush-mysql/docker-compose.yml && docker compose up -d
curl -s -o docker-compose.yml https://raw.githubusercontent.com/pglombardo/PasswordPusher/master/containers/docker/pwpush/docker-compose-mariadb.yml && docker compose up -d

## On Kubernetes

Expand Down
85 changes: 42 additions & 43 deletions containers/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,37 @@
# Password Pusher & Docker Containers
# Password Pusher & Docker Container

## Container Types
# Docker Container
Available on Docker hub: [pwpush](https://hub.docker.com/r/pglombardo/pwpush)

| Container Name | Description|
|-|-|
| **pwpush-ephemeral** | SQLite3 backed container that runs alone. All data is lost after a container restart.|
| **pwpush-postgres** | Postgres backed container that can be pointed to a pre-existing database instance using an environment variable (`DATABASE_URL`).|
| **pwpush-mysql** | MySQL or Mariadb backed container that can be pointed to a pre-existing database instance using an environment variable (`DATABASE_URL`).|

## Tags
## Supported database backends

| Tag Name | Description |
| Backend | Description|
|-|-|
| `latest` | Builds off of the latest code. May occasionally be unstable. |
| `release` | Points to the latest _stable_ release. |
| `X.X.X` | Semantic version tags. |

When in doubt, use `release`.
| **ephemeral** | SQLite3 backed container that runs alone. All data is lost after a container restart. This is set by default|
| **postgres** | Postgres backed container that can be pointed to a pre-existing database instance using an environment variable (`DATABASE_URL`).|
| **mysql** | MySQL or Mariadb backed container that can be pointed to a pre-existing database instance using an environment variable (`DATABASE_URL`).|

`amd64` and `arm64` architectures are both built. Note [this bug](https://github.com/pglombardo/PasswordPusher/issues/268) in regards to tag availability for the `arm64` architecture.

# Docker Compose

For a quick boot of a database backed application, see the available Docker Compose files:
## ephemeral

* [pwpush-postgres](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush-postgres/docker-compose.yml)
* [pwpush-mysql](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush-mysql/docker-compose.yml)

# Docker Containers

## pwpush-ephemeral

This is a single container that runs independently using sqlite3 with no persistent storage (if you recreate the container the data is lost); best if don't care too much about the data and and looking for simplicity in deployment.
This configuration runs independently using sqlite3 with no persistent storage (if you recreate the container the data is lost); best if don't care too much about the data and and looking for simplicity in deployment.

To run an ephemeral version of Password Pusher that saves no data after a container restart:
`docker run -p "8000:5100" pglombardo/pwpush-ephemeral:latest`
`docker run -p "8000:5100" pglombardo/pwpush:latest`

_This example is set to listen on port 8000 for requests e.g. http://0.0.0.0:8000._

Available on Docker hub: [pwpush-ephemeral](https://hub.docker.com/repository/docker/pglombardo/pwpush-ephemeral)

See also this discussion if you want to persist data across container restarts: [pwpush-ephemeral: How to Add Persistence?](https://github.com/pglombardo/PasswordPusher/discussions/448)
See also this discussion if you want to persist data across container restarts: [pwpush-ephemeral: How to Add Persistence?](https://github.com/pglombardo/PasswordPusher/discussions/448)
(Since this link refers to an outdated ephemeral image keep in mind to use current image `pglombardo/pwpush`)

## pwpush-postgres
## postgres

This container uses a default database URL of:
To setup the container to use the postgres database backend DATABASE_URL environment variable needs to be configured. The syntax should look like:

DATABASE_URL=postgresql://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db

You can either configure your PostgreSQL server to use these credentials or override the environment var in the command line:

docker run -d -p "5100:5100" -e "DATABASE_URL=postgresql://user:passwd@postgres:5432/my_db" pglombardo/pwpush-postgres:latest

Available on Docker hub: [pwpush-postgres](https://hub.docker.com/repository/docker/pglombardo/pwpush-postgres)
docker run -d -p "5100:5100" -e "DATABASE_URL=postgresql://user:passwd@postgres:5432/my_db" pglombardo/pwpush:latest

### Better Security with Password Files

Expand All @@ -61,16 +40,36 @@ Providing a PostgreSQL password on the command line such as in the preceeding is
See [this section on Docker Secrets](https://github.com/docker-library/docs/blob/master/postgres/README.md#docker-secrets) on how to avoid passing credentials on the command line. Further, also [consider this example](https://github.com/pglombardo/PasswordPusher/issues/412) provided by [Viajaz](https://github.com/Viajaz).


## pwpush-mysql
## mysql

This container uses a default database URL of:
To setup the container to use the mysql/mariadb database backend DATABASE_URL environment variable needs to be configured. The syntax should look like:

DATABASE_URL=mysql2://passwordpusher_user:passwordpusher_passwd@mysql:3306/passwordpusher_db

You can either configure your MySQL server to use these credentials or override the environment var in the command line:
You can either configure your MySQL / MariaDB server to use these credentials or override the environment var in the command line:

docker run -d -p "5100:5100" -e "DATABASE_URL=mysql2://pwpush_user:pwpush_passwd@mysql:3306/pwpush_db" pglombardo/pwpush:latest

_Note: Providing a MySQL / MariaDB password on the command line is far less than ideal_


## Tags

| Tag Name | Description |
|-|-|
| `latest` | Builds off of the latest code. May occasionally be unstable. |
| `release` | Points to the latest _stable_ release. |
| `X.X.X` | Semantic version tags. |

When in doubt, use `release`.

docker run -d -p "5100:5100" -e "DATABASE_URL=mysql2://pwpush_user:pwpush_passwd@mysql:3306/pwpush_db" pglombardo/pwpush-mysql:latest
`amd64` and `arm64` architectures are both built. Note [this bug](https://github.com/pglombardo/PasswordPusher/issues/268) in regards to tag availability for the `arm64` architecture.

# Docker Compose

_Note: Providing a MySQL password on the command line is far less than ideal_
For a quick boot of a database backed application, see the available Docker Compose files:
* [ephemeral](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush/docker-compose-ephemeral.yml)
* [postgres](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush/docker-compose-postgres.yml)
* [mysql](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush/docker-compose-mysql.yml)
* [mariadb](https://github.com/pglombardo/PasswordPusher/blob/master/containers/docker/pwpush/docker-compose-mariadb.yml)

Available on Docker hub: [pwpush-mysql](https://hub.docker.com/repository/docker/pglombardo/pwpush-mysql)
34 changes: 19 additions & 15 deletions containers/docker/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Container Release Cheat Sheet

cd pwpush-postgres
cd pwpush
docker build --no-cache -t pglombardo/pwpush:<version> .
docker push pglombardo/pwpush:<version>
docker tag <tag> pglombardo/pwpush:latest
docker push pglombardo/pwpush:latest

docker build --no-cache -t pglombardo/pwpush-postgres:<version> .
cd pwpush-postgres

docker push pglombardo/pwpush-postgres:<version>
docker build --no-cache -t pglombardo/pwpush-postgres:<version> .
docker push pglombardo/pwpush-postgres:<version>
docker tag <tag> pglombardo/pwpush-postgres:latest
docker push pglombardo/pwpush-postgres:latest

docker tag <tag> pglombardo/pwpush-postgres:latest
cd pwpush-ephemeral
docker build --no-cache -t pglombardo/pwpush-ephemeral:<version> .
docker push pglombardo/pwpush-ephemeral:<version>
docker tag <tag> pglombardo/pwpush-ephemeral:latest
docker push pglombardo/pwpush-ephemeral:latest

docker push pglombardo/pwpush-postgres:latest

cd pwpush-ephemeral
docker build --no-cache -t pglombardo/pwpush-ephemeral:<version> .
docker push pglombardo/pwpush-ephemeral:<version>
docker tag <tag> pglombardo/pwpush-ephemeral:latest
docker push pglombardo/pwpush-ephemeral:latest

docker tag pglombardo/pwpush-ephemeral:1.10.2 pglombardo/pwpush-ephemeral:release
docker tag pglombardo/pwpush-postgres:1.10.2 pglombardo/pwpush-postgres:release
docker tag pglombardo/pwpush-mysql:1.10.2 pglombardo/pwpush-mysql:release
docker tag pglombardo/pwpush:1.10.2 pglombardo/pwpush:release
docker tag pglombardo/pwpush-ephemeral:1.10.2 pglombardo/pwpush-ephemeral:release
docker tag pglombardo/pwpush-postgres:1.10.2 pglombardo/pwpush-postgres:release
docker tag pglombardo/pwpush-mysql:1.10.2 pglombardo/pwpush-mysql:release
2 changes: 1 addition & 1 deletion containers/docker/pwpush-docker-env-file
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Docker container.
#
# This can be passed to docker as:
# docker run -d --env-file ./pwpush-docker-env-file pglombardo/pwpush-ephemeral:release
# docker run -d --env-file ./pwpush-docker-env-file pglombardo/pwpush:release
#
# This is not an authoratative list of possible environment variables.
# See the full list of supported configuration environment variables:
Expand Down
Loading