Docker compose (#417)
* feat(docker): add healthcheck to container Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com> * feat(docker): add docker-compose files Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
ef2dd1949a
commit
4e13df9738
@ -2,6 +2,8 @@ FROM python:alpine
|
|||||||
|
|
||||||
MAINTAINER Ameya Shenoy "shenoy.ameya@gmail.com"
|
MAINTAINER Ameya Shenoy "shenoy.ameya@gmail.com"
|
||||||
|
|
||||||
|
ENV BUKUSERVER_PORT=5001
|
||||||
|
|
||||||
COPY . /Buku
|
COPY . /Buku
|
||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
@ -17,6 +19,9 @@ RUN set -ex \
|
|||||||
&& apk del .build-deps \
|
&& apk del .build-deps \
|
||||||
&& rm -rf /Buku
|
&& rm -rf /Buku
|
||||||
|
|
||||||
ENTRYPOINT gunicorn --bind 0.0.0.0:5001 "bukuserver.server:create_app()"
|
HEALTHCHECK --interval=1m --timeout=10s \
|
||||||
EXPOSE 5001
|
CMD nc -z localhost ${BUKUSERVER_PORT} || exit 1
|
||||||
|
|
||||||
|
ENTRYPOINT gunicorn --bind 0.0.0.0:${BUKUSERVER_PORT} "bukuserver.server:create_app()"
|
||||||
|
EXPOSE ${BUKUSERVER_PORT}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
- [From PyPi](#from-pypi)
|
- [From PyPi](#from-pypi)
|
||||||
- [From source](#from-source)
|
- [From source](#from-source)
|
||||||
- [Using Docker](#using-docker)
|
- [Using Docker](#using-docker)
|
||||||
|
- [Using Docker Compose](#using-docker-compose)
|
||||||
- [Webserver options](#webserver-options)
|
- [Webserver options](#webserver-options)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Screenshots](#screenshots)
|
- [Screenshots](#screenshots)
|
||||||
@ -57,6 +58,36 @@ database.
|
|||||||
|
|
||||||
Visit `127.0.0.1:5001` in your browser to access your bookmarks.
|
Visit `127.0.0.1:5001` in your browser to access your bookmarks.
|
||||||
|
|
||||||
|
#### Using Docker Compose
|
||||||
|
|
||||||
|
There is a `docker-compose.yml` file present in the `docker-compose` directory
|
||||||
|
in the root of this project. You may modify the configurations in this file to
|
||||||
|
your liking, and then simply execute the below command.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
You will have you bukuserver running on port port 80 of the host.
|
||||||
|
|
||||||
|
To stop simply run
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
In case you want to add basic auth to your hosted instance you may do so by
|
||||||
|
creating a `.htpasswd` file in the `data/basic_auth` directory. Add a user to
|
||||||
|
the file using
|
||||||
|
|
||||||
|
```sh
|
||||||
|
htpasswd -c data/basic_auth/.htpasswd your_username
|
||||||
|
```
|
||||||
|
|
||||||
|
And then comment out the basic auth lines from the `data/nginx/nginx.conf` file.
|
||||||
|
|
||||||
|
For more information please refer the [nginx docs](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/).
|
||||||
|
|
||||||
### Webserver options
|
### Webserver options
|
||||||
|
|
||||||
To run the server on host 127.0.0.1, port 5001, run following command:
|
To run the server on host 127.0.0.1, port 5001, run following command:
|
||||||
|
22
docker-compose/data/nginx/nginx.conf
Normal file
22
docker-compose/data/nginx/nginx.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name yoursitename.com;
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/certbot;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
#auth_basic "Administrator's Area";
|
||||||
|
#auth_basic_user_file /basic_auth/.htpasswd;
|
||||||
|
proxy_pass http://bukuserver:5001;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Remote-Port $remote_port;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
26
docker-compose/docker-compose.yml
Normal file
26
docker-compose/docker-compose.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
bukuserver:
|
||||||
|
image: bukuserver/bukuserver
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- BUKUSERVER_PER_PAGE=100
|
||||||
|
- BUKUSERVER_OPEN_IN_NEW_TAB=true
|
||||||
|
# - BUKUSERVER_SECRET_KEY=123456789012345678901234
|
||||||
|
# - BUKUSERVER_URL_RENDER_MODE=full
|
||||||
|
# - BUKUSERVER_DISABLE_FAVICON=false
|
||||||
|
ports:
|
||||||
|
- "5001:5001"
|
||||||
|
volumes:
|
||||||
|
- ./data:/root/.local/share/buku
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- ./data/nginx:/etc/nginx/conf.d
|
||||||
|
- ./data/basic_auth:/basic_auth
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user