mirror of
https://github.com/YunoHost-Apps/ghost_ynh.git
synced 2024-09-03 19:16:02 +02:00
first version
This commit is contained in:
commit
189b0333ad
7 changed files with 195 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*~
|
28
conf/config.js
Normal file
28
conf/config.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
// # Ghost Configuration
|
||||
// Setup your Ghost install for various environments
|
||||
|
||||
var path = require('path'),
|
||||
config;
|
||||
|
||||
config = {
|
||||
production: {
|
||||
url: 'https://YNH_DOMAINYNH_LOCATION',
|
||||
mail: {YNH_MAIL},
|
||||
database: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: path.join(__dirname, '/content/data/ghost.db')
|
||||
},
|
||||
debug: false
|
||||
},
|
||||
server: {
|
||||
// Host to be passed to node's `net.Server#listen()`
|
||||
host: '127.0.0.1',
|
||||
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
|
||||
port: '2368'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Export config
|
||||
module.exports = config;
|
13
conf/nginx.conf
Normal file
13
conf/nginx.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
location YNH_LOCATION {
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
proxy_pass http://127.0.0.1:2368;
|
||||
proxy_redirect off;
|
||||
}
|
49
manifest.json
Normal file
49
manifest.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "Ghost",
|
||||
"id": "ghostblog",
|
||||
"description": {
|
||||
"en": "Just a blogging platform"
|
||||
},
|
||||
"developer": {
|
||||
"name": "Julien Malik",
|
||||
"email": "julien.malik@paraiso.me",
|
||||
"url": "https://ghost.org/"
|
||||
},
|
||||
"multi_instance": "false",
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for Ghost"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for Ghost"
|
||||
},
|
||||
"example": "/blog",
|
||||
"default": "/blog"
|
||||
},
|
||||
{
|
||||
"name": "public_site",
|
||||
"ask": {
|
||||
"en": "Is it a public Ghost site ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"ask": {
|
||||
"en": "Choose the Ghost administrator (must be an existing YunoHost user)"
|
||||
},
|
||||
"example": "homer"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
93
scripts/install
Normal file
93
scripts/install
Normal file
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
is_public=$3
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a ghostblog
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Install dependencies"
|
||||
sudo apt-get install nodejs-legacy npm -y
|
||||
|
||||
echo "Download sources..."
|
||||
version=0.4.1
|
||||
echo "Downloading Ghost $version..."
|
||||
mkdir ../tmp
|
||||
sudo wget -O ../tmp/ghost-$version.zip "https://en.ghost.org/zip/ghost-$version.zip"
|
||||
unzip ../tmp/ghost-$version.zip -d ../tmp/ghost
|
||||
|
||||
echo "Deploying source files..."
|
||||
final_path=/home/yunohost.app/ghostblog
|
||||
sudo mkdir -p $final_path
|
||||
sudo useradd -d $final_path ghostblog
|
||||
|
||||
sudo cp -r ../tmp/ghost $final_path
|
||||
sudo chown -R ghostblog: $final_path
|
||||
|
||||
echo "Install Ghost with NPM..."
|
||||
sudo su --shell /bin/bash --command "cd $final_path/ghost && npm install --production" ghostblog
|
||||
|
||||
echo "Install forever with NPM..."
|
||||
sudo su --shell /bin/bash --command "cd $final_path && npm --prefix=$final_path install -g forever" ghostblog
|
||||
|
||||
echo "Deploying configuration"
|
||||
sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.js
|
||||
sed -i "s@YNH_LOCATION@$path@g" ../conf/config.js
|
||||
sed -i "s@YNH_MAIL@@g" ../conf/config.js
|
||||
sudo cp ../conf/config.js $final_path/ghost
|
||||
|
||||
echo "Nginx configuration..."
|
||||
sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ghostblog.conf
|
||||
|
||||
echo "Reloading Nginx..."
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
|
||||
# sudo mkdir -p $final_path
|
||||
# sudo cp -a ../sources/* $final_path
|
||||
# sudo cp ../conf/settings.json $final_path
|
||||
# sudo cp ../conf/etherpad-lite /etc/init.d/
|
||||
# sudo chmod +x /etc/init.d/etherpad-lite
|
||||
# sudo update-rc.d etherpad-lite defaults
|
||||
# sudo mkdir /var/log/etherpad-lite/
|
||||
# sudo touch /var/log/etherpad-lite/etherpad-lite.log
|
||||
# sudo chown www-data /var/log/etherpad-lite/etherpad-lite.log
|
||||
#
|
||||
#
|
||||
# sudo $final_path/bin/installDeps.sh > /dev/null 2>&1
|
||||
# sudo npm install forever -g > /dev/null 2>&1
|
||||
#
|
||||
# # Change variables in Wordpress configuration
|
||||
# sudo sed -i "s/yunouser/$db_user/g" $final_path/settings.json
|
||||
# sudo sed -i "s/yunopass/$db_pwd/g" $final_path/settings.json
|
||||
# sudo sed -i "s/yunobase/$db_user/g" $final_path/settings.json
|
||||
# sudo sed -i "s/KEY/$key/g" $final_path/settings.json
|
||||
#
|
||||
# # Set permissions to roundcube directory
|
||||
# sudo chown -R www-data: $final_path
|
||||
#
|
||||
# # Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
# sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
||||
# sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||
# if [ $path != "/" ];
|
||||
# then
|
||||
# sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ghostblog.conf
|
||||
# else
|
||||
# sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/ghostblog.conf
|
||||
# fi
|
||||
#
|
||||
# # Reload Nginx and regenerate SSOwat conf
|
||||
# sudo service nginx reload
|
||||
# if [ $is_public = "Yes" ];
|
||||
# then
|
||||
# sudo yunohost app setting ghostblog skipped_uris -v "/"
|
||||
# fi
|
||||
# sudo yunohost app ssowatconf
|
||||
# sudo service etherpad-lite start
|
7
scripts/remove
Normal file
7
scripts/remove
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
domain=$(sudo yunohost app setting ghost domain)
|
||||
|
||||
sudo userdel --remove ghostblog
|
||||
|
||||
# final_path=/opt/yunohost/ghostblog
|
4
scripts/upgrade
Normal file
4
scripts/upgrade
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "TODO"
|
||||
exit 1
|
Loading…
Add table
Reference in a new issue