Script to set up server
This commit is contained in:
parent
7243d5a8e2
commit
cb572620e9
21
TODO.org
Normal file
21
TODO.org
Normal file
|
@ -0,0 +1,21 @@
|
|||
* TODO some sort of append logic? e.g. don't dump immediately and add as subitems?
|
||||
* ???
|
||||
npm install --save-dev @babel/core @babel/preset-env
|
||||
npm install babel-preset-stage-0
|
||||
npm install babel-preset-env -- wtf is that shit??
|
||||
|
||||
npm run build
|
||||
|
||||
npm run flow
|
||||
|
||||
* DONE [#A] move server to a separate folder, systemd install script
|
||||
CLOSED: [2019-01-05 Sat 14:38]
|
||||
|
||||
* TODO [#A] release somewhere? not sure if necessary
|
||||
|
||||
* TODO [#B] docs on using
|
||||
|
||||
* TODO [#B] circleci?
|
||||
* TODO [#D] nicer manifest?
|
||||
* TODO [#D] do not minfy for dev
|
||||
* TODO [#C] motivation
|
3
server/config.py
Normal file
3
server/config.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from pathlib import Path
|
||||
|
||||
CAPTURE_PATH = Path('/L/Dropbox/mobile/notes/links.org')
|
|
@ -5,4 +5,4 @@ cd "$(dirname "$0")"
|
|||
|
||||
PORT=8090
|
||||
|
||||
hug -p "$PORT" -f server.py >server.log 2>server.err
|
||||
hug -p "$PORT" -f server.py
|
40
server/setup
Executable file
40
server/setup
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python3
|
||||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
|
||||
run_script = Path(__file__).parent.joinpath('run').absolute()
|
||||
|
||||
CONFIG = f"""
|
||||
[Unit]
|
||||
Description=Grasp extension server conterpart
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
[Service]
|
||||
ExecStart={run_script}
|
||||
Type=simple
|
||||
Restart=always
|
||||
"""
|
||||
|
||||
SNAME = 'grasp.service'
|
||||
|
||||
out = Path(f'~/.config/systemd/user/{SNAME}').expanduser()
|
||||
|
||||
print(f"Writing systemd config to {out}:")
|
||||
with out.open('w') as fo:
|
||||
fo.write(CONFIG)
|
||||
|
||||
|
||||
|
||||
def systemd(*args):
|
||||
check_call([
|
||||
'systemctl', '--user', *args,
|
||||
])
|
||||
|
||||
systemd('daemon-reload')
|
||||
systemd('enable', SNAME)
|
||||
systemd('start' , SNAME)
|
||||
systemd('status', SNAME)
|
||||
|
||||
# TODO journalctl --user -u grasp.service to debug
|
Loading…
Reference in a new issue