Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0359e12555 | ||
|
|
83e17cec7c | ||
|
|
05e4c00b7f | ||
|
|
69eb59b93b | ||
|
|
4883c53419 | ||
|
|
a0bafc453f | ||
|
|
b515760e6d | ||
|
|
ea4e0c0ec3 | ||
|
|
3f04905d22 | ||
|
|
0ab6391bf3 | ||
|
|
a66dfa8530 | ||
|
|
09cf83c31b | ||
|
|
aac8e9786d |
@@ -36,7 +36,7 @@ $currentSystem->apache->user = "var-www";
|
|||||||
$currentSystem->apache->group = "var-www";
|
$currentSystem->apache->group = "var-www";
|
||||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||||
|
|
||||||
$currentSystem->remoteLocationPath = getenv('ASD_PUBLIC_URL')."/";
|
$currentSystem->remoteLocationPath = getenv('DDNINJA_PUBLIC_URL')."/";
|
||||||
|
|
||||||
// Deprecato in quanto CBS2 è stato dismesso
|
// Deprecato in quanto CBS2 è stato dismesso
|
||||||
$backupSystem = new stdClass();
|
$backupSystem = new stdClass();
|
||||||
@@ -134,7 +134,7 @@ $config->database = $database;
|
|||||||
|
|
||||||
$config->mailer = new stdClass();
|
$config->mailer = new stdClass();
|
||||||
$config->mailer->address = "email-smtp.eu-west-1.amazonaws.com";
|
$config->mailer->address = "email-smtp.eu-west-1.amazonaws.com";
|
||||||
$config->mailer->port = "25";
|
$config->mailer->port = "587";
|
||||||
$config->mailer->username = "AKIASMB7IW2MQPUP5CXS";
|
$config->mailer->username = "AKIASMB7IW2MQPUP5CXS";
|
||||||
$config->mailer->password = "BHv+82Nns1kIKg99Hx0sjKlEpR+X4+1EgX+ec64n/mBt";
|
$config->mailer->password = "BHv+82Nns1kIKg99Hx0sjKlEpR+X4+1EgX+ec64n/mBt";
|
||||||
$config->mailer->smtpAuth = true;
|
$config->mailer->smtpAuth = true;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class BannerHelper {
|
|||||||
|
|
||||||
|
|
||||||
private static function getBannerImpressions($bannerIds) {
|
private static function getBannerImpressions($bannerIds) {
|
||||||
$time = strtotime("today CET");
|
$time = strtotime("today");
|
||||||
$stats = GlobalVariables::get("dao")->query(
|
$stats = GlobalVariables::get("dao")->query(
|
||||||
BannerStatsModel::class,
|
BannerStatsModel::class,
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class PipelineHelper {
|
|||||||
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
||||||
'content.position'=>$position,
|
'content.position'=>$position,
|
||||||
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
|
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
|
||||||
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today CET") * 1000) )
|
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today") * 1000) )
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -49,10 +49,8 @@ class MailModel extends Model implements FDN_MailInterface{
|
|||||||
$email->isMail();
|
$email->isMail();
|
||||||
|
|
||||||
$email->From = $this->from;
|
$email->From = $this->from;
|
||||||
if ($this->hasProperty("fromName")){
|
$email->FromName = "I Fatti di Napoli";
|
||||||
$email->FromName = $this->fromName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$email->Subject = $this->subject;
|
$email->Subject = $this->subject;
|
||||||
|
|
||||||
$email->IsHTML(true);
|
$email->IsHTML(true);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ArticleStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFilter($articleId, $day, $month, $year) {
|
public static function getFilter($articleId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'notizia' => $articleId,
|
'notizia' => $articleId,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class BannerStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function new($bannerId, $day, $month, $year) {
|
public static function new($bannerId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return new static(
|
return new static(
|
||||||
(object)[
|
(object)[
|
||||||
'banner' => $bannerId,
|
'banner' => $bannerId,
|
||||||
@@ -30,7 +30,7 @@ class BannerStatsModel extends Model {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
public static function getFilter($bannerId, $day, $month, $year) {
|
public static function getFilter($bannerId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'banner' => $bannerId,
|
'banner' => $bannerId,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PageViewStatsModel extends Model {
|
|||||||
return "pageview_stats";
|
return "pageview_stats";
|
||||||
}
|
}
|
||||||
public static function new($page, $day, $month, $year) {
|
public static function new($page, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
|
|
||||||
return new static(
|
return new static(
|
||||||
(object)[
|
(object)[
|
||||||
@@ -33,7 +33,7 @@ class PageViewStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFilter($page, $day, $month, $year) {
|
public static function getFilter($page, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ class GUIHandler {
|
|||||||
|
|
||||||
$stats = GlobalVariables::get("dao")->aggregate(
|
$stats = GlobalVariables::get("dao")->aggregate(
|
||||||
ArticleStatsModel::class,
|
ArticleStatsModel::class,
|
||||||
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days CET"),5)
|
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5)
|
||||||
);
|
);
|
||||||
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
|
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Author: Riccardo Di Dato
|
|||||||
Creation Date: 04/feb/2013
|
Creation Date: 04/feb/2013
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
date_default_timezone_set("Europe/Rome");
|
||||||
|
|
||||||
require_once(dirname(__FILE__)."/common/config.php");
|
require_once(dirname(__FILE__)."/common/config.php");
|
||||||
|
|
||||||
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
|
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ try{
|
|||||||
<div class="bannerStat">
|
<div class="bannerStat">
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Oggi</div>
|
<div class="statName">Oggi</div>
|
||||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today CET"));?></div>
|
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today"));?></div>
|
||||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today CET"));?></div>
|
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Ultima settimana</div>
|
<div class="statName">Ultima settimana</div>
|
||||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days CET"));?></div>
|
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days"));?></div>
|
||||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days CET"));?></div>
|
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Totali</div>
|
<div class="statName">Totali</div>
|
||||||
|
|||||||
@@ -144,11 +144,11 @@ try{
|
|||||||
<div class="notiziaStat">
|
<div class="notiziaStat">
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Oggi</div>
|
<div class="statName">Oggi</div>
|
||||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today CET"));?></div>
|
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Ultima settimana</div>
|
<div class="statName">Ultima settimana</div>
|
||||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days CET"));?></div>
|
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Totali</div>
|
<div class="statName">Totali</div>
|
||||||
|
|||||||
+23
-1
@@ -41,7 +41,29 @@ function bannerGroup(group, grpName) {
|
|||||||
(target) => {
|
(target) => {
|
||||||
if (rval.length > 0) {
|
if (rval.length > 0) {
|
||||||
const ele = rval.shift();
|
const ele = rval.shift();
|
||||||
$('#'+target).html(ele.media);
|
let mediaHtml = ele.media;
|
||||||
|
if (ele.link) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = ele.link;
|
||||||
|
a.target = "_blank";
|
||||||
|
a.innerHTML = ele.media;
|
||||||
|
mediaHtml = a;
|
||||||
|
}
|
||||||
|
mediaHtml.addEventListener(
|
||||||
|
'click',
|
||||||
|
() => {
|
||||||
|
$.ajax({
|
||||||
|
url: "stats/bannerClick.php",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
banner: ele.id,
|
||||||
|
source: document.URL
|
||||||
|
},
|
||||||
|
dataType: "html"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$('#'+target).html(mediaHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ try {
|
|||||||
|
|
||||||
if (!is_null($ip) && !is_null($banners) && !is_null($source)){
|
if (!is_null($ip) && !is_null($banners) && !is_null($source)){
|
||||||
$banners = explode(",", $banners);
|
$banners = explode(",", $banners);
|
||||||
$ts = strtotime('today CET');
|
$ts = strtotime('today');
|
||||||
|
|
||||||
foreach ($banners as $banner) {
|
foreach ($banners as $banner) {
|
||||||
AnalyticsHelper::bannerImpression(
|
AnalyticsHelper::bannerImpression(
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
FROM alpine:3.6
|
||||||
|
|
||||||
|
RUN apk add --no-cache --upgrade bash mongodb-tools
|
||||||
|
|
||||||
|
# copy crontabs for root user
|
||||||
|
COPY crontab /etc/crontabs/root
|
||||||
|
|
||||||
|
# copy backup script
|
||||||
|
COPY backup /myscripts/backup
|
||||||
|
RUN chmod 0744 /myscripts/backup
|
||||||
|
|
||||||
|
# start crond with log level 8 in foreground, output to stderr
|
||||||
|
CMD ["crond", "-f", "-d", "8"]
|
||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DATE=`date +"%Y-%m-%d_%H:%M"`
|
||||||
|
|
||||||
|
echo "Generating backup $DATE"
|
||||||
|
|
||||||
|
DATABASE_HOST="fdn2.production.database"
|
||||||
|
DATABASE_NAME="fdn2"
|
||||||
|
DATABASE_PORT="27017"
|
||||||
|
WORKDIR="/workdir"
|
||||||
|
STORAGE="/backups"
|
||||||
|
|
||||||
|
mkdir -p $WORKDIR
|
||||||
|
|
||||||
|
mongodump --host $DATABASE_HOST -d $DATABASE_NAME --port $DATABASE_PORT --out "$WORKDIR"
|
||||||
|
|
||||||
|
tar -cvzf "$STORAGE/dump-$DATE.tar.gz" "$WORKDIR"
|
||||||
|
|
||||||
|
for old in `ls -t $STORAGE | tail -n +7`; do
|
||||||
|
TOREMOVE="$STORAGE/$old"
|
||||||
|
echo "Removing '$TOREMOVE'";
|
||||||
|
rm -r $TOREMOVE
|
||||||
|
done
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
4 0 * * * /myscripts/backup 2>&1
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
backup:
|
||||||
|
image: cronjob
|
||||||
|
build: ./
|
||||||
|
networks:
|
||||||
|
- backup-network
|
||||||
|
restart: "unless-stopped"
|
||||||
|
volumes:
|
||||||
|
- /home/ddninja/fdn2/backups:/backups
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
backup-network:
|
||||||
|
external: true
|
||||||
|
name:
|
||||||
|
backup-network
|
||||||
@@ -5,8 +5,11 @@ services:
|
|||||||
restart: "on-failure:5"
|
restart: "on-failure:5"
|
||||||
networks:
|
networks:
|
||||||
db-network:
|
db-network:
|
||||||
|
backup-network:
|
||||||
|
aliases:
|
||||||
|
- §PROJECT_BUILDNAME§.§ENVIRONMENT_TYPE§.database
|
||||||
volumes:
|
volumes:
|
||||||
- ./persistence/database/mongodb:/usr/local/mongodb
|
- ./persistence/database/mongodb:/data/db/
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file"
|
||||||
options:
|
options:
|
||||||
@@ -63,7 +66,7 @@ services:
|
|||||||
max-size: "150m"
|
max-size: "150m"
|
||||||
memcached:
|
memcached:
|
||||||
image: memcached:1.6.9-alpine
|
image: memcached:1.6.9-alpine
|
||||||
restart: "on-failure:3"
|
restart: "on-failure:5"
|
||||||
networks:
|
networks:
|
||||||
§PROJECT_BUILDNAME§-network:
|
§PROJECT_BUILDNAME§-network:
|
||||||
logging:
|
logging:
|
||||||
@@ -75,6 +78,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
db-network:
|
db-network:
|
||||||
§PROJECT_BUILDNAME§-network:
|
§PROJECT_BUILDNAME§-network:
|
||||||
|
backup-network:
|
||||||
|
external: true
|
||||||
|
name:
|
||||||
|
backup-network
|
||||||
nginx-network:
|
nginx-network:
|
||||||
external: true
|
external: true
|
||||||
name:
|
name:
|
||||||
@@ -83,5 +90,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
§PROJECT_BUILDNAME§-ws-log:
|
§PROJECT_BUILDNAME§-ws-log:
|
||||||
|
§PROJECT_BUILDNAME§-wk-log:
|
||||||
§PROJECT_BUILDNAME§-db-persist:
|
§PROJECT_BUILDNAME§-db-persist:
|
||||||
§PROJECT_BUILDNAME§-job-comms:
|
§PROJECT_BUILDNAME§-job-comms:
|
||||||
|
|
||||||
@@ -5,10 +5,11 @@ services:
|
|||||||
restart: "no"
|
restart: "no"
|
||||||
networks:
|
networks:
|
||||||
db-network:
|
db-network:
|
||||||
|
backup-network:
|
||||||
aliases:
|
aliases:
|
||||||
- §PROJECT_BUILDNAME§.§ENVIRONMENT_TYPE§.database
|
- §PROJECT_BUILDNAME§.local.database
|
||||||
volumes:
|
volumes:
|
||||||
- §PROJECT_BUILDNAME§-db-persist:/usr/local/mongodb
|
- §PROJECT_BUILDNAME§-db-persist:/data/db/
|
||||||
webserver:
|
webserver:
|
||||||
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-webserver-debug
|
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-webserver-debug
|
||||||
env_file:
|
env_file:
|
||||||
@@ -53,11 +54,14 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
db-network:
|
db-network:
|
||||||
§PROJECT_BUILDNAME§-network:
|
§PROJECT_BUILDNAME§-network:
|
||||||
|
backup-network:
|
||||||
|
external: true
|
||||||
|
name:
|
||||||
|
backup-network
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
§PROJECT_BUILDNAME§-storage:
|
§PROJECT_BUILDNAME§-storage:
|
||||||
§PROJECT_BUILDNAME§-log:
|
§PROJECT_BUILDNAME§-log:
|
||||||
# edenlandia-worker-log:
|
|
||||||
§PROJECT_BUILDNAME§-db-persist:
|
§PROJECT_BUILDNAME§-db-persist:
|
||||||
§PROJECT_BUILDNAME§-job-comms:
|
§PROJECT_BUILDNAME§-job-comms:
|
||||||
@@ -4,4 +4,4 @@ DDNINJA_IS_PRODUCTION=true
|
|||||||
DDNINJA_MONGO_DBNAME=fdn2
|
DDNINJA_MONGO_DBNAME=fdn2
|
||||||
DDNINJA_MONGO_LOCATION=database
|
DDNINJA_MONGO_LOCATION=database
|
||||||
|
|
||||||
DDNINJA_PUBLIC_URL=http://preproduction.ifattidinapoli.it
|
DDNINJA_PUBLIC_URL=http://www.ifattidinapoli.it
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ DDNINJA_IS_PRODUCTION=true
|
|||||||
DDNINJA_MONGO_DBNAME=fdn2
|
DDNINJA_MONGO_DBNAME=fdn2
|
||||||
DDNINJA_MONGO_LOCATION=database
|
DDNINJA_MONGO_LOCATION=database
|
||||||
|
|
||||||
DDNINJA_PUBLIC_URL=http://preproduction.ifattidinapoli.it
|
DDNINJA_PUBLIC_URL=http://www.ifattidinapoli.it
|
||||||
|
|||||||
+1
-1
@@ -157,7 +157,7 @@ if [[ $PUBLISH_MODE -eq 1 ]]; then
|
|||||||
|
|
||||||
# WORKER
|
# WORKER
|
||||||
msg "running ./build.sh -I worker -$BUILDOPT -t $TAG-worker"
|
msg "running ./build.sh -I worker -$BUILDOPT -t $TAG-worker"
|
||||||
./build.sh -I webserver -$BUILDOPT -t "$TAG-worker"
|
./build.sh -I worker -$BUILDOPT -t "$TAG-worker"
|
||||||
|
|
||||||
./run-unit.sh $VERBOPT -t "$TAG-worker"
|
./run-unit.sh $VERBOPT -t "$TAG-worker"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user