build stuff

This commit is contained in:
ntr 2019-07-16 14:05:54 +10:00
parent 35a9e4171a
commit 95ffc0d2e9
9 changed files with 23 additions and 67 deletions

View File

@ -1,12 +1,17 @@
SHELL:=/bin/bash
.PHONY: all deps build deploy install server client clean
all: install
deps:
./bin/deps.sh
package:
./bin/package.sh
build:
./bin/build.sh
deploy:
./bin/deploy.sh
install:
./bin/install.sh

View File

@ -27,6 +27,8 @@
# WORK WORK
## NOW
*OPS*
*$$$*
* rename costs 1cr
* invader set

View File

@ -9,14 +9,6 @@ VERSION=$(<"$MNML_PATH/VERSION")
echo "Building client version $VERSION"
cd $MNML_PATH/client
rm -f "/var/lib/mnml/$VERSION"
rm -rf dist
npm i
npm run build
echo "copying build to /var/lib/mnml/$VERSION"
cp -r dist "/var/lib/mnml/client/$VERSION"
echo "linking current version"
ln -nfs "/var/lib/mnml/client/$VERSION" /var/lib/mnml/public/current
sudo service nginx restart

View File

@ -11,46 +11,35 @@ if [ ! -f $MNML_CONF ]; then
echo "creating an env file in $MNML_CONF"
echo "-----------------------------------------------"
sudo useradd mnml -U --password $(openssl rand -hex 16)
CURRENT_USER=$(whoami)
sudo usermod -aG mnml $CURRENT_USER
sudo mkdir -p /etc/mnml/
echo "export MNML_USER=mnml" | sudo tee -a $MNML_CONF
echo "export MNML_USER=$(whoami)" | sudo tee -a $MNML_CONF
echo "export MNML_PG_PASSWORD=\"$(openssl rand -hex 16)\"" | sudo tee -a $MNML_CONF
echo "export MNML_PG_HOST=\"localhost\"" | sudo tee -a $MNML_CONF
sudo chown -R mnml:mnml /etc/mnml/
fi
source $MNML_CONF
# DIRECTORY SETUP
sudo chown -R $MNML_USER:$MNML_USER /etc/mnml/
# /var/lib/mnml
# contains img data, client builds
# contains img data, builds
sudo mkdir -p /var/lib/mnml
sudo mkdir -p /var/lib/mnml/src
sudo mkdir -p /var/lib/mnml/public/imgs
sudo mkdir -p /var/lib/mnml/client
sudo mkdir -p /var/lib/mnml/data
sudo chmod -R g+w /var/lib/mnml
sudo chmod -R g+s /var/lib/mnml
sudo setfacl -d -m group:mnml:rwx /var/lib/mnml
sudo chown -R $MNML_USER:$MNML_USER /var/lib/mnml
# /var/log/mnml
sudo mkdir -p /var/log/mnml
sudo chmod g+w /var/log/mnml
sudo chmod g+s /var/log/mnml
sudo setfacl -d -m group:mnml:rwx /var/log/mnml
sudo chown -R $MNML_USER:$MNML_USER /var/log/mnml
# /usr/local/mnml
sudo mkdir -p /usr/local/mnml/bin
sudo setfacl -d -m group:mnml:rwx /usr/local/mnml
sudo chmod -R g+w /usr/local/mnml
sudo chmod -R g+s /usr/local/mnml
sudo mkdir -p /usr/local/mnml/build/client
sudo mkdir -p /usr/local/mnml/build/server
sudo chown -R $MNML_USER:$MNML_USER /usr/local/mnml
# SERVICES

View File

@ -1,27 +0,0 @@
# bless you chris and andy <3
# DOES NOT WORK AT MOMENT
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
MNML_PATH=$(realpath "$DIR/../")
VERSION=$(<"$MNML_PATH/VERSION")
# copy this dir to the tmp build directory and build it
[[ -n "$BUILD_DIR" ]] || BUILD_DIR="/tmp/mnml/$VERSION"
[[ -n "$BUILD_PREFIX" ]] || BUILD_PREFIX="/opt/mnml"
[[ -n "$REPO_DIR" ]] || REPO_DIR="$HOME/mnml"
rm -rf "$BUILD_DIR" && mkdir -p "$BUILD_DIR/$BUILD_PREFIX" && cd "$BUILD_DIR/$BUILD_PREFIX"
(
rsync -a --delete --delete-excluded \
--exclude=".git/" \
--exclude=".gitignore" \
--exclude="packaging" \
"$REPO_DIR/" "$BUILD_DIR/$BUILD_PREFIX/"
rsync -a --delete --delete-excluded "$DIR/postinstall" "$BUILD_DIR/$BUILD_PREFIX/"
cd "$BUILD_DIR/$BUILD_PREFIX" &&
make
)

View File

@ -3,11 +3,8 @@
# bless you chris and andy <3
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
MNML_PATH=$(realpath "$DIR/../")
VERSION=$(<"$MNML_PATH/VERSION")
cd $MNML_PATH/server
echo "building /usr/local/mnml/bin/$VERSION"
echo "building server $VERSION"
cargo build --release
cp -r target/release/mnml /usr/local/mnml/bin/$VERSION
echo "linking current version"
ln -nfs "/usr/local/mnml/bin/$VERSION" /usr/local/mnml/bin/mnml

View File

@ -146,7 +146,7 @@ button, input {
color: whitesmoke;
height: auto;
border-width: 2px;
border-color: #444;
border-color: #222;
border-radius: 0;
letter-spacing: 0.25em;
box-sizing: border-box;
@ -299,13 +299,13 @@ button[disabled] {
}
#mnml input, #mnml select {
border-color: #444;
background-color: #333;
border-color: #222;
background-color: #222;
border-radius: 0;
}
#mnml input:focus, #mnml select:focus {
border-color: whitesmoke;
border-color: #888;
}
/*

View File

@ -1,4 +1,4 @@
error_log /var/log/mnml/nginx.log debug;
error_log /var/log/mnml/nginx.log;
upstream mnml_http {
server 127.0.0.1:40000;

View File

@ -37,6 +37,4 @@ crossbeam-channel = "0.3"
stripe-rust = { version = "0.10.4", features = ["webhooks"] }
[patch.crates-io]
# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }
stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }
# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" }