1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ghost_ynh.git synced 2024-09-03 19:16:02 +02:00

first implem mysql

This commit is contained in:
Julien Malik 2014-03-21 18:15:13 +01:00
parent a8de5b54f2
commit 9d01f8de5f
4 changed files with 39 additions and 7 deletions

View file

@ -3,7 +3,8 @@
* DONE logs * DONE logs
* DONE logrotate config * DONE logrotate config
* DONE is_public * DONE is_public
* TODO auto set up admin section * BLOCKED auto set up admin section
** curl call seems ok but I get a 403 (XSRF ?)
* DONE mail in config.js : what's this ? * DONE mail in config.js : what's this ?
** mails are working ** mails are working
** http://docs.ghost.org/usage/configuration/ ** http://docs.ghost.org/usage/configuration/
@ -35,5 +36,10 @@ admin@yunohost:/home/yunohost.app/ghostblog$ du -sh ghost/*
* DONE change pid file path * DONE change pid file path
** let's stay with /var/run/yunohost/ghostblog for the moment ** let's stay with /var/run/yunohost/ghostblog for the moment
* DONE cleanup pid file * DONE cleanup pid file
* TODO change theme police to avoid google requests * TODO download theme police, install locally to avoid google requests
** download theme police
//fonts.googleapis.com/css?family=Noto+Serif:400,700,400italic|Open+Sans:700,400"
** install locally in themes/casper/assets/fonts ?
** modify assets/css ?
** modify default.hbs
* TODO check password length (>=8) * TODO check password length (>=8)

View file

@ -8,12 +8,22 @@ config = {
production: { production: {
url: 'http://YNH_DOMAINYNH_LOCATION', url: 'http://YNH_DOMAINYNH_LOCATION',
mail: {YNH_MAIL}, mail: {YNH_MAIL},
// database: {
// client: 'sqlite3',
// connection: {
// filename: path.join(__dirname, '/content/data/ghost.db')
// },
// debug: false
// },
database: { database: {
client: 'sqlite3', client: 'mysql',
connection: { connection: {
filename: path.join(__dirname, '/content/data/ghost.db') host : 'localhost',
}, user : 'YNH_DBUSER',
debug: false password : 'YNH_DBPWD',
database : 'YNH_DBNAME',
charset : 'utf8'
}
}, },
server: { server: {
// Host to be passed to node's `net.Server#listen()` // Host to be passed to node's `net.Server#listen()`

View file

@ -37,10 +37,20 @@ find $final_path -type d | grep "tests$" | xargs sudo rm -rf
sudo rm -rf $final_path/ghost/node_modules/sqlite3/build sudo rm -rf $final_path/ghost/node_modules/sqlite3/build
sudo rm -rf $final_path/tmp sudo rm -rf $final_path/tmp
echo "Setting up database..."
db_name=ghostblog
db_user=ghostblog
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
sudo yunohost app initdb $db_user -d $db_name -p $db_pwd
sudo yunohost app setting ghostblog mysqlpwd -v $db_pwd
echo "Deploying configuration..." echo "Deploying configuration..."
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.js sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.js
sed -i "s@YNH_LOCATION@$path@g" ../conf/config.js sed -i "s@YNH_LOCATION@$path@g" ../conf/config.js
sed -i "s@YNH_MAIL@@g" ../conf/config.js sed -i "s@YNH_MAIL@@g" ../conf/config.js
sed -i "s@YNH_DBNAME@$db_name@g" ../conf/config.js
sed -i "s@YNH_DBUSER@$db_user@g" ../conf/config.js
sed -i "s@YNH_DBPWD@$db_pwd@g" ../conf/config.js
sudo cp ../conf/config.js $final_path/ghost sudo cp ../conf/config.js $final_path/ghost
sudo chown ghostblog: $final_path/ghost/config.js sudo chown ghostblog: $final_path/ghost/config.js
sudo chmod 644 $final_path/ghost/config.js sudo chmod 644 $final_path/ghost/config.js

View file

@ -11,5 +11,11 @@ sudo rm -f /var/log/ghostblog.log
sudo rm -rf /var/run/yunohost/ghostblog sudo rm -rf /var/run/yunohost/ghostblog
sudo rm -f /etc/logrotate.d/ynh-ghostblog sudo rm -f /etc/logrotate.d/ynh-ghostblog
db_user=ghostblog
db_name=ghostblog
root_pwd=$(sudo cat /etc/yunohost/mysql)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
# remove user so that it does not hold resource # remove user so that it does not hold resource
sudo userdel --remove ghostblog sudo userdel --remove ghostblog