[Refactoring]
This commit is contained in:
3
contrib/TEstShouldNotBeCompiled.cs
Normal file
3
contrib/TEstShouldNotBeCompiled.cs
Normal file
@ -0,0 +1,3 @@
|
||||
namespace Yavsc.contrib
|
||||
{
|
||||
omg, daB4C0|)3DA!!!
|
1
contrib/build
Normal file
1
contrib/build
Normal file
@ -0,0 +1 @@
|
||||
dnu build --configuration Debug ./project.json
|
0
contrib/drop_obsolete_datta.sql
Normal file
0
contrib/drop_obsolete_datta.sql
Normal file
8
contrib/genApiController.sh
Executable file
8
contrib/genApiController.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
dnx gen controller -async -outDir ApiControllers -api -dc ApplicationDbContext -m "$1" -name "$2ApiController"
|
||||
|
||||
# dnx gen controller -outDir Controllers -dc ApplicationDbContext -udl -m {model} -name {name}Controller
|
||||
|
||||
|
||||
# dnx gen controller -outDir Controllers -dc ApplicationDbContext -udl -m Yavsc.Models.Booking.MusicianSettings -name InstrumentationController -async -scripts
|
8
contrib/genController.sh
Executable file
8
contrib/genController.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
dnx gen controller -async -udl -outDir Controllers -dc ApplicationDbContext -m "$1" -name "$2Controller"
|
||||
|
||||
# dnx gen controller -outDir Controllers -dc ApplicationDbContext -udl -m {model} -name {name}Controller
|
||||
|
||||
|
||||
# dnx gen controller -outDir Controllers -dc ApplicationDbContext -udl -m Yavsc.Models.Booking.MusicianSettings -name InstrumentationController -async -scripts
|
7
contrib/import_old_data.sql
Normal file
7
contrib/import_old_data.sql
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
|
||||
insert into "Blog" ("AuthorId",bcontent,modified,photo,posted,rate,title,visible)
|
||||
select 'dcfd1730-7dc8-4db8-8db4-20da0a6b07fe',bcontent,modified,photo,posted,rate,title,visible
|
||||
from "BlogOld"
|
||||
|
6
contrib/install_earth.sql
Normal file
6
contrib/install_earth.sql
Normal file
@ -0,0 +1,6 @@
|
||||
SELECT version();
|
||||
CREATE EXTENSION "cube"; -- you will not be able install "earthdistance" w/o "cube" extension
|
||||
CREATE EXTENSION "earthdistance"; --or any other extension you need
|
||||
create extension earthdistance;
|
||||
select earth();
|
||||
select earth_distance(ll_to_earth(12.4,2.0),ll_to_earth(12.456,2.8043)); -- 87km
|
42
contrib/isolate_old_data.sql
Normal file
42
contrib/isolate_old_data.sql
Normal file
@ -0,0 +1,42 @@
|
||||
ALTER TABLE estimate
|
||||
DROP CONSTRAINT estimate_username_fkey;
|
||||
ALTER TABLE estimate
|
||||
DROP CONSTRAINT estimate_client_fkey;
|
||||
ALTER TABLE estimate RENAME TO old_estimate;
|
||||
|
||||
ALTER TABLE blog DROP CONSTRAINT bloguser;
|
||||
ALTER TABLE blog RENAME TO old_blog;
|
||||
|
||||
|
||||
ALTER TABLE activity RENAME TO old_activity;
|
||||
ALTER TABLE tag RENAME TO old_tag;
|
||||
ALTER TABLE tagged RENAME TO old_tagged;
|
||||
ALTER TABLE writtings RENAME TO old_writtings;
|
||||
|
||||
drop table blfiles;
|
||||
drop table blog_access;
|
||||
drop table circle;
|
||||
drop table circle_members;
|
||||
drop table commandes;
|
||||
drop table comment;
|
||||
drop table histoestim;
|
||||
drop table histowritting;
|
||||
drop table hr;
|
||||
drop table comment;
|
||||
drop table product;
|
||||
drop table profiledata;
|
||||
drop table satisfaction;
|
||||
drop table stocksymbols;
|
||||
drop table taskdeps;
|
||||
drop table tasks;
|
||||
drop table userskills;
|
||||
drop table wrfiles ;
|
||||
drop table wrtags ;
|
||||
drop table passwrecovery;
|
||||
drop table projet;
|
||||
drop table skill;
|
||||
drop table usersroles;
|
||||
drop table roles;
|
||||
drop table users;
|
||||
drop table profiles;
|
||||
drop TABLE postheader;
|
133
contrib/kestrel
Executable file
133
contrib/kestrel
Executable file
@ -0,0 +1,133 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kestrel
|
||||
# Required-Start: $local_fs $network $named $time $syslog $postgresql
|
||||
# Required-Stop: $local_fs $network $named $time $syslog $postgresql
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Script to run asp.net 5 application in background
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ivan Derevianko aka druss <drussilla7@gmail.com>
|
||||
# Modified by: Paul Schneider <redienhcs.luap@gmail.com>
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
CONFIGS="/etc/kestrel/*.webenv"
|
||||
DNX_USER_HOME=/srv/www/dnx
|
||||
DNXRUNTIMEVERSION=$(cat /srv/www/dnx/alias/default.alias)
|
||||
|
||||
# fix issue with DNX exception in case of two env vars with the same name but different case
|
||||
TMP_SAVE_runlevel_VAR=$runlevel
|
||||
unset runlevel
|
||||
|
||||
running() {
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
DNXPID=$(cat $PIDFILE)
|
||||
if kill -0 $DNXPID 2>/dev/null
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
setdnxenv() {
|
||||
env=$1
|
||||
. $env
|
||||
# reset all except the name to default values
|
||||
export ASPNET_ENV=$NAME
|
||||
WWW_USER=www-data
|
||||
DNXRUNTIME=${DNX_USER_HOME}/runtimes/${DNXRUNTIMEVERSION}/bin/Microsoft.Dnx.Host.Mono.dll
|
||||
PROJECT=approot/Web
|
||||
CONFIGURATION=Release
|
||||
ROOT=/srv/www/yavsc
|
||||
DESC="$NAME"
|
||||
PIDFILE=/var/run/kestrel-${NAME}.pid
|
||||
export MONO_OPTIONS="--server"
|
||||
LOGDIR=/var/log
|
||||
# reset to specified values
|
||||
. $env
|
||||
}
|
||||
|
||||
status() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running;
|
||||
then
|
||||
echo "Service running $DESC ($NAME; pid: $DNXPID)"
|
||||
else
|
||||
echo "Service stopped $DESC ($NAME)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running; then
|
||||
echo "Service already running $DESC" "$NAME"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "Starting service $NAME"
|
||||
if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -x /usr/bin/mono $DNXRUNTIME -- --project $PROJECT --configuration $CONFIGURATION $NAME >${LOGDIR}/kestrel-${NAME}.log
|
||||
then
|
||||
log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 2
|
||||
else
|
||||
log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running
|
||||
then
|
||||
log_daemon_msg "Stopping service $NAME"
|
||||
start-stop-daemon -K -p "$PIDFILE"
|
||||
log_daemon_msg "$DESC stopped"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "$DESC Service not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
export runlevel=$TMP_SAVE_runlevel_VAR
|
||||
|
||||
|
12
contrib/kestrel-pkg/etc/kestrel/webenv.template
Normal file
12
contrib/kestrel-pkg/etc/kestrel/webenv.template
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Dnx command for this web app
|
||||
NAME=[myWebAppName]
|
||||
|
||||
# root path to the server assets
|
||||
ROOT=[/srv/www/[myRootDir]]
|
||||
|
||||
# relative path to the project source tree,
|
||||
# from the above root path
|
||||
PROJECT=[approot/src/[projectName]]
|
||||
|
133
contrib/kestrel-pre
Normal file
133
contrib/kestrel-pre
Normal file
@ -0,0 +1,133 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kestrel-pre
|
||||
# Required-Start: $local_fs $network $named $time $syslog $postgresql
|
||||
# Required-Stop: $local_fs $network $named $time $syslog $postgresql
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Script to run asp.net 5 application in background
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ivan Derevianko aka druss <drussilla7@gmail.com>
|
||||
# Modified by: Paul Schneider <redienhcs.luap@gmail.com>
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
CONFIGS="/etc/kestrel/*.prewebenv"
|
||||
DNX_USER_HOME=/srv/www/dnx
|
||||
DNXRUNTIMEVERSION=$(cat /srv/www/dnx/alias/default.alias)
|
||||
|
||||
# fix issue with DNX exception in case of two env vars with the same name but different case
|
||||
TMP_SAVE_runlevel_VAR=$runlevel
|
||||
unset runlevel
|
||||
|
||||
running() {
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
DNXPID=$(cat $PIDFILE)
|
||||
if kill -0 $DNXPID 2>/dev/null
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
setdnxenv() {
|
||||
env=$1
|
||||
. $env
|
||||
# reset all except the name to default values
|
||||
export ASPNET_ENV=$NAME
|
||||
WWW_USER=www-data
|
||||
DNXRUNTIME=${DNX_USER_HOME}/runtimes/${DNXRUNTIMEVERSION}/bin/Microsoft.Dnx.Host.Mono.dll
|
||||
PROJECT=approot/Web
|
||||
CONFIGURATION=Release
|
||||
ROOT=/srv/www/yavscpre
|
||||
DESC="$NAME"
|
||||
PIDFILE=/var/run/kestrel-${NAME}.pid
|
||||
export MONO_OPTIONS="--server"
|
||||
LOGDIR=/var/log
|
||||
# reset to specified values
|
||||
. $env
|
||||
}
|
||||
|
||||
status() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running;
|
||||
then
|
||||
echo "Service running $DESC ($NAME; pid: $DNXPID)"
|
||||
else
|
||||
echo "Service stopped $DESC ($NAME)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running; then
|
||||
echo "Service already running $DESC" "$NAME"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "Starting service $NAME"
|
||||
if ! start-stop-daemon -SbmCv -u $WWW_USER -p $PIDFILE -d $ROOT -x /usr/bin/mono $DNXRUNTIME -- --project $PROJECT --configuration $CONFIGURATION $NAME >${LOGDIR}/kestrel-${NAME}.log
|
||||
then
|
||||
log_daemon_msg "Could not start $NAME : $?, see ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 2
|
||||
else
|
||||
log_daemon_msg "Service $DESC started ($NAME), logs: ${LOGDIR}/kestrel-${NAME}.log"
|
||||
log_end_msg 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
for env in $CONFIGS
|
||||
do
|
||||
setdnxenv "$env"
|
||||
if running
|
||||
then
|
||||
log_daemon_msg "Stopping service $NAME"
|
||||
start-stop-daemon -K -p "$PIDFILE"
|
||||
log_daemon_msg "$DESC stopped"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_daemon_msg "$DESC Service not running"
|
||||
log_end_msg 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
export runlevel=$TMP_SAVE_runlevel_VAR
|
||||
|
||||
|
23
contrib/rsync-to-pre.sh
Executable file
23
contrib/rsync-to-pre.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
export FSPATH=/srv/www/yavscpre
|
||||
|
||||
ssh root@localhost rm -rf $FSPATH/approot
|
||||
|
||||
(
|
||||
set -e
|
||||
ssh root@localhost systemctl stop kestrel-pre
|
||||
cd bin/output/
|
||||
echo "sync to $FSPATH"
|
||||
rsync -ravu wwwroot approot root@localhost:$FSPATH
|
||||
sleep 1
|
||||
ssh root@localhost sync
|
||||
sleep 1
|
||||
ssh root@localhost systemctl start kestrel-pre
|
||||
)
|
||||
|
||||
echo "Now, go and try <https://yavscpre.pschneider.fr>"
|
||||
echo "Then, feel free to launch contrib/rsync-to-prod.sh"
|
||||
|
||||
|
||||
|
18
contrib/rsync-to-prod.sh
Executable file
18
contrib/rsync-to-prod.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
export FSPATH=/srv/www/yavsc
|
||||
|
||||
(
|
||||
set -e
|
||||
ssh root@localhost systemctl stop kestrel
|
||||
ssh root@localhost rm -rf $FSPATH/approot
|
||||
cd bin/output/
|
||||
sleep 1
|
||||
echo "Sync: > $FSPATH"
|
||||
rsync -ravu wwwroot approot root@localhost:$FSPATH
|
||||
sleep 1
|
||||
ssh root@localhost sync
|
||||
sleep 1
|
||||
ssh root@localhost systemctl start kestrel
|
||||
)
|
||||
|
Reference in New Issue
Block a user