1
0
mirror of https://git.cloudron.io/cloudron/freshrss-app synced 2025-09-21 12:27:36 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Dennis Schwerdel
a5022969c3 Bumped version, fixed db-prefix 2017-02-23 18:07:50 +01:00
Dennis Schwerdel
1175cc0d8f Removed update menu item 2017-02-23 15:54:34 +01:00
Dennis Schwerdel
a3014a0fdb Using cli scripts & allowing config changes 2017-02-23 15:25:53 +01:00
dswd
b48681e37c Merge branch 'master' into 'master'
Use scheduler addon to update feeds

Closes #6

See merge request !1
2017-02-23 13:02:42 +00:00
Girish Ramakrishnan
2750b4944d Use scheduler addon to update feeds
Fixes #6
2017-02-22 15:24:47 -08:00
7 changed files with 78 additions and 62 deletions

View File

@@ -4,3 +4,9 @@
[0.2.0]
* Updated to base image 0.10.0
* Supporting extensions
[0.3.0]
* No longer overwriting all config changes
* Using cli scripts
* Using scheduler for periodic task
* Removed update menu item

View File

@@ -5,12 +5,18 @@
"description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG",
"tagline": "RSS feed reader",
"version": "0.2.0",
"version": "0.3.0",
"healthCheckPath": "/",
"httpPort": 8000,
"addons": {
"localstorage": {},
"mysql": {}
"mysql": {},
"scheduler": {
"update_feeds": {
"schedule": "*/1 * * * *",
"command": "/usr/local/bin/gosu www-data:www-data php /app/code/app/actualize_script.php"
}
}
},
"manifestVersion": 1,
"website": "http://www.freshrss.org",

View File

@@ -24,7 +24,7 @@ ADD change-ttrss-file-path.patch /app/code/change-ttrss-file-path.patch
RUN wget https://github.com/FreshRSS/Extensions/archive/${EXTENSIONS_VERSION}.tar.gz -O - \
| tar -xz --strip-components=1 -C /app/code/extensions \
&& patch -p1 -d /app/code/extensions < /app/code/change-ttrss-file-path.patch \
&& patch -p0 -d /app/code < /app/code/change-ttrss-file-path.patch \
&& mv /app/code/extensions /app/code/extensions-orig \
&& ln -s /app/data/extensions /app/code/extensions \
&& ln -s /app/data/extensions/ttrss.php /app/code/p/api/ttrss.php
@@ -42,7 +42,10 @@ RUN rm /etc/apache2/sites-enabled/* \
RUN rm -rf /var/lib/php \
&& ln -s /run/php /var/lib/php
ADD remove-update-menu.patch /app/code/remove-update-menu.patch
RUN patch -p0 -d /app/code < /app/code/remove-update-menu.patch
ADD start.sh /app/code/start.sh
ADD setup_db.php /app/code/setup_db.php
ADD set_config.php /app/code/set_config.php
CMD [ "/app/code/start.sh" ]

24
remove-update-menu.patch Normal file
View File

@@ -0,0 +1,24 @@
diff -Naru app-orig/layout/aside_configure.phtml app/layout/aside_configure.phtml
--- app-orig/layout/aside_configure.phtml 2016-12-26 15:33:47.000000000 +0000
+++ app/layout/aside_configure.phtml 2017-02-23 14:48:10.214072522 +0000
@@ -41,9 +41,5 @@
Minz_Request::actionName() === 'checkInstall' ? ' active' : ''; ?>">
<a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a>
</li>
- <li class="item<?php echo Minz_Request::controllerName() === 'update' &&
- Minz_Request::actionName() === 'index' ? ' active' : ''; ?>">
- <a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a>
- </li>
<?php } ?>
</ul>
diff -Naru app-orig/layout/header.phtml app/layout/header.phtml
--- app-orig/layout/header.phtml 2016-12-26 15:33:47.000000000 +0000
+++ app/layout/header.phtml 2017-02-23 14:48:31.430114487 +0000
@@ -71,7 +71,6 @@
<li class="item"><a href="<?php echo _url('user', 'manage'); ?>"><?php echo _t('gen.menu.user_management'); ?></a></li>
<li class="item"><a href="<?php echo _url('auth', 'index'); ?>"><?php echo _t('gen.menu.authentication'); ?></a></li>
<li class="item"><a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a></li>
- <li class="item"><a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a></li>
<?php } ?>
<li class="separator"></li>
<li class="item"><a href="<?php echo _url('stats', 'index'); ?>"><?php echo _t('gen.menu.stats'); ?></a></li>

22
set_config.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
$config = include("/app/data/config.php");
$config["default_user"] = "admin";
$config["base_url"] = "https://".getenv('APP_DOMAIN')."/p";
$config["db"] = array (
"type" => "mysql",
"host" => getenv('MYSQL_HOST'),
"user" => getenv('MYSQL_USERNAME'),
"password" => getenv('MYSQL_PASSWORD'),
"base" => getenv('MYSQL_DATABASE'),
"prefix" => "",
"pdo_options" =>
array (
)
);
$config_str = var_export($config, TRUE);
file_put_contents("/app/data/config.php", "<?php return $config_str;");
?>

View File

@@ -1,14 +0,0 @@
<?PHP
include_once('/app/code/app/SQL/install.sql.mysql.php');
$c = new PDO("mysql:dbname=".getenv('MYSQL_DATABASE').";host=".getenv('MYSQL_HOST').";port=".getenv('MYSQL_PORT'), getenv('MYSQL_USERNAME'), getenv('MYSQL_PASSWORD'));
$sql = sprintf(SQL_CREATE_TABLES, 'admin_', 'Uncategorized');
$stm = $c->prepare($sql);
$stm->execute();
$sql = sprintf(SQL_INSERT_FEEDS, 'admin_');
$stm = $c->prepare($sql);
$stm->execute();

View File

@@ -7,20 +7,14 @@ mkdir -p /run/php/sessions
if ! [ -f /app/data/.installed ]; then
echo "Fresh installation, setting up..."
rsync -a /app/code/data-orig/ /app/data/
dd if=/dev/urandom bs=1 count=1024 2>/dev/null | sha1sum | awk '{ print $1 }' > /app/data/.salt
mkdir -p /app/data/users/admin
cat > /app/data/users/admin/config.php <<EOF
<?php
return array (
'language' => 'en',
'passwordHash' => '\$2a\$09\$lO5xTAsfRCG1rSssJgHtTeiweXj2VwGN/JfuexIMpsQWzKoFVoklm',
'apiPasswordHash' => '',
);
?>
EOF
touch /app/data/users/admin/log.txt
rm /app/data/do-install.txt
php /app/code/setup_db.php
php cli/do-install.php \
--environment production --default_user admin \
--db-type mysql --db-host "${MYSQL_HOST}:${MYSQL_PORT}" \
--db-user "${MYSQL_USERNAME}" --db-password "${MYSQL_PASSWORD}" \
--db-base "${MYSQL_DATABASE}" --db-prefix ""
php set_config.php # --db-prefix "" seems to be ignored
php cli/create-user.php --user admin --password password --language en
php cli/actualize-user.php --user admin
touch /app/data/.installed
echo "Done."
fi
@@ -32,39 +26,14 @@ for f in $(ls /app/code/extensions-orig); do
fi
done
echo "Creating config file"
SALT=$(cat /app/data/.salt)
cat > /app/data/config.php <<EOF
<?php
return array (
'salt' => '${SALT}',
'base_url' => 'https://${APP_DOMAIN}/p',
'title' => 'FreshRSS',
'default_user' => 'admin',
'auth_type' => 'form',
'db' =>
array (
'type' => 'mysql',
'host' => '${MYSQL_HOST}',
'user' => '${MYSQL_USERNAME}',
'password' => '${MYSQL_PASSWORD}',
'base' => '${MYSQL_DATABASE}',
'prefix' => '',
'pdo_options' =>
array (
),
),
'pubsubhubbub_enabled' => true,
);
EOF
echo "Creating config file"
php set_config.php
echo "Setting permissions"
chown -R www-data.www-data /run/php /app/data
echo "Trying to update feeds every 60 secs"
while true; do
sleep 60
sudo -u www-data php /app/code/app/actualize_script.php >/dev/stdout 2>/dev/stderr
done &
echo "Starting apache"
APACHE_CONFDIR="" source /etc/apache2/envvars