Add new instance to Specify Cloud
Example for
Create Database
Review the SQL file before importing to the production server. Test the import locally before uploading to a production instance.
Ensure the new database has the same name as the subdomain the user wishes to use, remembering that underscores (
_) are replaced with dashes (-) for the URL.Create the database:
mariadb -u<master> -p<master_password> -e "CREATE DATABASE <dbname>;"
Upload and restore the existing database:
mariadb -u<master> -p<master_password> <dbname> < <dbname>.sql
Note: You may
GRANT ALL PRIVILEGES ON <dbname>.* TO <master_password>@'%';if master doesn’t have accessFLUSH PRIVILEGES;
DNS Registration:
Login to Dreamhost, select Websites -> Manage Websites
For
specifycloud.org, select DNS (Direct link)Add CNAME record that has a name matching the database name and links to the appropraite regional domain value (i.e.
na-specify7-1.specifycloud.org.,eu-specify7-1.specifycloud.org., etc.). If the database name has underscores (_), replace these with dashes (-).<dbname>points to<subdomain>.specifycloud.org.For example, database nameherb_rbgewould have the nameherb-rbge.specifycloud.org.
Wait at least 10 minutes for domain to circulate.
For the ku servers, request the dns CNAME record to bitech@ku.edu
Config
Add to
spcloudservers.jsonon the appropriate server in the/home/ubuntu/docker-compositions/specifyclouddir.Make sure to add https: false
Run
makeasubuntuRun
docker compose up -dRun
docker compose restart nginx(reload should be just fine here:docker exec -it specifycloud_nginx_1 nginx -s reload)Check url
Add SSL
Run the
add_ssl.shscript and follow the prompts.sudo bash add_ssl.sh
You will need to provide the
<subdomain>for the new instance that you wish to add. After this, it will update thespcloudservers.jsonand set"https": falseto"https": truefor that instance, then restart all of the running containers.Check URL
Note: After an SSL certificate renewal, you can reload nginx without restarting the whole container:
docker exec -it specifycloud-nginx-1 nginx -s reload
For automatic nginx reloading on certificate renewal create /etc/letsencrypt/renewal-hooks/post/reload-nginx.sh
#!/bin/bash docker exec -it specifycloud-nginx-1 nginx -s reloadcrontab -e;and then add the line0 3 * * 0,2,4,6 docker exec specifycloud_nginx_1 nginx -s reloadcrontab -lto list cronjobs
Add Specify Admin user credentials to the Bitwarden Vault
Setup attachments for the database
SSH into the appropriate Web Asset Server
Navigate to the
web-asset-serverdirectoryUse the
manage_collection_dirs.pyutility to add the new database(s) to the server:python3 manage_collection_dirs.py add <database_name>
This creates a new attachment directory and updates the
settings.pyfile to add the collection directory.
Updown
Add url:
<subdomain>.specifycloud.org/context/system_info.jsonAdd alias:
<subdomain>
Misc
Add ssh key:
nano .ssh/authorized_keys
sudo systemctl reload sshd
Troubleshooting
Handle mariadb failing to restart after restarting the Database droplet:
mysqld --tc-heuristic-recover=ROLLBACK
systemctl start mariadb.service
Fix an instance by restarting it:
sudo docker exec -it specifycloud-nginx-1 nginx -s reload;
sudo docker stop client client-worker;
sudo docker compose up -d;
sudo docker exec -it specifycloud-nginx-1 nginx -s reload;