From 0e44df85ad283700b12fe9dc7b5f2feed900e73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20L=C3=B6fgren?= <viclo211@student.liu.se> Date: Thu, 27 May 2021 12:12:06 +0200 Subject: [PATCH] Update server installation instructions --- .gitlab/server.gitlab-ci.yml | 8 +- docs/source/installation/server.md | 127 ++++++++++++++++++++++++++--- server/README.md | 4 + server/requirements-dev.txt | Bin 0 -> 1618 bytes server/requirements.txt | Bin 3396 -> 1292 bytes 5 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 server/requirements-dev.txt diff --git a/.gitlab/server.gitlab-ci.yml b/.gitlab/server.gitlab-ci.yml index 30b257e7..5a7d2774 100644 --- a/.gitlab/server.gitlab-ci.yml +++ b/.gitlab/server.gitlab-ci.yml @@ -11,7 +11,7 @@ server:setup: expire_in: 15 min untracked: true cache: - key: "$CI_COMMIT_REF_SLUG" + key: '$CI_COMMIT_REF_SLUG' paths: - server/env script: @@ -20,12 +20,12 @@ server:setup: - cd server/ - python -m venv env - source env/bin/activate - - pip install -r requirements.txt + - pip install -r requirements-dev.txt server:test: image: python stage: test - needs: ["server:setup"] + needs: ['server:setup'] only: refs: - dev @@ -43,7 +43,7 @@ server:test: server:report: image: python stage: report - needs: ["server:test"] + needs: ['server:test'] only: refs: - merge_requests diff --git a/docs/source/installation/server.md b/docs/source/installation/server.md index 889c2465..2f047028 100644 --- a/docs/source/installation/server.md +++ b/docs/source/installation/server.md @@ -1,13 +1,21 @@ # Installing the server -It is recommended to use [Visual Studio Code](https://code.visualstudio.com/) to install and use the server, but it is not necessary. -In order to install the server, you will need to do the following: +The steps to install the server depend on if you are on Windows or Linux and if you are a developer or are running it in production. + +## Windows + +Clone the Git [repository](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system): + +```bash +git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system +cd ./teknikattan-scoring-system/ +``` Install [Python](https://www.python.org/downloads/). -Clone the git repository [teknikattan-scoring-system](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system). +Make sure `Python` is [installed properly](#running-python). -Open a terminal and navigate to the root of the cloned project. +Make sure `pip` is [installed properly](#running-pip). Install virtualenv and create a virtual environment: @@ -17,28 +25,127 @@ cd server py -m venv env ``` -Activate the virtual environment (which is done slightly differently on Windows and Linux/Mac): - -On Windows: +Activate the virtual environment: ```bash Set-ExecutionPolicy Unrestricted -Scope Process ./env/Scripts/activate ``` -On Linux/Mac: +Continue to [development and production](#development-and-production). + +## Linux (Ubuntu) + +Clone the Git [repository](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system): + +```bash +git clone https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system +cd ./teknikattan-scoring-system/ +``` + +Install [Python](https://www.python.org/downloads/). + +Make sure `Python` is [installed properly](#running-python). + +Install pip: + +```bash +sudo apt install python3-pip +``` + +Make sure `pip` is [installed properly](#running-pip). + +Install and create a Python virutal environment and activate it: ```bash +sudo apt install python3-venv +cd server +py -m venv env source env/bin/activate ``` -Lastly, install all project dependencies: +Continue to [development and production](#development-and-production). + +## Development and production + +Which dependencies you install will depend on if you are a developer or running the server in production. + +If running in production: ```bash pip install -r requirements.txt ``` +If you are a developer: + +```bash +pip install -r requirements-dev.txt +``` + You should now be ready to start the server. -Try it by running `python main.py` and navigate to `localhost:5000`. +Try it by running `py main.py` and navigate to `localhost:5000`. If everything worked as it should you should see a list of all available API calls. If you are using VS Code you can also start the server with the [task](../development/vscode.md) `start server`. + +## Common issues + +If you have any issues while installing, some of the things below might help. + +### Running Python + +Test that Python is installed properly: + +```bash +py --version +``` + +Make sure Python version > 3. +If it works, you should see something along the lines of: + +```bash +Python 3.9.4 +``` + +If `py` is not working, try one of the following instead: + +``` +py -3 +py3 +python +python3 +``` + +### Running pip + +Test that `pip` is installed properly: + +```bash +pip --version +``` + +Make sure pip is running with Python 3.x (not Python 2.x). +If everything works, it should look something along the lines of: + +``` +pip 20.2.3 from d:\home\workspace\teknikattan-scoring-system\server\env\lib\site-packages\pip (python 3.9) +``` + +If `pip` is not running with Python 3.x, try one of the following instead: + +``` +pip3 +py -m pip +``` + +If you still have trouble, try this [guide](https://pip.pypa.io/en/stable/installing/). + +### Problem: Failed building wheel for \<package\> when calling pip + +Run the following command before installing the requirements: + +``` +pip install wheel +``` + +This [guide](https://stackoverflow.com/questions/53204916/what-is-the-meaning-of-failed-building-wheel-for-x-in-pip-install) +can help you troubleshoot this problem further. diff --git a/server/README.md b/server/README.md index 8324c5d9..cf739ec9 100644 --- a/server/README.md +++ b/server/README.md @@ -63,6 +63,10 @@ pip install -r requirements.txt ``` +The last step is to install all the required packages. +If you are running it in production, run `pip install -r requirements.txt`. +But if you are a developer, run `pip install -r requirements-dev.txt`. + ## Common problems ### Make sure python 3 is running with the python command diff --git a/server/requirements-dev.txt b/server/requirements-dev.txt new file mode 100644 index 0000000000000000000000000000000000000000..78e0bc63cccd764964148bd7955a2f99df02ccca GIT binary patch literal 1618 zcmbW1&2H0B5QS%r#5?c;w&JAe&w>T4K|*51vUN>ju+ubl)0T$^&Nt&5JE>G8RNbWQ z%$zyr%-s9ucV;_#r&HOzJy`9(wfbvgy>*uB^GWBey|HU+bZ&Gy{ijmqd;QFmbD>k% ze8}3`)@~iC^Nd2#Ge3dS+nu$Fm-Z-(+Odu^X9H5N*iPN(GgpUPpSe1M^U=9f;uO)` zt`sXgcH>M-`#Gsxig`p!=iaOHcb%x72^l4*$ZhE;rLEOtCoPqDkcSGgf<Y-Ad&j!A zmA=VX9;$B@E#)YEnn6Q!ICu0~xEtXo_Qil&%bURKRQYSbJ=R{U694Y>jfRz@kP`=g zK-tLwcswdEQ(mvntvw%QhnChSmf~bJ;=WSNX2KnBE}eZV6p%9UV?Wpz_`)dWg;xAp z9P-&3km1#-V%(o%a2DRgnH(O_J+#Git{jVuUbE?xTPYU@>2|3T6He?`gVykUF^Nw- zAQ~=wQT|HKrR`6%VY4Cw%}K$OU1+@+_&vKL=mp_i)i`(dBAWRO_nt*YY~R?a*ZhM6 z`#H`Qp5N?)eYQ^?XY24f)N_~F$ETCp@eZcjUdcmldD1!e{SA~(-m^K}_r^DvDYx!U zOfDEFXTHjpwNEVi;&$+2s>~`yd2xE}Tc*#oW5(TK4phWDGOdVB=PjtkCle#ym`1hK zH~Jj~_yfkj>$%bU|Eyh$b*rA!&Nwk{(QC|q$O&#H%BP%@=c7xfn(qg<PSwW!daY;N qwc6*%ixPXAbR-tI7w=xY&+)FJikB(5`k)!G4a{M2P%!r$kLtfeLi3~m literal 0 HcmV?d00001 diff --git a/server/requirements.txt b/server/requirements.txt index bcb325f5f3a16a5ee0e655435923c38d8926b807..a8b73f433e1c0853e80d3ad9bb5ca72af77aeca7 100644 GIT binary patch delta 211 zcmX>i)x*W~|KCI(DMq8o+>FYTyO^{l>oF=!-o_{<Ys$dOz{QZvki(D(B(oW8fzX0M zkHG+l4JUIlsZY*h5}Pc?$~O59(-cO-$%V}EjK-5MGV8LMf>kiH6aqy*vII^(#p(t$ z|2eDtWCJz@Rx^+ple5`XC!b(fnasx_Gx-*W5>WmxhyG+MUM|UEpnVl!+YCYGFo4yA j+%owgvm`f2%mgfMI=P$2eewq$C7^o+c{SNUq6Q2ACZ;d- literal 3396 zcmbW4OK%%T5QOI(AU|adk+Nm^kV9-FK#Ul1q5wvY<Z4CI=1b(tGWFw=)YrAMv+Kw< z5D0uo-P2uNUEQ<#=kHlsr&*fobxdt)(jonzpR@ENJ=bfJrs@0iovhomlE*GxrVCjo z;q^iucuqQ>efaDZr4IX3*?1NEK3&V_ph#qyboQs+c@P|wV<j)_)6SkTw6bkvt<$~y zR)KdM>8y*?MkL#&f$?0iY<(H^HmW=4a2?b+SL{PNrM=E$<rFA<avsRYZ!5J=qY5LO z2bXpF&_%|6shF<+Rj@mc_qzcD&O!D%Y^}1~=w)<g%3zMc@hs}AWzQaPI0=@`Vx5+% z?;r-74kaBRf@`RSkqV5_J*Eoh-^seu>6v(*1p-dGkJ;m6pq!<JKEe1bJg{EtY@P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