feat: implement base features
This commit is contained in:
parent
9c930d1d1c
commit
31be2a7117
6 changed files with 208 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
.drone.yml
|
||||
.git
|
111
.drone.yml
111
.drone.yml
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: debug
|
||||
image: alpine
|
||||
environment:
|
||||
|
||||
commands:
|
||||
- 'echo "Repository: glenux/service-wallabag"'
|
||||
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
|
||||
|
||||
- name: publish:commit_sha
|
||||
image: plugins/docker
|
||||
# pull: never
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# path: /stupid
|
||||
environment:
|
||||
DOCKER_REPO: glenux/service-wallabag
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-wallabag:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-wallabag
|
||||
tags: "${DRONE_COMMIT_SHA:0:8}"
|
||||
purge: false
|
||||
|
||||
- name: publish:commit_branch
|
||||
image: plugins/docker
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# path: /stupid
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-wallabag:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-wallabag
|
||||
tags: "latest_${DRONE_BRANCH/\\//-}"
|
||||
purge: false
|
||||
when:
|
||||
branch:
|
||||
- "master"
|
||||
- "develop"
|
||||
- "feature/*"
|
||||
|
||||
- name: publish:latest
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-wallabag:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-wallabag
|
||||
tags: latest
|
||||
purge: false
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: deploy:dokku
|
||||
image: alpine
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
environment:
|
||||
SSH_USER:
|
||||
from_secret: SSH_USER
|
||||
SSH_HOST:
|
||||
from_secret: SSH_HOST
|
||||
SSH_PRIVATE_KEY:
|
||||
from_secret: SSH_PRIVATE_KEY
|
||||
commands:
|
||||
- echo $SSH_USER
|
||||
- echo $SSH_HOST
|
||||
- echo $SSH_PRIVATE_KEY
|
||||
- apk update && apk add openssh-client
|
||||
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||
- echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key
|
||||
- chmod 600 ~/.ssh/deploy_key
|
||||
- ssh -o StrictHostKeyChecking=no
|
||||
-i ~/.ssh/deploy_key
|
||||
"$SSH_USER@$SSH_HOST"
|
||||
git:from-image automation
|
||||
"glenux/service-wallabag:${DRONE_COMMIT_SHA:0:8}"
|
||||
#
|
||||
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# temp: {}
|
||||
#
|
||||
# ---
|
||||
# kind: pipeline
|
||||
# type: docker
|
||||
# name: sheduled
|
||||
#
|
||||
# steps:
|
||||
# - name: check:update
|
||||
# image: alpine
|
||||
# environment:
|
||||
#
|
||||
# commands:
|
||||
# - 'echo "Repository: glenux/service-wallabag"'
|
||||
# - 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
|
|
@ -0,0 +1,8 @@
|
|||
FROM wallabag/wallabag:2.6.9
|
||||
|
||||
# Copy custom entrypoint script
|
||||
COPY --chown=wallabag:wallabag --chmod=755 entrypoint-wrapper.sh /entrypoint-wrapper.sh
|
||||
|
||||
# Set the custom entrypoint
|
||||
ENTRYPOINT ["/entrypoint-wrapper.sh"]
|
||||
|
26
README.md
26
README.md
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
dokku apps:create wallabag
|
||||
|
||||
|
||||
dokku mariadb:create wallabag_db
|
||||
dokku mariadb:link wallabag_db wallabag
|
||||
dokku redis:create wallabag_redis
|
||||
dokku redis:link wallabag_redis wallabag
|
||||
dokku config:set wallabag MYSQL_ROOT_PASSWORD=wallaroot
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_HOST=$(dokku mariadb:info wallabag_db --dsn | grep '^Host=' | cut -d= -f2)
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_PORT=3306
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_NAME=wallabag
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_USER=wallabag
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
|
||||
dokku config:set wallabag SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
|
||||
dokku config:set wallabag SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
|
||||
dokku config:set wallabag SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
|
||||
dokku config:set wallabag SYMFONY__ENV__DOMAIN_NAME=https://your-wallabag-instance.wallabag.org
|
||||
dokku config:set wallabag SYMFONY__ENV__SERVER_NAME="Your wallabag instance"
|
||||
mkdir -p /opt/wallabag/images
|
||||
dokku storage:mount wallabag /opt/wallabag/images:/var/www/wallabag/web/assets/images
|
||||
FROM wallabag/wallabag
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
version: '3'
|
||||
services:
|
||||
wallabag:
|
||||
image: wallabag/wallabag
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=wallaroot
|
||||
- SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
|
||||
- SYMFONY__ENV__DATABASE_HOST=db
|
||||
- SYMFONY__ENV__DATABASE_PORT=3306
|
||||
- SYMFONY__ENV__DATABASE_NAME=wallabag
|
||||
- SYMFONY__ENV__DATABASE_USER=wallabag
|
||||
- SYMFONY__ENV__DATABASE_PASSWORD=wallapass
|
||||
- SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
|
||||
- SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
|
||||
- SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
|
||||
- SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
|
||||
- SYMFONY__ENV__DOMAIN_NAME=https://your-wallabag-instance.wallabag.org
|
||||
- SYMFONY__ENV__SERVER_NAME="Your wallabag instance"
|
||||
ports:
|
||||
- "80"
|
||||
volumes:
|
||||
- /opt/wallabag/images:/var/www/wallabag/web/assets/images
|
||||
healthcheck:
|
||||
test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost"]
|
||||
interval: 1m
|
||||
timeout: 3s
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
db:
|
||||
image: mariadb
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=wallaroot
|
||||
volumes:
|
||||
- /opt/wallabag/data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
||||
interval: 20s
|
||||
timeout: 3s
|
||||
redis:
|
||||
image: redis:alpine
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 20s
|
||||
timeout: 3s
|
16
entrypoint-wrapper.sh
Normal file
16
entrypoint-wrapper.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Parse DATABASE_URL
|
||||
if [ -n "$DATABASE_URL" ]; then
|
||||
export SYMFONY__ENV__DATABASE_DRIVER=$(echo $DATABASE_URL | sed -e 's,^\(.*\)://.*,\\1,g')
|
||||
export SYMFONY__ENV__DATABASE_USER=$(echo $DATABASE_URL | sed -e 's,.*://\([^:]*\):.*,\1,g')
|
||||
export SYMFONY__ENV__DATABASE_PASSWORD=$(echo $DATABASE_URL | sed -e 's,.*:.\([^@]*\)@.*,\\1,g')
|
||||
export SYMFONY__ENV__DATABASE_HOST=$(echo $DATABASE_URL | sed -e 's,.*@\([^:]*\):.*,\\1,g')
|
||||
export SYMFONY__ENV__DATABASE_PORT=$(echo $DATABASE_URL | sed -e 's,.*:\([^/]*\)/.*,\\1,g')
|
||||
export SYMFONY__ENV__DATABASE_NAME=$(echo $DATABASE_URL | sed -e 's,.*\/\([^?]*\).*,\\1,g')
|
||||
fi
|
||||
|
||||
# Call the original entrypoint
|
||||
exec docker-php-entrypoint "$@"
|
||||
|
||||
|
Loading…
Reference in a new issue