Create A Local Network Test Website On Ubuntu 20.04
Complete Website Domain Tasks
Create A Colby Website Project On The Web Server
-
workstation$ ssh <webserver>
-
webserver$ cd <colby_projects_directory>
-
webserver$ mkdir <reverse_server_specific_domain>
-
webserver$ cd <reverse_server_specific_domain>
-
webserver$ curl -s https://mattifesto.com/install/ > install.php && php install.php
Scenario 1: Create A New Website Instance Using An Existing Git Repository
-
choose option 1) create a website using an existing Git repository
Scenario 2a: Copy/Move Another Website Instance On This Web Server
-
choose option 2) create directories for a website
-
Go to the update admin page for the website you are copying and click on the "Backup Database" button. We will import this backup into the database for this site later.
-
webserver$ rm -rf document_root
-
webserver$ cp -r <source_website_project_directory>/document_root document_root
NOTE: No ending slash on either document_root directory.
Scenario 2b: Copy/Move Another Website Instance On Another Workstation or Web Server
At the heart of this scenario we are just copying the document_root directory from one computer to another. You can accomplish this task using any method you like. This is the method that we most often use.
-
choose option 2) create directories for a website
-
Go to the update admin page for the website you are copying and click on the "Backup Database" button. We will import this backup into the database for this site later.
-
webserver$ rm -rf document_root
-
Determine the source host name or IP address.
If you are copying from another local server you can use its hostname.
If you are copying between two DigitalOcean droplets you will want to use the source droplet's PRIVATE IP address which is available on the DigitalOcean admin page.
-
You may need to set up SSH keys to access the previous server from the new server.
-
webserver$ rsync -a --info=progress2 <username>@<source_hostname_or_ipaddress>:~/<document_root_path>/ document_root
IMPORTANT: A slash is placed after the source document root path, but no slash is placed after the destination path.
Configure The Project
webserver$ php document_root/colby/bin/cbt update-configuration
Create Database On The Web Server
webserver$ php document_root/colby/bin/cbt create-database
webserver$ sudo mysql < create_database.sql
Scenario 2: Import The Database From The Copied Website Instance
This step is only necessary if you are copying/moving another website instance.
-
webserver$ cp document_root/tmp/database-backups/<most_recent_backup_file> import.sql
-
webserver$ vi import.sql
-
:%s/<old_database_name>/<new_database_name>/gc
The new database name is in the cb_configuration.json file.
This moment is where it really helps if the database names are globally unique.
-
webserver$ mysql -u <username> -p < import.sql
The username and password are in the cb_configuration.json file.
-
If
document_root/colby-configuration.php
exists delete it.
Create And Enable Virtual Hosts On The Web Server
webserver$ php document_root/colby/bin/cbt create-apache-conf
webserver$ sudo cp *.conf /etc/apache2/sites-available/
webserver$ sudo a2ensite *.conf
webserver$ sudo apache2ctl configtest
webserver$ sudo systemctl reload apache2
Set Up The Website
$ php document_root/colby/bin/cbt setup
If a user doesn't exist for the email address you entered when you configured the site, one will be created and you will be asked for that user's password.
After this step is complete you can navigate to the home page or the /admin/ page to log in.