~qeef/damn-deploy

1ad4660d6f55a9b05148e6960cecc9a16435f9b2 — Jiri Vlasak 3 months ago bd0df51
Add docker www service
3 files changed, 16 insertions(+), 0 deletions(-)

M .env
M README.md
M server.yml
M .env => .env +2 -0
@@ 15,6 15,7 @@ OAUTH_CONSUMER_SECRET=osm.org > My Settings > oauth settings > page bottom
# Necessary settings.
#
DOMAIN_NAME=damn-project.org
WWW_REPO=https://git.sr.ht/~qeef/damn-www.git

####################################################
#                                                  #


@@ 46,6 47,7 @@ SERVER_SUB=server
DAMN_SERVER_VERSION=v0.7.0
DAMN_CLIENTS=*,
DB_HOST=damndb_server
WWW_SUB=www

# Optional client settings.
#

M README.md => README.md +2 -0
@@ 52,6 52,7 @@ Server setup
    - `OAUTH_CONSUMER_SECRET`: API secret, get from osm.org.

    - `DOMAIN_NAME`: Use your domain.
    - `WWW_REPO`: Link to a docker git repository with web pages.

    The following are optinal settings. You don't need to change them. The
    defaults work good.


@@ 60,6 61,7 @@ Server setup
    - `DAMN_SERVER_VERSION`: Choose the version of the server.
    - `DAMN_CLIENTS`: Allow origins clients.
    - `DB_HOST`: Alias of `db` docker service, keep that value.
    - `WWW_SUB`: The subdomain for the web pages.

2. Set proper email address in `traefik.yml` file.


M server.yml => server.yml +12 -0
@@ 29,6 29,18 @@ services:
        env_file: .env
        links:
            - db
    www:
        build:
            context: ${WWW_REPO}
        restart: always
        labels:
            - "traefik.http.routers.www.rule=Host(`${WWW_SUB}.${DOMAIN_NAME}`) || Host(`${DOMAIN_NAME}`)"
            - "traefik.http.routers.www.tls=true"
            - "traefik.http.routers.www.tls.certresolver=le"
            - "traefik.http.routers.www.middlewares=redir-www@docker"
            - "traefik.http.middlewares.redir-www.redirectRegex.regex=^https://${DOMAIN_NAME}/(.*)"
            - "traefik.http.middlewares.redir-www.redirectRegex.replacement=https://${WWW_SUB}.${DOMAIN_NAME}/$${1}"
            - "traefik.http.middlewares.redir-www.redirectRegex.permanent=true"
    traefik:
        image: traefik:v2.0
        restart: always