Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

docker-compose 1.27 & Flask 1.1.2 & gitpython 3.1.8 & Python 3.8 #119

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4a04714
upgrade to docker-compose 1.25.4
nsano-rururu Mar 21, 2020
1f1e15e
Dockerfile multi-stage builds
nsano-rururu Mar 22, 2020
f21ab2d
upgrade to docker-compose 1.25.5
nsano-rururu Apr 15, 2020
2454846
upgrade to docker-compose 1.26.0
nsano-rururu Jun 3, 2020
abb542d
upgrade to docker-compose 1.26.1
nsano-rururu Jul 1, 2020
bdde52e
upgrade to docker-compose 1.26.2
nsano-rururu Jul 4, 2020
30917cf
upgrade to docker-compose 1.27.3
nsano-rururu Sep 22, 2020
99d6b55
upgrade to docker-compose 1.27.4
nsano-rururu Sep 26, 2020
cc09ade
gitpython 2.1.15 to 3.1.8
nsano-rururu Sep 27, 2020
e887170
Update README.md
nsano-rururu Oct 4, 2020
7d40ebd
Bump python from 3.8-alpine to 3.9.0-alpine
dependabot-preview[bot] Oct 7, 2020
251bff2
Bump gitpython from 3.1.8 to 3.1.11
dependabot-preview[bot] Oct 23, 2020
7f3fd0a
Merge pull request #15 from nsano-rururu/dependabot/pip/gitpython-3.1.11
nsano-rururu Nov 21, 2020
d2f4b48
Merge pull request #14 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu Nov 21, 2020
e021f0b
Update Version
nsano-rururu Nov 21, 2020
884b984
Update README.md
nsano-rururu Nov 21, 2020
5fd11ca
Update README.md
nsano-rururu Nov 21, 2020
79bcbd7
Bump python from 3.9.0-alpine to 3.9.1-alpine
dependabot-preview[bot] Dec 8, 2020
d3862d9
Merge pull request #19 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu Dec 9, 2020
97e1a0c
docker-compose and gitpython update
nsano-rururu Mar 10, 2021
4e46b7e
Bump docker-compose from 1.28.5 to 1.28.6
dependabot-preview[bot] Mar 23, 2021
9de0500
added support for specifying a URL prefix, useful for multiple applic…
Ceralor Mar 25, 2021
d7250da
added attribution for solution
Ceralor Mar 25, 2021
0b9c835
added information on using URL prefix
Ceralor Mar 25, 2021
bcc9802
Merge pull request #30 from Ceralor/url-prefix
nsano-rururu Mar 28, 2021
c3f51ee
Merge pull request #29 from nsano-rururu/dependabot/pip/docker-compos…
nsano-rururu Mar 28, 2021
b84da26
Update README.md
nsano-rururu Mar 28, 2021
65407f7
Update Dockerfile
nsano-rururu Mar 28, 2021
aefbf9b
Update README.md
nsano-rururu Mar 29, 2021
39b3159
Update README.md
nsano-rururu Mar 29, 2021
9bc25fa
Update Dockerfile
nsano-rururu Mar 30, 2021
d1963c7
Bump python from 3.9.2-alpine to 3.9.4-alpine
dependabot-preview[bot] Apr 6, 2021
8a6e60e
Bump docker-compose from 1.28.6 to 1.29.0
dependabot-preview[bot] Apr 7, 2021
0ab24ac
Merge pull request #44 from nsano-rururu/dependabot/pip/docker-compos…
nsano-rururu Apr 12, 2021
fb3c29b
Merge pull request #43 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu Apr 12, 2021
a5cff0a
Update README.md
nsano-rururu Apr 12, 2021
446809a
Bump docker-compose from 1.29.0 to 1.29.1
dependabot-preview[bot] Apr 14, 2021
d2e12a9
Merge pull request #45 from nsano-rururu/dependabot/pip/docker-compos…
nsano-rururu Apr 15, 2021
eb21362
Update README.md
nsano-rururu Apr 15, 2021
0221b8b
Update docker-compose.yml
nsano-rururu Apr 15, 2021
4120f60
Upgrade to GitHub-native Dependabot
dependabot-preview[bot] Apr 28, 2021
e58024c
Merge pull request #46 from nsano-rururu/dependabot/add-v2-config-file
nsano-rururu Apr 29, 2021
e1eb4e9
Bump python from 3.9.4-alpine to 3.9.5-alpine
dependabot[bot] May 5, 2021
1b5cf44
Merge pull request #48 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu May 8, 2021
cfe197a
Bump flask from 1.1.2 to 2.0.0
dependabot[bot] May 12, 2021
0f1e642
Bump gitpython from 3.1.14 to 3.1.17
dependabot[bot] May 14, 2021
484b055
Merge pull request #52 from nsano-rururu/dependabot/pip/gitpython-3.1.17
nsano-rururu May 16, 2021
add1a8d
Merge pull request #50 from nsano-rururu/dependabot/pip/flask-2.0.0
nsano-rururu May 16, 2021
fef5dab
Bump docker-compose from 1.29.1 to 1.29.2
dependabot[bot] May 16, 2021
63caa60
Merge pull request #49 from nsano-rururu/dependabot/pip/docker-compos…
nsano-rururu May 16, 2021
db2239c
Update README.md
nsano-rururu May 16, 2021
dc54bfe
Bump flask from 2.0.0 to 2.0.1
dependabot[bot] May 21, 2021
5146712
Update issue templates
nsano-rururu May 25, 2021
34bdba6
Update issue templates
nsano-rururu May 25, 2021
6842522
Bump gitpython from 3.1.17 to 3.1.18
dependabot[bot] Jun 18, 2021
4aff608
Merge pull request #54 from nsano-rururu/dependabot/pip/gitpython-3.1.18
nsano-rururu Jun 30, 2021
f83e866
Merge pull request #53 from nsano-rururu/dependabot/pip/flask-2.0.1
nsano-rururu Jun 30, 2021
5437847
Bump python from 3.9.5-alpine to 3.9.6-alpine
dependabot[bot] Jun 30, 2021
3d407ff
Merge pull request #55 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu Jul 1, 2021
77c58bf
Bump python from 3.9.6-alpine to 3.9.7-alpine
dependabot[bot] Sep 1, 2021
5649c28
Merge pull request #57 from nsano-rururu/dependabot/docker/python-3.9…
nsano-rururu Sep 5, 2021
022cb59
Bump gitpython from 3.1.18 to 3.1.24
dependabot[bot] Sep 20, 2021
a651eeb
Merge pull request #58 from nsano-rururu/dependabot/pip/gitpython-3.1.24
nsano-rururu Sep 21, 2021
de22090
Bump flask from 2.0.1 to 2.0.2
dependabot[bot] Oct 4, 2021
8ba8340
Merge pull request #59 from nsano-rururu/dependabot/pip/flask-2.0.2
nsano-rururu Oct 5, 2021
25d6bf1
Bump python from 3.9.7-alpine to 3.10.0-alpine
dependabot[bot] Oct 6, 2021
62bd7be
Merge pull request #60 from nsano-rururu/dependabot/docker/python-3.1…
nsano-rururu Oct 9, 2021
a2c3869
Update docker-compose.yml
nsano-rururu Nov 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## 🐛 Summary

(Bug summary)

## 👀 Steps

(Bug reproduction procedure)

1. Do action
2. Do another action
3. Wrong Behavior !!

## 🆗 Expected

(State required to be Closed)

## 🚑 Actual

(State at the time of creating the issue)

## 📎 Images (optional)

(Image when a bug occurs)
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## 🎉 Goal

(State required to be Closed)

## 💪 Motivation

(Why did you set up the Issue?)
(What was the background behind creating the issue?)

## 📖 Reference (optional)

(If there is a reference link etc.)

## 📆 Schedule (optional)

(Schedule until Closed)

## 📎 Tasks (optional)

- [ ] Task 1
- [ ] Task 2
31 changes: 31 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "20:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: gitpython
versions:
- 3.1.12
- 3.1.13
- 3.1.14
- dependency-name: docker-compose
versions:
- 1.28.2
- 1.28.3
- 1.28.4
- 1.28.5
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "20:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: python
versions:
- 3.10.0a6.pre.alpine
- 3.9.2.pre.alpine
33 changes: 25 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
# https://github.com/francescou/docker-compose-ui
# DOCKER-VERSION 1.12.3
FROM python:2.7-alpine
MAINTAINER Francesco Uliana <francesco@uliana.it>
# https://github.com/nsano-rururu/docker-compose-ui
# DOCKER-VERSION 19.03
FROM python:3.10.0-alpine AS builder
MAINTAINER Naoyuki Sano <nsano@ae.em-net.ne.jp>

RUN pip install virtualenv

RUN apk add -U --no-cache git
RUN apk add -U --no-cache cargo \
git \
gcc \
libffi-dev \
make \
musl-dev \
openssl \
openssl-dev

COPY ./requirements.txt /app/requirements.txt
RUN virtualenv /env && /env/bin/pip install --no-cache-dir -r /app/requirements.txt
RUN virtualenv /env && \
/env/bin/python -m pip install --upgrade pip && \
/env/bin/pip install --no-cache-dir cryptography && \
/env/bin/pip install --no-cache-dir -r /app/requirements.txt

COPY . /app
COPY demo-projects /opt/docker-compose-projects

FROM python:3.10.0-alpine

RUN apk add -U --no-cache git

VOLUME ["/opt/docker-compose-projects"]

COPY demo-projects /opt/docker-compose-projects
COPY --from=builder /env /env
COPY --from=builder /app /app
COPY --from=builder /opt/docker-compose-projects /opt/docker-compose-projects

EXPOSE 5000

CMD []
ENTRYPOINT ["/env/bin/python", "/app/main.py"]

WORKDIR /opt/docker-compose-projects/
WORKDIR /opt/docker-compose-projects/
24 changes: 17 additions & 7 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# https://github.com/francescou/docker-compose-ui
# DOCKER-VERSION 1.12.3
FROM python:2.7-alpine
MAINTAINER Francesco Uliana <francesco@uliana.it>
# https://github.com/nsano-rururu/docker-compose-ui
# DOCKER-VERSION 19.03
FROM python:3.10.0-alpine
MAINTAINER Naoyuki Sano <nsano@ae.em-net.ne.jp>

RUN pip install virtualenv

RUN apk add -U --no-cache git
RUN apk add -U --no-cache cargo \
git \
gcc \
libffi-dev \
make \
musl-dev \
openssl \
openssl-dev

COPY ./requirements.txt /app/requirements.txt
RUN virtualenv /env && /env/bin/pip install --no-cache-dir -r /app/requirements.txt
RUN virtualenv /env && \
/env/bin/python -m pip install --upgrade pip && \
/env/bin/pip install --no-cache-dir cryptography && \
/env/bin/pip install --no-cache-dir -r /app/requirements.txt

VOLUME /app

Expand All @@ -21,4 +31,4 @@ EXPOSE 5000
CMD []
ENTRYPOINT ["/env/bin/python", "/app/main.py"]

WORKDIR /opt/docker-compose-projects/
WORKDIR /opt/docker-compose-projects/
65 changes: 43 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
![Docker Compose UI](https://raw.githubusercontent.com/francescou/docker-compose-ui/master/static/images/logo-dark.png)
# Fork of francescou/docker-compose-ui

[![Docker Stars](https://img.shields.io/docker/stars/francescou/docker-compose-ui.svg)](https://hub.docker.com/r/francescou/docker-compose-ui/)
[![Docker Pulls](https://img.shields.io/docker/pulls/francescou/docker-compose-ui.svg)](https://hub.docker.com/r/francescou/docker-compose-ui/)
The original [francescou/docker-compose-ui repository](https://github.com/francescou/docker-compose-ui) is archived.

Consequently, it is difficult to merge fixes, dependency upgrades, and new features into docker-compose-ui.

Because of this, a fork of docker-compose-ui has been created.

---

![Docker Compose UI](https://raw.githubusercontent.com/nsano-rururu/docker-compose-ui/master/static/images/logo-dark.png)

![GitHub release](https://img.shields.io/github/release/nsano-rururu/docker-compose-ui.svg)
![GitHub stars](https://img.shields.io/github/stars/nsano-rururu/docker-compose-ui.svg?style=social&label=Stars)
[![Docker Stars](https://img.shields.io/docker/stars/rururukenken/docker-compose-ui.svg)](https://hub.docker.com/r/rururukenken/docker-compose-ui/)
[![Docker Pulls](https://img.shields.io/docker/pulls/rururukenken/docker-compose-ui.svg)](https://hub.docker.com/r/rururukenken/docker-compose-ui/)

## What is it

Expand All @@ -11,18 +23,20 @@ The aim of this project is to provide a minimal HTTP API on top of Docker Compos

The application can be deployed as a single container, there are no dependencies nor databases to install.

![compose ui screenshots](https://raw.githubusercontent.com/francescou/docker-compose-ui/master/screenshots/docker-compose-ui.gif)
![compose ui screenshots](https://raw.githubusercontent.com/nsano-rururu/docker-compose-ui/master/screenshots/docker-compose-ui.gif)


## Compose file format compatibility matrix

| Compose file format | Docker Engine |
| ------------- | ------------- |
| 3.8 | 19.03.0+ |
| 3.7 | 18.06.0+ |
| 3.6 | 18.02.0+ |
| 3.3 - 3.5 | 17.06.0+ |
| 3.0 – 3.2| 1.13.0+ |
| 3.0 – 3.2| 1.13.1+ |
| 2.3 | 17.06.0+ |
| 2.2 | 1.13.0+ |
| 2.2 | 1.13.1+ |
| 2.1 | 1.12.0+ |
| 2.0 | 1.10.0+ |
| 1.0 | 1.9.1+ |
Expand All @@ -36,9 +50,9 @@ Run the following command in terminal:
-p 5000:5000 \
-w /opt/docker-compose-projects/ \
-v /var/run/docker.sock:/var/run/docker.sock \
francescou/docker-compose-ui:1.13.0
rururukenken/docker-compose-ui:1.13.6

You have to wait while Docker pulls the container from the Docker Hub: <https://hub.docker.com/r/francescou/docker-compose-ui/>
You have to wait while Docker pulls the container from the Docker Hub: <https://hub.docker.com/r/rururukenken/docker-compose-ui/>

Then open your browser to `http://localhost:5000`

Expand All @@ -55,9 +69,9 @@ to use your own docker-compose projects run this command from the directory cont
-w $(dirname $(pwd)) \
-p 5000:5000 \
-v /var/run/docker.sock:/var/run/docker.sock \
francescou/docker-compose-ui:1.13.0
rururukenken/docker-compose-ui:1.13.6

you can download my example projects into */home/user/docker-compose-ui/demo-projects/* from https://github.com/francescou/docker-compose-ui/tree/master/demo-projects
you can download my example projects into */home/user/docker-compose-ui/demo-projects/* from https://github.com/nsano-rururu/docker-compose-ui/tree/master/demo-projects

### Load projects from a git repository (experimental)

Expand All @@ -66,8 +80,20 @@ you can download my example projects into */home/user/docker-compose-ui/demo-pro
-p 5000:5000 \
-w /opt/docker-compose-projects-git/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-e GIT_REPO=https://github.com/francescou/docker-compose-ui.git \
francescou/docker-compose-ui:1.13.0
-e GIT_REPO=https://github.com/nsano-rururu/docker-compose-ui.git \
rururukenken/docker-compose-ui:1.13.6

### Run from URL prefix

Useful for running multiple applications under the same hostname, ie, Traefik console at `http://hostname.com/traefik/`, DCUI under `http://hostname.com/manage/`, etc.

docker run \
--name docker-compose-ui \
-p 5000:5000 \
-w /opt/docker-compose-projects/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_COMPOSE_UI_PREFIX=manage/docker \
rururukenken/docker-compose-ui:1.13.6

### Note about scaling services

Expand Down Expand Up @@ -100,7 +126,7 @@ Example usage:
-p 5000:5000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e 'WEB_CONSOLE_PATTERN=http://localhost:8888/web-console/?cid={containerName}&cmd={command}' \
francescou/docker-compose-ui:1.13.0
rururukenken/docker-compose-ui:1.13.6


## Remote docker host
Expand All @@ -111,7 +137,7 @@ You can also run containers on a remote docker host, e.g.
--name docker-compose-ui \
-p 5000:5000 \
-e DOCKER_HOST=remote-docker-host:2375 \
francescou/docker-compose-ui:1.13.0
rururukenken/docker-compose-ui:1.13.6


### Docker Swarm or HTTPS Remote docker host
Expand All @@ -131,22 +157,17 @@ For example:
-p 5000:5000 \
-w /opt/docker-compose-projects/ \
-v /home/user/.docker/config.json:/root/.docker/config.json:ro \
francescou/docker-compose-ui:1.13.0
rururukenken/docker-compose-ui:1.13.6

## Technologies

Docker Compose UI has been developed using Flask (python microframework) to provide RESTful services and AngularJS to implement the Single Page Application web ui.

The application uses [Docker Compose](https://docs.docker.com/compose) to monitor and edit the state of a set of docker compose projects (*docker-compose.yml* files).

## Discussions

## API

API docs at <https://francescou.github.io/docker-compose-ui/api.html>

## Issues

If you have any problems with or questions about this image, please open a GitHub issue on https://github.com/francescou/docker-compose-ui
If you have any problems with or questions about this image, please open a GitHub discussions on https://github.com/nsano-rururu/docker-compose-ui/discussions

## License - MIT

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "2"
services:
docker_compose_ui:
restart: always
image: francescou/docker-compose-ui:1.13.0
image: rururukenken/docker-compose-ui:1.13.6
container_name: docker_compose_ui
hostname: docker_compose_ui
working_dir: /opt/docker-compose-projects/
Expand Down
28 changes: 22 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,25 @@
API_V1 = '/api/v1/'
YML_PATH = os.getenv('DOCKER_COMPOSE_UI_YML_PATH') or '.'
COMPOSE_REGISTRY = os.getenv('DOCKER_COMPOSE_REGISTRY')
STATIC_URL_PATH = '/' + (os.getenv('DOCKER_COMPOSE_UI_PREFIX') or '')

logging.basicConfig(level=logging.INFO)
app = Flask(__name__, static_url_path='')
app = Flask(__name__, static_url_path=STATIC_URL_PATH)


def prefix_route(route_function, prefix='', mask='{0}{1}'):
'''
Defines a new route function with a prefix.
The mask argument is a `format string` formatted with, in that order:
prefix, route
Pulled from https://stackoverflow.com/a/37878456 from user 7heo.tk
'''
def newroute(route, *args, **kwargs):
'''New function to prefix the route'''
return route_function(mask.format(prefix, route), *args, **kwargs)
return newroute

app.route = prefix_route(app.route,prefix=STATIC_URL_PATH)

def load_projects():
"""
Expand Down Expand Up @@ -116,7 +132,7 @@ def project_yml(name):
with open(folder_path + '/.env') as env_file:
env = env_file.read()

return jsonify(yml=data_file.read(), env=env, config=config._replace(version=config.version.__str__()))
return jsonify(yml=data_file.read(), env=env, config=config._replace(config_version=config.config_version.__str__(), version=config.version.__str__()))



Expand Down Expand Up @@ -369,8 +385,8 @@ def logs(name, limit):
"""
lines = {}
for k in get_project_with_name(name).containers(stopped=True):
lines[k.name] = k.logs(timestamps=True, tail=limit).split('\n')

lines[k.name] = k.logs(timestamps=True, tail=limit).decode().split('\n')
return jsonify(logs=lines)

@app.route(API_V1 + "logs/<name>/<container_id>", defaults={'limit': "all"}, methods=['GET'])
Expand All @@ -381,7 +397,7 @@ def container_logs(name, container_id, limit):
"""
project = get_project_with_name(name)
container = get_container_from_id(project.client, container_id)
lines = container.logs(timestamps=True, tail=limit).split('\n')
lines = container.logs(timestamps=True, tail=limit).decode().split('\n')
return jsonify(logs=lines)

@app.route(API_V1 + "host", methods=['GET'])
Expand Down Expand Up @@ -489,4 +505,4 @@ def handle_generic_error(err):

# run app
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=False, threaded=True)
app.run(host='0.0.0.0', threaded=True)