# SkotOS Trial Run My experience with DGD is minimal so I'm walking into this with only basic knowledge. I'll document my experience here along with any obstacles I encounter. ## Step 1: Install Homebrew Copy and paste the following into the terminal. ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ``` ## Step 2: Download the repository 1. Navigate to https://github.com/ChatTheatre/SkotOS 1. Click the green "Code" button and download the zip file. 1. Extract the zip file in directory of choice. For testing purposes, I kept mine in the Downloads folder. ## Step 3: Run the "installation" command Within the terminal, navigate to the folder and run the setup command. ``` $ cd Downloads $ cd SkotOS-master $ ls AGPL.md README_Shentino.md CC_BY-SA_3.0_Unported.md cores CLA-signed dev_scripts CLA.md skoot HACKING.md skotos.database LICENSE.md skotos.dgd README.md tmp $ cd dev_scripts $ ls dev_nginx.conf orchil_profiles.js mac_setup.sh post_install_instructions.txt $ ./mac_setup.sh ``` **PROBLEM ENCOUNTERED** ``` ~/Downloads/SkotOS-master Cloning Orchil Cloning into '../orchil'... Enter passphrase for key '/Users/sarahtackett/.ssh/id_rsa': Enter passphrase for key '/Users/sarahtackett/.ssh/id_rsa': git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. ``` After some investigating, I discovered that I needed to add a SSH key to my GitHub account. To check if you have already have an existing key, open up the terminal: ``` $ cd ~/.ssh $ ls id_rsa id_rsa.pub id_rsa2 id_rsa2.pub known_hosts ``` If id_rsa.pub exists, you have a key. Use the vi command to open the id_rsa.pub file and copy the contents. `$ vi ~/.ssh/id_rsa.pub` Now login to GitHub and go to Settings -> SSH and GPG Keys. Click "New SSH Key" and paste your ssh key into the box then click save. At this point you should be able to successfully run mac_setup.sh using the above directions. However, I ran into an additional problem in that I was being prompted for a passphrase for my key and I had no clue what this was. So I removed my existing key, regenerated a new one with a passphrase I could remember, and added it to my GitHub account. ``` Remove your SSH public/private keys: $ rm ~/.ssh/id_rsa* Recreate the keypair, choosing a new passphrase: $ ssh-keygen -t rsa -f ~/.ssh/id_rsa Add the newly created private key to your OS X Keychain to store the passphrase and manage unlocking it automatically: $ ssh-add -K ~/.ssh/id_rsa ``` After completing this step, I was able to successfully run the installation file! ## Step 4: Post Installation Instructions Within the SkotOS-master/dev_scripts directory is post_install_instructions.txt file. Read it thoroughly. ### Step 4.1: Starting the websocket tunnels You may need to install node.js if you haven't already. ``` $ brew install node ``` Copy and paste the commands from the text file into the terminal. **PROBLEM ENCOUNTERED** I ran into this error when running the tunnel commands ``` internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module 'minimist' Require stack: - /Users/sarahtackett/Downloads/websocket-to-tcp-tunnel/src/Relay.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader.js:725:27) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object.<anonymous> (/Users/sarahtackett/Downloads/websocket-to-tcp-tunnel/src/Relay.js:8:12) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/sarahtackett/Downloads/websocket-to-tcp-tunnel/src/Relay.js' ] } ``` I resolved this by installing npm. ``` $ npm install ``` You will know the websockets are running if you navigate to http://localhost:10801/ and http://localhost:10802/ and receive the message "upgrade required" ### Step 4.2: Nginx You may need to install nginx if you haven't already ``` $ brew install nginx ... $ sudo nginx ``` Navigate to http://localhost:8080 to ensure it is running. ## Step 5: Starting DGD Since I saved SkotOS-master to the Downloads, that is the location I will navigate to to launch the game. ``` $ cd Downloads $ ./dgd/bin/dgd ./SkotOS-master/skotos.dgd ``` If you already have a database that you want to use, save it in the SkotOS-master directory and use this command instead. When a database is not specified, a new one will be created. You can expect that to take awhile (roughly 6 minutes). ``` ./dgd/bin/dgd ./SkotOS-master/skotos.dgd ./SkotOS-master/skotos.database ``` **PROBLEM ENCOUNTERED** I received this error when trying to run the command. ``` $ ./dgd/bin/dgd ./SkotOS-master/skotos.dgd Config error: bad base directory "./skoot" ``` I resolved it by editing this line of the SkotOS-master/skotos.dgd file from `directory = “./skoot";` to `directory = "/Users/sarahtackett/Downloads/SkotOS-master/skoot";` I ran the command again and it worked! I have a feeling I'm doing something dumb like lauching the command from the wrong directory but it works for now. ## Step 6: Launching the client **PROBLEM ENCOUNTERED** The post installation instructions says to navigate to http://localhost:10900/gables/gables.htm but this doesn't work. 1. The port number is typoed. Should be 10090. 1. Even after correcting the port number, /gables/gables.htm could not be found. I was able to get a client to work by copying the profiles.js file from the dev_scripts folder to the orchil folder and creating my own "gables" client directory. I'm getting this error now when trying to connect: ``` Starting connection to: ws://localhost:10800/gables CONNECTED DISCONNECTED Password: SECRET NONE Authentication error: LOCAL BAD USER/PASS ``` I assume it has something to do with this part of the post installation instructions: ``` And of course you'll need to run Skotos. Make sure to patch SkotOS to include your new administrative user, as described at "https://ChatTheatre.github.io/SkotOS-Doc/setup.md". This will determine your username and password! ``` The url does not work. I was able to get the tree of woe to work by doing two things. First, in profiles.js, add the following property -> "http_port": 10080 Without http_port defined, it assumes all woe files will be opened on localhost:80. Secondly, there is a bug in woe-init.js Starting on line 262... ``` if(c.http_port) { port = profile.http_port; } else { port = 80; } ``` Change it to... ``` if(c.http_port) { port = c.http_port; } else { port = 80; } ``` ## Feedback I know the documentation is still a work in progress but I want to note a few key points here: 1. It would be useful to mention prerequisites before embarking on this process. Install homebrew, nginx, npm, nodejs, add ssh key to GitHub account (how to generate a ssh key). 2. Unless someone has experience with dgd, the correct syntax to launch the game isn't clear. I was getting an error when trying to do it the way I thought was right and I have a feeling it's because I'm doing something silly like not executing the command from within the proper directory. I was able to get around this by editing the skotos.dgd file and changing the "directory" reference from "./skoot" to "/Users/sarahtackett/Downloads/SkotOS-master/skoot" which isn't ideal. Like I said, probably me doing something silly but would be useful to note where the command should be executed from. 3. The url (https://ChatTheatre.github.io/SkotOS-Doc/setup.md) reference in the post installation instructions for setting up a username and password does not work. 4. There is also a typo on this line in the same file: For the web client: point your web browser at http://localhost:10900/gables/gables.htm The port number should be 10090. Though even with correcting that, the link did not work. Is the orchil folder that is being pulled a current version? I did not see a gables folder in the directory. 5. I was able to fiddle with the orchil stuff enough to get the client to launch but was met with a "Authentication error: LOCAL BAD USER/PASS" error (presumably because I could not complete the username/password setup). 6. I was able to get the tree of woe to work by doing two things. First, in profiles.js, add the following property -> "http_port": 10080 Without http_port defined, it assumes all woe files will be opened on localhost:80. Secondly, there is a bug in woe-init.js Starting on line 262... ``` if(c.http_port) { port = profile.http_port; } else { port = 80; } ``` Change it to... ``` if(c.http_port) { port = c.http_port; } else { port = 80; } ``` Once I got over the initial hurdle of figuring out prerequisites, the setup was fairly seamless. Once I figure out the username/password issue, it will be good to go! Awesome work on everything. Having set up a few game instances in the past, this makes it SO much easier.