This Server: Difference between revisions
Jump to navigation
Jump to search
| (35 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
[[category:r2a2]] | |||
== Installed Components == | |||
Click this link to get a SSL report of this server: https://www.ssllabs.com/ssltest/analyze.html?d=playfulexploration.com . | |||
<uml> | <uml> | ||
cloud WEB { | cloud WEB { | ||
| Line 4: | Line 8: | ||
package playfulexploration.com { | package playfulexploration.com { | ||
component [Eth0] | |||
component [Nginx\nport: 443] as [Nginx] | component [Nginx\nport: 443] as [Nginx] | ||
component [PHP-CGI\nport: 9000] as [PHP-CGI] | component [PHP-CGI\nport: 9000] as [PHP-CGI] | ||
| Line 10: | Line 14: | ||
component [Tomcat Server\nport: 8888] as [Tomcat] | component [Tomcat Server\nport: 8888] as [Tomcat] | ||
component [NodeJS\nport: 8080] as [NodeJS] | component [NodeJS\nport: 8080] as [NodeJS] | ||
component [Grafana\nport:3000] as [Grafana] <<Charts>> [[/wiki/?title=Install/Grafana]] | |||
package "Email" { | |||
component [Postfix\nports: 25, 587, 993] as [Postfix] <<mail transfer agent>> | |||
component [Dovecot] as [Dovecot] <<mail server>> | |||
component [Postgray] as [Postgray] <<anti spam>> | |||
database Mailbox | |||
} | |||
package "IOT" { | |||
component [Mosquitto\nport: 1883 mqtt\nport: 8883 mqtt secure\nport: 9001 wss] as [Mosquitto] <<MQTT Broker>> [[/wiki/?title=Install/Mosquitto_Mqtt_Broker]] | |||
component [InfluxDB\nport:] as [InfluxDB] <<Time Series DB>> [[/wiki/?title=Install/InfluxDB]] | |||
} | |||
package "MediaWiki Pack" { | package "MediaWiki Pack" { | ||
| Line 15: | Line 31: | ||
[MediaWiki PHP] .. [MediaWiki PlantUML Extension] | [MediaWiki PHP] .. [MediaWiki PlantUML Extension] | ||
} | } | ||
[Eth0] .. [Nginx] : https | |||
[Nginx] .. [PHP-CGI] | [Nginx] .. [PHP-CGI] | ||
[Nginx] .. [Tomcat] | [Nginx] .. [Tomcat] | ||
[Nginx] .. [MySQL] | [Nginx] .. [MySQL] | ||
[Nginx] .. [NodeJS] | [Nginx] .. [NodeJS] | ||
[Nginx] .. [Grafana] | |||
[Eth0] .. [Postfix] : smtp\nimap | |||
[Postfix] .. [Dovecot] | |||
[Dovecot] .. Mailbox | |||
[Postfix] .. [Postgray] | |||
[PHP-CGI] .. [MediaWiki PHP] | [PHP-CGI] .. [MediaWiki PHP] | ||
| Line 26: | Line 48: | ||
[MySQL] .. MediaWiki_DB | [MySQL] .. MediaWiki_DB | ||
[Eth0] .. [Mosquitto] : mqtt\nwss | |||
[Eth0] .. [InfluxDB] : rest | |||
} | } | ||
WEB -- [ | WEB -- [Eth0] | ||
</uml> | </uml> | ||
| Line 41: | Line 64: | ||
state "No backup exists" as State0 <<Done>> | state "No backup exists" as State0 <<Done>> | ||
State0 : Status: Done | State0 : Status: Done | ||
state "Strategy: Simple ZIP" as StrategyA { | state "Strategy A: Simple ZIP" as StrategyA <<Done>> { | ||
state "Have a ZIP file with backup data" as StateA1 <<Done>> | state "Have a ZIP file with backup data" as StateA1 <<Done>> | ||
StateA1 : Status: Done | StateA1 : Status: Done | ||
| Line 48: | Line 71: | ||
StateA1 --> StateA2 | StateA1 --> StateA2 | ||
} | } | ||
state "Strategy: Better backup strategy using GIT" as StrategyB <<New>> { | state "Strategy B: Better backup strategy using GIT" as StrategyB <<New>> { | ||
state "Step1 ?" as StateB1 <<New>> | state "Step1 ?" as StateB1 <<New>> | ||
StateB1 : Status: Not started | StateB1 : Status: Not started | ||
| Line 65: | Line 88: | ||
</uml> | </uml> | ||
=== | === Strategy A: Simple ZIP === | ||
Using ssh: | Using ssh: | ||
<source lang='bash'> | |||
# backup changes of files and folders | # backup changes of files and folders | ||
#mkdir /backup | #mkdir /backup | ||
rsync -av --relative /var/www/html/wiki/LocalSettings.php /var/www/html/wiki/extensions/ /var/www/html/wiki/htmlets/ /backup/mediawiki/ | rsync -av --relative /var/www/html/wiki/LocalSettings.php /var/www/html/wiki/extensions/ /var/www/html/wiki/htmlets/ /backup/mediawiki/ | ||
# export the wikimedia database | # export the wikimedia database | ||
mysqldump - | mysqldump -uroot --single-transaction --databases mediawiki >/backup/mediawiki/wiki_mysql_database.sql | ||
# zip it | # zip it | ||
zipfile="mediawiki_$(date +'%Y%m%d-%H%M%S').zip" | zipfile="mediawiki_$(date +'%Y%m%d-%H%M%S').zip" | ||
pushd /backup/; zip -r $zipfile mediawiki/*; popd | pushd /backup/; zip -r $zipfile mediawiki/*; popd | ||
echo "The latest backup is in /backup/$zipfile" | echo "The latest backup is in /backup/$zipfile" | ||
</source> | |||
Now navigate to https://www.playfulexploration.com/backup and download the zip file. | |||
== Cost Structure == | |||
{| class="wikitable" | |||
|- | |||
! !! Product !! Cost !! Detail | |||
|- | |||
| || Virtual Private Server || $6.99 / month || [https://www.ovh.com/us/vps/vps-ssd.xml OVH] | |||
* 1 vCore 2.4 GHz | |||
* 4 GB RAM | |||
* 20 GB SSD Local RAID 10 | |||
* 1 static IP, all ports open | |||
* 100 Mbps Bandwidth | |||
* Control Panel | |||
|- | |||
| > || Virtual Private Server || $13.49 / month || [https://www.ovh.com/us/vps/vps-ssd.xml OVH] | |||
* 2 vCore 2.4 GHz | |||
* 8 GB RAM | |||
* 40 GB SSD Local RAID 10 | |||
* 1 static IP, all ports open | |||
* 100 Mbps Bandwidth | |||
* Control Panel | |||
|- | |||
| > || .COM Domain Name || $12 / year || [https://domains.google.com/registrar Google] | |||
* domain privacy | |||
* full control over all DNS records | |||
* awesome control panel | |||
|- | |||
| > || Software || $0 || all open source :] | |||
|} | |||
After the VPS upgrade the RAM automatically increased but the disk size needed manual fixing requiring two steps ([https://www.lowendtalk.com/discussion/75353/anyone-know-how-to-fix-this-ovh-diskspace-issue#Comment_1538939 source]): | |||
* Increase the partition to use the extra sectors added: | |||
fdisk /dev/vda | |||
> u | |||
> p | |||
(this will print all of the partitions, we will refer to the data later) | |||
> d 1 | |||
(this will display "Selected partition 1" and delete the first partition) | |||
> n | |||
(select "p" for primary partition) | |||
(partition number should be 1, but make sure it matches the number displayed in print command) | |||
(first sector should be 2048, but make sure it matches the "Start" column displayed in print command) | |||
(and set last sector to the default value) | |||
> a | |||
(type "1" to make new first partition bootable) | |||
> w | |||
(this will write the new partitions and exit fdisk) | |||
shutdown -r 0 | |||
* Increase the filesystem size to use the extra partition space that's now available: | |||
(connect to VM after it reboots, if it has resized partition but not filesystem then run resize2fs) | |||
== Bash commands == | |||
Install a new extnsion (replace the *tar.gz path): | |||
<syntaxhighlight lang=bash> | |||
docker exec -it playfulexploration_wiki bash | |||
curl https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_31-6f55941.tar.gz | tar -xz -C /var/www/html/extensions | |||
chown -R www-data:www-data /var/www/html/extensions | |||
</syntaxhighlight> | |||
Free disk space by trimming log file archives: | |||
<syntaxhighlight lang=bash> | |||
find /var/log/* -name *.gz -type f -mtime +100 -exec rm {} \; | |||
</syntaxhighlight> | |||
Free disk space by dropping caches: | |||
<syntaxhighlight lang=bash> | |||
free && sync && echo 3 > /proc/sys/vm/drop_caches && free | |||
</syntaxhighlight> | |||
See also: http://askubuntu.com/questions/5980/how-do-i-free-up-disk-space | |||
== Alternatives == | |||
* [https://www.kimsufi.com/us/en/ kimsufi dedicated server] | |||
Latest revision as of 00:07, 1 November 2018
Installed Components
Click this link to get a SSL report of this server: https://www.ssllabs.com/ssltest/analyze.html?d=playfulexploration.com .
Backup strategy
Postulates
- More important than having a very fancy backup mechanism is to have some backup mechanism
States and Status
Strategy A: Simple ZIP
Using ssh:
# backup changes of files and folders
#mkdir /backup
rsync -av --relative /var/www/html/wiki/LocalSettings.php /var/www/html/wiki/extensions/ /var/www/html/wiki/htmlets/ /backup/mediawiki/
# export the wikimedia database
mysqldump -uroot --single-transaction --databases mediawiki >/backup/mediawiki/wiki_mysql_database.sql
# zip it
zipfile="mediawiki_$(date +'%Y%m%d-%H%M%S').zip"
pushd /backup/; zip -r $zipfile mediawiki/*; popd
echo "The latest backup is in /backup/$zipfile"
Now navigate to https://www.playfulexploration.com/backup and download the zip file.
Cost Structure
| Product | Cost | Detail | |
|---|---|---|---|
| Virtual Private Server | $6.99 / month | OVH
| |
| > | Virtual Private Server | $13.49 / month | OVH
|
| > | .COM Domain Name | $12 / year | Google
|
| > | Software | $0 | all open source :] |
After the VPS upgrade the RAM automatically increased but the disk size needed manual fixing requiring two steps (source):
- Increase the partition to use the extra sectors added:
fdisk /dev/vda > u > p (this will print all of the partitions, we will refer to the data later) > d 1 (this will display "Selected partition 1" and delete the first partition) > n (select "p" for primary partition) (partition number should be 1, but make sure it matches the number displayed in print command) (first sector should be 2048, but make sure it matches the "Start" column displayed in print command) (and set last sector to the default value) > a (type "1" to make new first partition bootable) > w (this will write the new partitions and exit fdisk) shutdown -r 0
- Increase the filesystem size to use the extra partition space that's now available:
(connect to VM after it reboots, if it has resized partition but not filesystem then run resize2fs)
Bash commands
Install a new extnsion (replace the *tar.gz path):
docker exec -it playfulexploration_wiki bash
curl https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_31-6f55941.tar.gz | tar -xz -C /var/www/html/extensions
chown -R www-data:www-data /var/www/html/extensions
Free disk space by trimming log file archives:
find /var/log/* -name *.gz -type f -mtime +100 -exec rm {} \;
Free disk space by dropping caches:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
See also: http://askubuntu.com/questions/5980/how-do-i-free-up-disk-space