Clean up install/exec
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3bcb8db974
commit
e7578e859a
67
.drone.yml
67
.drone.yml
|
@ -23,6 +23,39 @@ steps:
|
||||||
from_secret: pypi_user
|
from_secret: pypi_user
|
||||||
password:
|
password:
|
||||||
from_secret: pypi_pwd
|
from_secret: pypi_pwd
|
||||||
|
commands:
|
||||||
|
- /bin/drone-pypi
|
||||||
|
- cp dist/morss-*.tar.gz dist/morss.tar.gz
|
||||||
|
|
||||||
|
- name: push
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: ssh_host
|
||||||
|
username:
|
||||||
|
from_secret: ssh_user
|
||||||
|
key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
source:
|
||||||
|
- dist/morss.tar.gz
|
||||||
|
- morss-helper
|
||||||
|
target: /home/ubuntu
|
||||||
|
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: ssh_host
|
||||||
|
username:
|
||||||
|
from_secret: ssh_user
|
||||||
|
key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
script_stop: true
|
||||||
|
script:
|
||||||
|
- sudo pip install --upgrade dist/morss.tar.gz[full]
|
||||||
|
- sudo mv morss-helper /usr/local/bin/morss-helper
|
||||||
|
- sudo rm -r dist
|
||||||
|
- sudo morss-helper reload
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
|
@ -60,37 +93,3 @@ trigger:
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- test
|
- test
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: ssh
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: deploy
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: ssh_host
|
|
||||||
username:
|
|
||||||
from_secret: ssh_user
|
|
||||||
key:
|
|
||||||
from_secret: ssh_key
|
|
||||||
script_stop: true
|
|
||||||
script:
|
|
||||||
- sudo pip install --upgrade morss[full]
|
|
||||||
- "pid=$$(sudo pidof 'gunicorn: master [morss]')"
|
|
||||||
- sudo kill -s USR2 $$pid
|
|
||||||
- sudo kill -s WINCH $$pid
|
|
||||||
- sudo kill -s TERM $$pid
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- python
|
|
||||||
|
|
|
@ -10,5 +10,7 @@ RUN set -ex; \
|
||||||
|
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "/app/docker-entry.sh"]
|
ENTRYPOINT ["/bin/sh", "/app/morss-helper"]
|
||||||
CMD ["run"]
|
CMD ["run"]
|
||||||
|
|
||||||
|
HEALTHCHECK CMD python -m morss.crawler http://localhost:${PORT:-8000}/ > /dev/null 2>&1
|
||||||
|
|
|
@ -163,12 +163,12 @@ write_files:
|
||||||
content: |
|
content: |
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
CACHE=diskcache
|
CACHE=diskcache
|
||||||
CACHE_SIZE=1073741824
|
CACHE_SIZE=1073741824 # 1GiB
|
||||||
- path: /var/lib/cloud/scripts/per-boot/morss.sh
|
- path: /var/lib/cloud/scripts/per-boot/morss.sh
|
||||||
permissions: 744
|
permissions: 744
|
||||||
content: |
|
content: |
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - --daemon morss
|
/usr/local/bin/morss-helper
|
||||||
|
|
||||||
runcmd:
|
runcmd:
|
||||||
- source /etc/environment
|
- source /etc/environment
|
||||||
|
@ -176,6 +176,8 @@ runcmd:
|
||||||
- iptables -I INPUT 6 -m state --state NEW -p tcp --dport ${PORT:-8000} -j ACCEPT
|
- iptables -I INPUT 6 -m state --state NEW -p tcp --dport ${PORT:-8000} -j ACCEPT
|
||||||
- netfilter-persistent save
|
- netfilter-persistent save
|
||||||
- pip install morss[full]
|
- pip install morss[full]
|
||||||
|
- python -m morss.crawler https://git.pictuga.com/pictuga/morss/raw/branch/master/morss-helper > /usr/local/bin/morss-helper
|
||||||
|
- chmod +x /usr/local/bin/morss-helper
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
|
@ -6,6 +6,12 @@ if [ "$1" = "sh" ] || [ "$1" = "bash" ]; then
|
||||||
elif [ -z "$1" ] || [ "$@" = "run" ]; then
|
elif [ -z "$1" ] || [ "$@" = "run" ]; then
|
||||||
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
|
gunicorn --bind 0.0.0.0:${PORT:-8000} --preload --access-logfile - morss
|
||||||
|
|
||||||
|
elif [ "$@" = "reload" ]; then
|
||||||
|
pid=$(sudo pidof 'gunicorn: master [morss]')
|
||||||
|
kill -s USR2 $pid
|
||||||
|
kill -s WINCH $pid
|
||||||
|
kill -s TERM $pid
|
||||||
|
|
||||||
else
|
else
|
||||||
morss $@
|
morss $@
|
||||||
|
|
Loading…
Reference in New Issue