add debian building. add asset compile and embedding. other fixes.

This commit is contained in:
xuu
2017-04-24 09:20:46 -06:00
parent 8e6da6cd30
commit db6d5afb09
33 changed files with 610 additions and 2244 deletions

2
debian/BUILD/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.git*

39
debian/Makefile vendored Normal file
View File

@@ -0,0 +1,39 @@
NAME=sour.is-paste
VERSION=$(shell cat VERSION)
RELEASE=$(shell cat RELEASE)
REPO_IP="172.22.141.171"
REPO_PATH="/opt/web/pub/sour.is/debian/"
all: release build copy
clean:
rm -r BUILD/*
release:
export RELEASE=`cat RELEASE`; \
echo `expr $${RELEASE} + 1` > RELEASE
build:
export VERSION=`cat VERSION`; \
export RELEASE=`cat RELEASE`; \
export DATE=`date -u +%FT%TZ`; \
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \
rm -rf ./$${BUILD}; \
cp -r ROOT "$${BUILD}"; \
export SED="s_Version:.*_Version: $${VERSION}-$${RELEASE}_"; \
sed -i "$$SED" "$${BUILD}/DEBIAN/control"; \
go build -o $${BUILD}/opt/sour.is/bin/paste \
-ldflags "-X main.APP_VERSION=$${VERSION}-$${RELEASE} -X main.APP_BUILD=$${DATE}"\
sour.is/x/paste; \
dpkg -b $${BUILD}; \
copy:
export VERSION=`cat VERSION`; \
export RELEASE=`cat RELEASE`; \
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \
scp "$${BUILD}.deb" $(REPO_IP):$(REPO_PATH); \
ssh $(REPO_IP) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$${VERSION}-$${RELEASE}.deb";
deploy:
ansible kapha -s -m apt -a "name=sour.is-paste update_cache=yes state=latest"

1
debian/RELEASE vendored Normal file
View File

@@ -0,0 +1 @@
8

8
debian/ROOT/DEBIAN/control vendored Normal file
View File

@@ -0,0 +1,8 @@
Package: sour.is-paste
Version: 2.0.0-1
Section: base
Priority: optional
Architecture: amd64
Maintainer: xuu <me@sour.is>
Description: Encrypted Paste Store
API and UI for storing encrypted pastes.

17
debian/ROOT/DEBIAN/postinst vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
case "$1" in
configure)
systemctl daemon-reload
if systemctl is-enabled sour.is-paste.service; then
systemctl start sour.is-paste.service
fi
sudo chown -R root:root /opt/sour.is
sudo chown -R root:root /etc/opt/sour.is
;;
esac
exit 0

20
debian/ROOT/DEBIAN/postrm vendored Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
case "$1" in
remove)
if systemctl is-active sour.is-paste.service; then
systemctl stop sour.is-paste.service
fi
;;
purge)
if systemctl is-enabled sour.is-paste.service; then
systemctl disable sour.is-paste.service
fi
;;
esac
exit 0

20
debian/ROOT/DEBIAN/preinst vendored Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
case "$1" in
install)
# do some magic
;;
upgrade|abort-upgrade)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
#DEBHELPER#
exit 0

14
debian/ROOT/DEBIAN/prerm vendored Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
set -e
case "$1" in
remove|upgrade)
if systemctl is-active sour.is-paste.service; then
systemctl stop sour.is-paste.service
fi
;;
esac
exit 0

View File

@@ -0,0 +1,4 @@
[http]
listen = ":9010"

View File

@@ -0,0 +1,16 @@
[Unit]
Description=sour.is paste API
After=syslog.target network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/sour.is/
ExecStart=/opt/sour.is/bin/paste serve
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

1
debian/VERSION vendored Normal file
View File

@@ -0,0 +1 @@
2.0.0