# Setting up TechnicSolder server w/ DigitalOcean and Caddy
###### tags: `unix` `minecraft`
(thanks to Blob on discord for this)
1. Setup droplet as normal (1GB memory, Ubuntu 20.04, SSH keys)
2. SSH into droplet, don't need to mount
3. Download Caddy Dependencies
```
apt-add-repository ppa:ondrej/php
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
| sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
apt update
```
4. UFW commands to skip securing MySQL later
```
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
```
5. Install Caddy, MariadB and PHP 7.0 (the download will take a while at 99%)
```
apt install caddy mariadb-server php7.0-common
```
6. Install CURL and other PHP stuff
```
apt install curl php7.0-cli php7.0-curl php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-fpm php7.0-apcu
```
This should be your file output (do ```df -h```)
```
Filesystem Size Used Avail Use% Mounted on
udev 474M 0 474M 0% /dev
tmpfs 99M 960K 98M 1% /run
/dev/vda1 25G 1.8G 23G 8% /
tmpfs 491M 0 491M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 491M 0 491M 0% /sys/fs/cgroup
/dev/vda15 105M 3.9M 101M 4% /boot/efi
/dev/sda 888M 21M 801M 3% /mnt/volume_sgp1_01
/dev/loop0 31M 31M 0 100% /snap/snapd/9607
/dev/loop1 56M 56M 0 100% /snap/core18/1885
/dev/loop2 71M 71M 0 100% /snap/lxd/16922
tmpfs 99M 0 99M 0% /run/user/0
```
Blob notes: You don't need it (i set volume to 1GB)
We're installing to /, which is on the 25GB volume
/dev/vda1
7. Check if it works by navigating to your droplet's IP in a browser
http://your_droplet_ip:80/
It should show you Caddy's default index page –Blob
(page should look like stacked pages of paper)
8. Configure PHP-FPM
```cd /etc/php/7.0/fpm```
This should be the file structure
```conf.d php-fpm.conf php.ini pool.d```
`nano pool.d/[PRESS TAB]` (if you see www.conf, go to `nano pool.d/www.conf`)
Find
```
listen.owner = www-data
listen.group = www-data
```
and replace `www-data` with `caddy`
(if there is user = www-data and group = www-data change those too)
**Blob notes:** So in addition to user and group, could you check if there's listen.owner commented out somewhere?
If it is, uncomment it and replace www-data with caddy
Now Ctrl-S then Ctrl-X (exit out of nano), then run
`service php7.0-fpm restart`
9. Configure Caddyfile
`nano /etc/caddy/Caddyfile`
Delete everything in it (or delete the Caddyfile and create a new Caddyfile in the same directory ```rm -rf Caddyfile | touch Caddyfile```), then paste in
```
[YOUR_DOMAIN] {
root * /var/www/solder/public
handle_path /repo/* {
file_server {
root /var/www/solder/repo
}
}
log {
output file /var/log/caddy/solder.log {
roll_size 2MiB
roll_keep 3
roll_keep_for 24h
}
format console
}
header {
X-Content-Type-Options nosniff
X-XSS-Protection "1; mode=block"
X-Robots-Tag none
X-Frame-Options DENY
Referrer-Policy same-origin
}
php_fastcgi unix//run/php/php5.6-fpm.sock
file_server
tls [YOUR_EMAIL] {
protocols tls1.2 tls1.3
}
}
```
Replace YOUR_DOMAIN and YOUR_EMAIL with your domain name(!), and the email with your email.
(!) Create a DNS Record in DigitalOcean *and* Namecheap/etc (an A record)

It should look like this (directs to the droplet IP address. Hostname is solder.yourdomain.com)
**Blob notes:** Now put the domain into the Caddy config, and your email below. It's only used to notify you of any critical issues with your HTTPS certificate
Run `composer` to see if it's installed
If you get this warning, ignore it:
```
Do not run Composer as root/super user! See https://getcomposer.org/root for details
```
10. Solder Setup!
`mkdir /var/www/ | cd /var/www/`
Clone Solder into the www folder
```git clone https://github.com/TechnicPack/TechnicSolder.git solder```
`cd solder`
`composer install --no-dev --no-interaction`
If your error is
```
Problem 1
- phpunit/phpunit[5.7.0, ..., 5.7.27] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
- Root composer.json requires phpunit/phpunit ~5.7 -> satisfiable by phpunit/phpunit[5.7.0, ..., 5.7.27].
To enable extensions, verify that they are enabled in your .ini files:
```
try bulk uninstalling PHP5.6
`apt remove php.56 php5.6-common`
If apache2 is installed in the logs, uninstall
`apt install php-7.0-fpm`
`apt remove apache2`
Do `php -m` for the output. It should be something like this:
https://pastebin.com/crGwUYe3
If you get this in your solder folder and your solder.php file is empty
```
root@solder-droplet:/var/www/solder# ls
LICENSE README.md app artisan bootstrap composer.json phpunit.php phpunit.xml public server.php
```
do this: `cp -r app/config-sample app/config`
`nano app/config/solder.php`
Change `repo_location` to `/var/www/solder/repo/`
Change `mirror_url` to `https://solder.yourdomain.com/repo/`
11. MySQL stuff
`mysql`
```
CREATE DATABASE solder;
exit
```
`nano app/config/database.php`
Change `default` to `mysql`
Then in `connections.mysql`, change username to root and password to an empty string (just '', to indicate no password)
In here: ```
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'solder',
'username' => 'solder',
'password' => 'solder',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
```
Exit out of nano
12. More PHP
`nano app/config/app.php`
Blob notes:
Change `url` to `https://solder.yourdomain.com` put in https
Change `timezone` to the code of the timezone the server is in
And make sure that key contains a random string of characters
(if it isn't, go back to the composer install)
13. Artisan Migrate
`cd /var/www/solder`
`php artisan migrate:install`
`php artisan migrate`
reload caddy
`service caddy reload`
(still in var/www/solder)
`chown caddy:caddy ./public -R`
`chown caddy:caddy ./app/storage -R`
`chown caddy:caddy ./app/database -R`
`mkdir ./repo`
Navigate to your domain (https://solder.yourdomain.com)
not working? try:
`service caddy restart`
`service caddy status`
**IMPORTANT**: MySQL isn't working! Run:
`mysql`
`CREATE USER 'solder'@'localhost' IDENTIFIED BY 'some_password_goes_here';`
`GRANT ALL PRIVILEGES ON solder.* TO 'solder'@'localhost';`
then `FLUSH PRIVILEGES;`
Exit out of mysql
**Blob notes:** then you gotta edit app/config/database.php, replace root with solder and in password, put in the password you set
re-run `php artisan migrate:install and php artisan migrate`
If it says nothing to migrate and/or php artisan install says
```
[PDOException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migrations' already exists
```
then you're good to go. If you can't login on Firefox, try Google or another browser. Then login to solder.
Also try changing the DNS servers to `1.1.1.1` and `8.8.8.8`
**Blob notes:** Defaults are `admin@admin.com`, `admin`
Change those immediately after logging in
*You're done! Read the solder docs for more info: https://docs.solder.io/docs/linking-solder-to-the-technic-platform*