Skip to content

Commit

Permalink
update installation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
doomlab committed Oct 31, 2023
1 parent e013ee6 commit 30519b1
Show file tree
Hide file tree
Showing 17 changed files with 1,076 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

source("_setup.R") # pre-chapter setup

1 change: 1 addition & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bibliography: references.bib
format:
html:
theme: cosmo
css: glossary.css
pdf:
documentclass: scrreprt

Expand Down
5 changes: 5 additions & 0 deletions _setup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# glossary setup - persistent across chapters
library(glossary)
glossary_path("glossary.yml")
glossary_persistent(TRUE)

40 changes: 40 additions & 0 deletions docs/glossary.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<style>
a.glossary {
color: black;
text-decoration: underline;
cursor: help;
position: relative;
}

/* only needed for popup = "click" */
/* popup-definition */
a.glossary .def {
display: none;
position: absolute;
z-index: 1;
width: 200px;
bottom: 100%;
left: 50%;
margin-left: -100px;
background-color: #333;
color: white;
padding: 5px;
border-radius: 6px;
}
/* show on click */
a.glossary:active .def {
display: inline-block;
}
/* triangle arrow */
a.glossary:active .def::after {
content: ' ';
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #333 transparent transparent transparent;
}
</style>

304 changes: 298 additions & 6 deletions docs/installation.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
}</script>


<link rel="stylesheet" href="glossary.css">
</head>

<body class="nav-sidebar floating">
Expand Down
90 changes: 87 additions & 3 deletions docs/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"objectID": "summary.html",
"href": "summary.html",
"title": "6  Summary",
"title": "7  Summary",
"section": "",
"text": "This section will summarize the main points."
},
Expand All @@ -30,9 +30,9 @@
{
"objectID": "terminology.html",
"href": "terminology.html",
"title": "7  Terminology",
"title": "8  Terminology",
"section": "",
"text": "data frame with 0 columns and 0 rows"
"text": "term\ndefinition\n\n\n\n\nprimary data\nData generated by the researcher using surveys, interviews, experiments or other sources to explore a research problem.\n\n\nsecondary data\nData that previously existed to explore a research problem, generally not generated by the researcher using the data.\n\n\nsemantic priming\nSemantic priming occurs when someone processes a second word faster after seeing a related word first. For example, you will read the word DOG faster if you see CAT before it in comparison to SPOON."
},
{
"objectID": "metadata.html",
Expand Down Expand Up @@ -166,5 +166,89 @@
"title": "6  Installation",
"section": "",
"text": "This page will cover how to install the software on your own server."
},
{
"objectID": "installation.html#assumptions",
"href": "installation.html#assumptions",
"title": "6  Installation Guide",
"section": "6.1 Assumptions",
"text": "6.1 Assumptions\n\nThis guide assumes the following:\n\nYou are working on a Linux server. We are specifically using Ubuntu 20, but this guide should be consistent for most versions of Linux.\nYou have access to the shell command console. You will need access to install files directly onto the server computer.\nYou have worked with the command line before.\nYou have sudo rights to add files and services.\nYou know what a hidden file is and at least how to google how to view them.\nYou know what SQL and databases are, even if you’ve never worked with PostgreSQL before.\nYou know what Apache and/or nginx servers are and how to edit their files.\nYou can at least imagine yourself using git."
},
{
"objectID": "installation.html#web-server-installation",
"href": "installation.html#web-server-installation",
"title": "6  Installation Guide",
"section": "6.2 Web Server Installation",
"text": "6.2 Web Server Installation\n\nApache - Installation Instructions\nNginx - Installation Instructions\nThey really aren’t big fans of each other, only install one. We are using nginx on our server."
},
{
"objectID": "installation.html#blitzjs-installation",
"href": "installation.html#blitzjs-installation",
"title": "6  Installation Guide",
"section": "6.3 Blitz/JS Installation",
"text": "6.3 Blitz/JS Installation\n\nInstall node.js and npm - Installation Instructions\n\nOther downloads\nYou should have at least node v18+ and npm v9+.\nYou can check your versions by using node -v and npm -v in a terminal or command window.\nYou may also use yarn, but this guide uses npm.\n\nInstall blitzjs: npm install -g blitz in a terminal/command window. Check your version is at least v2+ by using blitz -v in a command window.\nDepending on server setup, you may need sudo privileges."
},
{
"objectID": "installation.html#clone-this-repository",
"href": "installation.html#clone-this-repository",
"title": "6  Installation Guide",
"section": "6.4 Clone This Repository",
"text": "6.4 Clone This Repository\n\nClone or copy this github repository to the server.\n\nInstall git on the machine using: sudo apt-get update sudo apt-get install git\nNavigate to /var/www/html/ or /var/www/ on the Linux machine.\nClone the repository by using this guide - Installation Instructions. git clone https://github.com/STAPLE-verse/STAPLE.git\nThis will make a folder called STAPLE with all the files you need.\n\nNavigate to that folder by using cd STAPLE."
},
{
"objectID": "installation.html#database-installation",
"href": "installation.html#database-installation",
"title": "6  Installation Guide",
"section": "6.5 Database Installation",
"text": "6.5 Database Installation\n\nEnsure that you have a local postgres service running on your computer.\nTo install see: Installation Instructions.\n\nBe sure to write down the superuser information as you are installing the setup for non-Linux machines\nYou may use other databases, but will need to modify the provided code for their implementation.\n\nCreate the databases for STAPLE. Go to terminal and use:\n\nNote that all lines that start with # are comments for explanation.\n\n\n# get into postgres on linux\nsudo -u postgres psql \n# enter your password for superuser when prompted\nCREATE DATABASE staple;\nCREATE DATABASE staple_test;\n\nCreate a user with appropriate privileges after postgres installation. While in the terminal and postgres, create a new user:\nChange out username and password (be sure to leave the quotes!) for your desired user.\n\nCREATE USER username WITH PASSWORD 'password';\n\nGet into the STAPLE database. You can use \\l and should see something like this:\n\npostgres=# \\l\n List of databases\n Name | Owner | Encoding | Collate | Ctype | Access privileges \n-------------+----------+----------+-------------+-------------+---------------------------\n postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | \n staple | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +\n | | | | | postgres=CTc/postgres +\n | | | | | staple=CTc/postgres +\n | | | | | staple_admin=CTc/postgres\n staple_test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | \n template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +\n | | | | | postgres=CTc/postgres\n template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +\n | | | | | postgres=CTc/postgres\n(5 rows)\n\nUse the following to get into the STAPLE database.\n\npostgres=# \\c staple\nYou are now connected to database \"staple\" as user \"postgres\".\nstaple=# \n\nYou can check that schema exist using \\dn:\n\nstaple=# \\dn\n List of schemas\n Name | Owner \n--------+--------\n public | staple\n(1 row)\n\nstaple=# \n\nGive your user the appropriate permissions to write to the database. Change out username for the user you created a minute ago.\n\nGRANT ALL ON SCHEMA public TO username;\n\nUse quit; to exit out of postgres."
},
{
"objectID": "installation.html#connect-database-to-staple-app",
"href": "installation.html#connect-database-to-staple-app",
"title": "6  Installation Guide",
"section": "6.6 Connect Database to STAPLE App",
"text": "6.6 Connect Database to STAPLE App\n\nMake sure you are in the folder that you copied the github repository into.\nYou can use ls -al to view all files in that folder.\n\n# for example on my server \nerin@staple:~$ cd /var/www/html/STAPLE\nerin@staple:/var/www/html/STAPLE$ ls -al\ntotal 764\ndrwxr-xr-x 13 root root 4096 Oct 24 06:17 .\ndrwxr-xr-x 6 root root 4096 Oct 24 05:02 ..\ndrwxr-xr-x 3 root root 4096 Oct 24 04:27 db\n-rw-r--r-- 1 root root 175 Oct 24 04:27 .editorconfig\n-rw-r--r-- 1 root root 494 Oct 24 06:17 .env\n# more truncated # \n\nCopy the .env file and rename it .env.local.\n\nYou may need to turn on settings to see these hidden files on your machine.\nYou can create and edit this file at once with nano .env.local or vim if you want.\n\nEnsure the .env.local file has required environment variables.\n\nAfter the commented lines, add the DATABASE_URL line and change to username:password (no &lt;&gt; these are here to show you what to change).\nCreate and add a SESSION_SECRET_KEY.\n\nIn the command line prompt, use openssl rand -hex 16 and copy this long letter/number combination instead of .\n\n\n\n# This env file should be checked into source control\n# This is the place for default values for all environments\n# Values in `.env.local` and `.env.production` will override these values\nDATABASE_URL=postgresql://&lt;YOUR_DB_USERNAME&gt;@localhost:5432/staple\nSESSION_SECRET_KEY=&lt;SESSIONKEY&gt;\n\nCopy the .env.test file and rename .env.test.local.\nEnsure the .env.test.local file has required environment variables in the same way you did above.\n\nDATABASE_URL=postgresql://&lt;YOUR_DB_USERNAME&gt;@localhost:5432/staple_test"
},
{
"objectID": "installation.html#install-staple-requirements",
"href": "installation.html#install-staple-requirements",
"title": "6  Installation Guide",
"section": "6.7 Install STAPLE Requirements",
"text": "6.7 Install STAPLE Requirements\n\nMake sure you are in the STAPLE main folder. Use the following (not the # line, these are notes) to install packages, tailwind, and daisyui.\n\n# to install all packages for staple\nnpm install\n# install tailwind css\nblitz install tailwind\n# install daisyui\nnpm i -D daisyui@latest\n\nNext, use the following line to create the database structure/schema for STAPLE to run.\n\n# to create database with the right set up\nblitz prisma migrate dev"
},
{
"objectID": "installation.html#starting-the-app---local-testing",
"href": "installation.html#starting-the-app---local-testing",
"title": "6  Installation Guide",
"section": "6.8 Starting the App - Local Testing",
"text": "6.8 Starting the App - Local Testing\n\nIn a terminal window, go to the folder you cloned this repository and type:\n\nblitz dev\n\nOpen (usually) http://localhost:3000 (or whatever it says for localhost in the terminal) with your browser to see the result.\nThis step works great on a “regular” computer, but may not be useful for a server. Instead run the service “in production” to view on your website."
},
{
"objectID": "installation.html#starting-the-app---production",
"href": "installation.html#starting-the-app---production",
"title": "6  Installation Guide",
"section": "6.9 Starting the App - Production",
"text": "6.9 Starting the App - Production\n\nIn a terminal window, go to the folder you cloned this repository and type:\n\nblitz build\n\nThis step may produce errors in the build. You will need to fix these errors before running the application. Check below for common issues."
},
{
"objectID": "installation.html#keeping-the-app-going",
"href": "installation.html#keeping-the-app-going",
"title": "6  Installation Guide",
"section": "6.10 Keeping the App Going",
"text": "6.10 Keeping the App Going\n\nCreate a service.\nGenerally, you might consider putting it here: /etc/systemd/system/ on a linux machine.\nWe’ve named the file blitz.service as an example creating it using nano.\nTutorial for those who do not know how to do this - Installation Instructions\n\n# for example \nerin@staple:/var/www/html/STAPLE$ cd /etc/systemd/system/\nerin@staple:/etc/systemd/system$ nano blitz.service\n\nExample file structure:\nChange the WorkingDirectory to your folder.\n\n[Unit]\nDescription=Starts the Blitz service.\nAfter=network.target\n\n[Service]\nType=simple\nWorkingDirectory=/var/www/html/STAPLE\nExecStart=/usr/local/bin/blitz start\nRestart=always\n\n[Install]\nWantedBy=default.target\n\nCommands:\n\nstop: sudo systemctl stop blitz\nstart: sudo systemctl start blitz\nrestart: sudo systemctl restart blitz\nreload: sudo systemctl reload blitz\ndisable: sudo systemctl disable blitz\nre-enable: sudo systemctl enable blitz\nstatus: sudo systemctl status blitz\nreset: sudo systemctl reset-failed blitz\n\n\nMany thanks to Scott B. for setting this up and giving instructions.\n\nRun sudo systemctl start blitz.\nCheck the status using sudo systemctl status blitz. Type the letter q to exit.\nStatus can also help you troubleshoot when you have an error."
},
{
"objectID": "installation.html#setting-up-the-proxy",
"href": "installation.html#setting-up-the-proxy",
"title": "6  Installation Guide",
"section": "6.11 Setting Up the Proxy",
"text": "6.11 Setting Up the Proxy\n\nUse the following to get to the nginx web server: cd /etc/nginx/sites-enabled\nCreate a file by using nano YOURWEBSITE … for example ours is nana app.staple.science because that is the website of our hosted version of STAPLE.\nCreate the server file setup:\n\n# Default server configuration\n#\nserver {\n\n server_name YOURWEBSITE;\n error_log /var/www/html/YOURFOLDER/logs/web-server.log;\n location / {\n proxy_pass http://localhost:3000/;\n }\n}\n\nserver {\n server_name YOURWEBSITE;\n listen 80;\n}\n\n\nFor https you need to set up a certificate and the easiest solution is through certbot. See Installation Instructions."
},
{
"objectID": "installation.html#common-errors",
"href": "installation.html#common-errors",
"title": "6  Installation Guide",
"section": "6.12 Common Errors",
"text": "6.12 Common Errors"
}
]
8 changes: 8 additions & 0 deletions docs/site_libs/kePrint-0.0.1/kePrint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$(document).ready(function(){
if (typeof $('[data-toggle="tooltip"]').tooltip === 'function') {
$('[data-toggle="tooltip"]').tooltip();
}
if ($('[data-toggle="popover"]').popover === 'function') {
$('[data-toggle="popover"]').popover();
}
});
Loading

0 comments on commit 30519b1

Please sign in to comment.