|  |  | @ -2,80 +2,40 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Repo for my personal website. |  |  |  | Repo for my personal website. | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # install ubuntu server 18.04 |  |  |  | If you have the keys to my castle, you should be able to archive the entire top level folder, move everything to another server and just deploy with: | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-server#0 |  |  |  | docker-compose up -d | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # update |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo apt update |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo apt upgrade |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # install docker and docker-compose |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-18-04 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # enable ufw and set rules |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo ufw allow 22/tcp |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo ufw allow 80/tcp |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo ufw allow 443/tcp |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | sudo ufw enable |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # make unboundedpress directory |  |  |  | But that is being pretty optimistic. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | mkdir unboundedpress |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | cd unboundedpress |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # pull git repo |  |  |  | In the docker-compose.yml file, there are detailed notes of non-automatic steps that need to be taken, especially for deploying from scratch. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # change dir name (the git repo is unboundedpress but make it www) |  |  |  | Here are some useful tips. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | mv ~/unboundedpress/unboundedpress ~/unboundedpress/www |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # put in sensitive data in all the *.template files and  |  |  |  | The current server is running on ubuntu server 22.04/ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # install everything |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | docker-compose up -d |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # NEXTCLOUD |  |  |  | # Running on docker. Here are some install tips. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # update nextcloud since the dbs were initialized to handle 4-byte characters |  |  |  | # https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | docker exec -it mariadb mysql -u root -p |  |  |  | # https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-22-04 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | use nextcloud; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | set global innodb_file_format=Barracuda; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | set global innodb_large_prefix=on; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | exit |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | docker-compose exec --user www-data nextcloud php occ config:system:set mysql.utf8mb4 --type boolean --value="true" |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | docker-compose exec --user www-data nextcloud php occ maintenance:repair |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # GITEA |  |  |  | # There are two .env files that are the same and go at the top level folder and again in portfolio/src. Templates are provided. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # install gitea through the web-interface and create and fill in Administrator Account Settings |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # this might make nginx time out, but that should be ok. It is still running scripts server side |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # set ROOT_URL in gitea/gitea/app.ini and restart container |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | ROOT_URL = https://gitea.unboundedpress.org |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #  migrate repose from github |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # UNBOUNDEDPRESS |  |  |  | # Here are a list of the service | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # example of restoring the mongodb |  |  |  | # Main components | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # move database backup to unboundedpress/mongodb_backup |  |  |  | porfolio - node server and frontend for my porfilio that uses mongo backend | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | docker exec -it mongo bash |  |  |  | mongo - houses the data of my portfolio | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | mongorestore --host localhost --port 27017 -d unboundedpress -u username -p password --authenticationDatabase admin /backup/db_dump_2019_07_12/unboundedpress |  |  |  | restheart - api to feed data from mongo to portfolio (though there are some end points built into the node app) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # here is an example of a file upload: |  |  |  | gitea - my code repository | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl -v -u user:pass -X POST -F 'properties={"filename":"filename"}' -F "file=@filepath_here" https://restheart.unboundedpress.org/unboundedpress/scores.files |  |  |  | mysql-gitea - databse for gitea | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # TODO: example of mongodb dump |  |  |  | nginx-proxy - reverse proxy for everything | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | mongodump --host localhost --port 27017 -d unboundedpress -o /backup/db_dump_2020_03_30 -u username -p password --authenticationDatabase admin |  |  |  | acme-companion - lets encrypt certificate manager | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # TODO: examples of the nextcloud and gitea dump and restore |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # TODO: maybe try to add some kind of caching |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # TODO: consider making mongodb a replica set |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # TODO: example of restheart file upload |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # SERVER MAINTANENCE |  |  |  | # Extra components | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | # update dynamic dns script and make cron (currently in /etc/cron.hourly/update_dns |  |  |  | nextcloud | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | #!/bin/bash |  |  |  | mysql-nextcloud | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=unboundedpress.org&ip=" |  |  |  | # Here are some useful tips for mongo | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=www.unboundedpress.org&ip=" |  |  |  | # dump and restore example: | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=restheart.unboundedpress.org&ip=" |  |  |  | mongodump --host localhost --port 27017 -d unboundedpress -o /backup/db_dump_2023_04_07 -u username -p password --authenticationDatabase admin | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=gitea.unboundedpress.org&ip=" |  |  |  | mongorestore --host localhost --port 27017 -d portfolio -u username -p password --authenticationDatabase admin /db_backups/db_dump_2023_04_07/unboundedpress | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=nextcloud.unboundedpress.org&ip=" |  |  |  | # here is an example of a file upload through restheart: | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=dev.unboundedpress.org&ip=" |  |  |  | curl -v -u user:pass -X POST -F 'properties={"filename":"filename"}' -F "file=@filepath_here" https://unboundedpress.org/api/scores.files | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | <<<<<<< HEAD |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | curl "https://api.1984.is/1.0/freedns/?apikey={{{KEY}}}&domain=express.unboundedpress.org&ip=" |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # Backups are done using rsnapshot (currently in /etc/cron.weekly/backup.sh) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | ======= |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | # Backups are done using rsnapshot (currently in /etc/cron.weekly/backup) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | >>>>>>> 29c197a67b7278fe73cead0708e8d73fe06f1d11 |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
	
		
		
			
				
					|  |  | 
 |