Last active
March 8, 2023 14:24
-
-
Save alexander-arce/83e18b209759050ca02a to your computer and use it in GitHub Desktop.
Etherpad Lite Install + Postgresql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo adduser --system --home=/opt/etherpad --group etherpad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su - etherpad -s /bin/bash | |
mkdir -p ~/local/etherpad | |
cd ~/local/etherpad | |
git clone git://github.com/ether/etherpad-lite.git | |
cd etherpad-lite | |
bin/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo npm install pg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#check with logrotate -d /etc/logrotate.d/etherpad-lite | |
/var/log/etherpad-lite/*.log | |
{ | |
rotate 4 | |
weekly | |
missingok | |
notifempty | |
compress | |
delaycompress | |
sharedscripts | |
postrotate | |
restart etherpad-lite >/dev/null 2>&1 || true | |
endscript | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Comment lines | |
/* | |
"dbSettings" : { | |
"filename" : "var/dirty.db" | |
}, | |
*/ | |
#Add postgresql configuration | |
"dbSettings" : { | |
"user" : "etherpad", | |
"host" : "127.0.0.1", | |
"password": "**********", | |
"database": "etherpad" | |
}, | |
#Add user for API and admin | |
"users": { | |
"admin": { | |
"password": "**********", | |
"is_admin": true | |
}, | |
"api-user": { | |
"password": "***********", | |
"is_admin": false | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create postgresql user and database | |
sudo su postgres | |
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt etherpad | |
psql -U postgres | |
Password for user postgres:******* | |
psql (9.4.4) | |
Type "help" for help. | |
postgres=# create database etherpad; | |
postgres=# alter database etherpad owner to etherpad; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Put over server section | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
#put inside server section | |
location /pad { | |
rewrite /pad/(.*) /$1 break; | |
rewrite ^/pad$ /pad/ permanent; | |
proxy_pass http://localhost:9001/; | |
proxy_pass_header Server; | |
proxy_redirect / /pad/; | |
proxy_set_header Host $host; | |
proxy_buffering off; | |
} | |
location /pad/socket.io { | |
rewrite /pad/socket.io/(.*) /socket.io/$1 break; | |
proxy_pass http://localhost:9001/; | |
proxy_redirect / /pad/; | |
proxy_set_header Host $host; | |
proxy_buffering off; | |
proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpProxyModule | |
proxy_set_header Host $host; # pass the host header $ | |
proxy_http_version 1.1; # recommended with keepalive connections $ | |
# WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
} | |
location /static { | |
rewrite /static/(.*) /static/$1 break; | |
proxy_pass http://localhost:9001/; | |
proxy_set_header Host $host; | |
proxy_buffering off; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create file /etc/init/etherpad.conf | |
#with the next content | |
description "etherpad-lite" | |
start on started networking | |
stop on runlevel [!2345] | |
env EPHOME=/opt/etherpad/local/etherpad/etherpad-lite | |
env EPLOGS=/var/log/etherpad-lite | |
env EPUSER=etherpad | |
env EPLITE_BIN="bin/run.sh" | |
respawn | |
pre-start script | |
cd $EPHOME | |
mkdir $EPLOGS ||true | |
chown $EPUSER:admin $EPLOGS ||true | |
chmod 0755 $EPLOGS ||true | |
chown -R $EPUSER:admin $EPHOME/var ||true | |
end script | |
script | |
cd $EPHOME/ | |
exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node node_modules/ep_etherpad-lite/node/server.js \ | |
>> $EPLOGS/access.log \ | |
2>> $EPLOGS/error.log | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment