Skip to content

Commit 4b31f82

Browse files
committed
Initial
1 parent f306f0c commit 4b31f82

File tree

5 files changed

+187
-1
lines changed

5 files changed

+187
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.env

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 dopos
3+
Copyright (c) 2019 Aleksei Kovrizhkin <lekovr+dopos@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# dcape-app-mattermost Makefile
2+
3+
SHELL = /bin/bash
4+
CFG ?= .env
5+
6+
# Database user name
7+
DB_DSN ?= postgres://user:password@host:port/database?sslmode=false
8+
9+
# Site host
10+
APP_SITE ?= pgweb.dev.lan
11+
12+
# Docker image name
13+
IMAGE ?= sosedoff/pgweb
14+
# Docker image tag
15+
IMAGE_VER ?= 0.11.2
16+
17+
# Docker-compose project name (container name prefix)
18+
PROJECT_NAME ?= $(shell basename $$PWD)
19+
20+
# dcape container name prefix
21+
DCAPE_PROJECT_NAME ?= dcape
22+
# dcape network attach to
23+
DCAPE_NET ?= $(DCAPE_PROJECT_NAME)_default
24+
25+
# Docker-compose image tag
26+
DC_VER ?= 1.23.2
27+
28+
define CONFIG_DEF
29+
# ------------------------------------------------------------------------------
30+
# pgweb settings
31+
32+
# Site host
33+
APP_SITE=$(APP_SITE)
34+
35+
# Database user name
36+
DB_DSN=$(DB_DSN)
37+
38+
# Docker details
39+
40+
# Docker image name
41+
IMAGE=$(IMAGE)
42+
# Docker image tag
43+
IMAGE_VER=$(IMAGE_VER)
44+
# Docker-compose project name (container name prefix)
45+
PROJECT_NAME=$(PROJECT_NAME)
46+
# dcape network attach to
47+
DCAPE_NET=$(DCAPE_NET)
48+
49+
endef
50+
export CONFIG_DEF
51+
52+
-include $(CFG)
53+
export
54+
55+
.PHONY: all $(CFG) start start-hook stop update up reup down docker-wait db-create db-drop psql dc help
56+
57+
all: help
58+
59+
# ------------------------------------------------------------------------------
60+
# webhook commands
61+
62+
start: up
63+
64+
start-hook: reup
65+
66+
stop: down
67+
68+
update: reup
69+
70+
# ------------------------------------------------------------------------------
71+
# docker commands
72+
73+
## старт контейнеров
74+
up:
75+
up: CMD=up -d
76+
up: dc
77+
78+
## рестарт контейнеров
79+
reup:
80+
reup: CMD=up --force-recreate -d
81+
reup: dc
82+
83+
## остановка и удаление всех контейнеров
84+
down:
85+
down: CMD=rm -f -s
86+
down: dc
87+
88+
89+
# Wait for postgresql container start
90+
docker-wait:
91+
@echo -n "Checking PG is ready..."
92+
@until [[ `docker inspect -f "{{.State.Health.Status}}" $$DCAPE_DB` == healthy ]] ; do sleep 1 ; echo -n "." ; done
93+
@echo "Ok"
94+
95+
# ------------------------------------------------------------------------------
96+
97+
# $$PWD используется для того, чтобы текущий каталог был доступен в контейнере по тому же пути
98+
# и относительные тома новых контейнеров могли его использовать
99+
## run docker-compose
100+
dc: docker-compose.yml
101+
@docker run --rm \
102+
-v /var/run/docker.sock:/var/run/docker.sock \
103+
-v $$PWD:$$PWD \
104+
-w $$PWD \
105+
docker/compose:$(DC_VER) \
106+
-p $$PROJECT_NAME \
107+
$(CMD)
108+
109+
# ------------------------------------------------------------------------------
110+
111+
$(CFG):
112+
@[ -f $@ ] || { echo "$$CONFIG_DEF" > $@ ; echo "Warning: Created default $@" ; }
113+
114+
# ------------------------------------------------------------------------------
115+
116+
## List Makefile targets
117+
help:
118+
@grep -A 1 "^##" Makefile | less
119+
120+
##
121+
## Press 'q' for exit
122+
##

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# dcape-app-pgweb
2+
3+
[![GitHub Release][1]][2] [![GitHub code size in bytes][3]]() [![GitHub license][4]][5]
4+
5+
[1]: https://img.shields.io/github/release/dopos/dcape-app-pgweb.svg
6+
[2]: https://github.com/dopos/dcape-app-pgweb/releases
7+
[3]: https://img.shields.io/github/languages/code-size/dopos/dcape-app-pgweb.svg
8+
[4]: https://img.shields.io/github/license/dopos/dcape-app-pgweb.svg
9+
[5]: LICENSE
10+
11+
[pgweb](http://sosedoff.github.io/pgweb/) application package for [dcape](https://github.com/dopos/dcape).
12+
13+
## Docker image used
14+
15+
* [sosedoff/pgweb](https://hub.docker.com/r/sosedoff/pgweb/)
16+
17+
## Requirements
18+
19+
* linux 64bit (git, make, wget, gawk, openssl)
20+
* [docker](http://docker.io)
21+
* [dcape](https://github.com/dopos/dcape)
22+
* Git service ([github](https://github.com), [gitea](https://gitea.io) or [gogs](https://gogs.io))
23+
24+
## Usage
25+
26+
* Fork this repo in your Git service
27+
* Setup deploy hook
28+
* Run "Test delivery" (config sample will be created in dcape)
29+
* Edit and save config (enable deploy etc)
30+
* Run "Test delivery" again (app will be installed and started on webhook host)
31+
32+
See also: [Deploy setup](https://github.com/dopos/dcape/blob/master/DEPLOY.md) (in Russian)
33+
34+
## License
35+
36+
The MIT License (MIT), see [LICENSE](LICENSE).
37+
38+
Copyright (c) 2019 Aleksei Kovrizhkin <lekovr+dopos@gmail.com>

docker-compose.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3.2"
2+
services:
3+
4+
www:
5+
image: ${IMAGE}:${IMAGE_VER}
6+
command:
7+
pgweb --bind=0.0.0.0
8+
restart: always
9+
networks:
10+
- lan
11+
labels:
12+
- "traefik.enable=true"
13+
- "traefik.port=8081"
14+
- "traefik.frontend.rule=Host:${APP_SITE}"
15+
volumes:
16+
- /etc/timezone:/etc/timezone:ro
17+
- /etc/localtime:/etc/localtime:ro
18+
environment:
19+
- DATABASE_URL=${DB_DSN}
20+
- SESSIONS=1
21+
22+
networks:
23+
lan:
24+
external:
25+
name: ${DCAPE_NET}

0 commit comments

Comments
 (0)