-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
random fixes and maybe improvements #147
Changes from all commits
de70e70
2870a7f
837818b
6057665
aae9f4b
b46b05b
19faecf
5eedc20
e32e040
b1a88e0
f90c85a
4875c45
63e2867
b577e14
2f87583
42a4ee3
6015a53
724bd44
9927022
b8ca0a8
fbe47d7
d058987
34b6abd
58d9ccf
9f51a00
0d11497
e1002e0
56ced94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
docker/user_data | ||
.mypy_cache | ||
**/__pycache__ | ||
venv | ||
.git | ||
**/.idea | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,3 +112,5 @@ tmp/ | |
extension/dist | ||
|
||
geckodriver.log | ||
|
||
.idea |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
user_data/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
FROM python:3 | ||
|
||
RUN mkdir /data \ | ||
RUN mkdir /user_data \ | ||
mkdir /usr/src/promnisia | ||
|
||
WORKDIR /usr/src/promnesia | ||
COPY src/ . | ||
COPY setup.py /usr/src/ | ||
|
||
#RUN python /usr/src/setup.py #LookupError: setuptools-scm was unable to detect version for '/usr/src/promnesia'. | ||
|
||
RUN pip install --no-cache-dir more_itertools pytz sqlalchemy cachew \ | ||
appdirs urlextract python-magic \ | ||
tzlocal hug \ | ||
logzero HPI beautifulsoup4 lxml mistletoe orgparse dataset | ||
|
||
ENV PPATH=/usr/src/promnesia:${PPATH} | ||
VOLUME /data | ||
VOLUME /user_data | ||
|
||
EXPOSE 13131 | ||
CMD ["python", "-m", "promnesia", "serve", "--db", "/data/promnesia.sqlite", "--port", "13131"] | ||
CMD ["python", "-m", "promnesia", "serve", "--db", "/user_data/promnesia.sqlite", "--port", "13131"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM promnesia:latest | ||
|
||
RUN apt-get update && apt-get install -y cron | ||
COPY docker/indexer-entrypoint.sh / | ||
COPY docker/docker_files/indexer-entrypoint.sh / | ||
ENTRYPOINT ["/indexer-entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: '3.3' | ||
|
||
services: | ||
server: | ||
image: promnesia | ||
build: | ||
context: ../../ | ||
dockerfile: docker/docker_files/Dockerfile | ||
# Uncomment to enable persisent volumes | ||
volumes: | ||
- ../user_data:/user_data | ||
ports: | ||
- "13131:13131" | ||
restart: always | ||
indexer: | ||
depends_on: | ||
- server | ||
image: promnesia-indexer | ||
build: | ||
context: ../../ | ||
dockerfile: docker/docker_files/Dockerfile-indexer | ||
# Uncomment to enable persisent volumes | ||
volumes: | ||
- ../user_data:/user_data | ||
environment: | ||
# run once every ten minutes | ||
CRONTAB: "0-59/1 * * * * cd /usr/src/promnesia && /usr/local/bin/python -m promnesia index --config /user_data/indexer-config.py" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from promnesia import Source | ||
from promnesia.sources import auto | ||
|
||
# todo: we should probably have separate docker volumes for sources and for config/db | ||
|
||
SOURCES = [ | ||
Source( | ||
auto.index, | ||
'/user_data/source1/', | ||
), | ||
# Source( | ||
# auto.index, | ||
# '/source2/', | ||
# ) | ||
] | ||
|
||
OUTPUT_DIR = '/user_data/' | ||
|
||
# this is not supported yet. also, it should probably be named something else than MIME_HANDLER. | ||
#import os | ||
#MIME_HANDLER = 'editor://' + os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + '../') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# note: https://lostindetails.com/articles/How-to-run-cron-inside-Docker | ||
# note: CRONTAB is set in docker-compose.yaml. | ||
|
||
echo "${CRONTAB} > /proc/1/fd/1 2>/proc/1/fd/2" | crontab - | ||
cron -f |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")" | ||
|
||
cd user_data/ | ||
mkdir source1 | ||
cd source1 | ||
echo "i like https://github.com/karlicoss/promnesia." >> my_notes.txt | ||
git clone https://github.com/karlicoss/exobrain | ||
git clone https://github.com/koo5/notes | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")" | ||
mkdir user_data | ||
cp docker_files/indexer-config.py.example user_data/indexer-config.py | ||
./get-some-data.sh | ||
|
||
# the config file will be periodically reloaded by the indexer process, and data sources will be periodically re-indexed. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")" | ||
docker-compose -f docker_files/docker-compose.yaml build && docker-compose -f docker_files/docker-compose.yaml up | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,16 @@ export class Binder { | |
link.title = 'Jump to the context'; | ||
// $FlowFixMe | ||
link.href = loc.href; | ||
|
||
// _self seems to "work" only for the "editor://" protocol. Avoids opening a new tab for "editor://" links. Nttp links then require a middle-click, which is undesirable. With normal click, they would not open at all. | ||
// testing on firefox mobile would be useful. | ||
// note that on some pages, like https://news.ycombinator.com/, this (clicking on a _self editor:// link) results in: Content Security Policy: The page’s settings blocked the loading of a resource at editor:///home/koom/promnesia/docker//user_data/source1/notes/g1:12 (“frame-src”). | ||
// but middle-click still works. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right... annoying. I guess this is another usecase where some dynamic JS hooks would be useful (so the users can experiment/work around for themselves). |
||
// on others (https://www.reddit.com/), it just works. | ||
// so, if we should do this at all is a question. | ||
//if (link.href.startsWith('editor://')) | ||
// link.target= '_self'; | ||
|
||
tchild(link, loc.title); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ const commandsExtra = { | |
// TODO ugh it's getting messy... | ||
const action = { | ||
"default_icon": "images/ic_not_visited_48.png", | ||
"default_title": "Was not visited", | ||
"default_title": "Show promnesia sidebar", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe "Not visited (click to show the sidebar)"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good compromise lol! But i wasn't trying to sneak in the "click to show sidebar", rather, i was trying to get rid of the "not visited", which i find misleading:
Then again, this was just a bit of bikeshedding to warm me up to the codebase. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see!
But I guess either way I'm pretty indifferent to the title, because it's only useful the first few times you use the extension, then you just remember which icon is which. |
||
}; | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure about moving this file.. some tests depend on it (and also linked in readme).
But on the other hand it's nice to have some default docker config too.. maybe just create a separate one (could also have less general comments, just essential stuff for running this specific docker setup)?