Skip to content
Snippets Groups Projects
Commit 369f99fd authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

docs: update readme

parent 9c39d29d
No related branches found
No related tags found
No related merge requests found
# Ötzi
# Oetzi Words This is a web-based typing game.
### Requirements ## Backend
- Mysql The backend is a `fastify` webserver exposing some APIs.
- Tomcat 8.5
- Java 8
- Maven
- NodeJS with Npm or Yarn
*Tested with tomacat 8.5.72 NodeJs v14.18.0 Java 1.8.0_241* To spin it up for development,
### Getting Started ```bash
cd backend
npm install
npm exec knex migrate:latest
npm exec knex seed:run
PORT=8080 npm run watch
```
Setup your mysql server and load the sql structure dump with : The webserver will be abailable at `http://localhost:8080`.
## Frontend
mysql -u a_valid_user -p < oetzi_words.sql The frontend is a `phaser` webapp built `parcel`.
Setup Apache Tomcat server with: To spin it up for development,
```bash
cd frontend
npm install
npm run start
```
curl -LO https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.72/bin/apache-tomcat-8.5.72.tar.gz Also, remember to
tar -xvf apache-tomcat-8.5.72.tar.gz
Change line 63/64 of main.js file in src/js folder by switching the comment.
This operation permits the ui to call the backend at `http://localhost:8080/oetzi_words/` instead of to the relative path.
### Run Release The webapp will be abailable at `http://localhost:1234`.
Download relase from github and copy `OetziWords.war` in the webapps folder of your apache tomcat installation.
Run the server with:
apache-tomcat-8.5.72/bin/startup.sh
Wait ~20 secs and shutdown th server with
apache-tomcat-8.5.72/bin/shutdown.sh
Now edit the `config.prop` in `apache-tomcat-8.5.72/webapps/OetziWords/WEB-INF` and write the correct parameters for your installation db host, db user, db password and and path to the image folder. Save the file and restart the server. Done.
Go to `http://localhost:8080/OetziWords/`
#### Attention !!! The mysql server must be started before of the tomcat server
### Make a release from code
Clone this repo with
git clone https://github.com/commul/oetzi.git
go to oezti folder `cd oetzi` and make the `war` package with
mvn package
You will find the war file in the target folder
### Working on the game UI on a separete server
First you need to configure your tomcat in order to accept cross origin connection
Edit the web.xml file in the `apache-tomcat-8.5.72/conf` and add the cors filter adding the lines to the file before the Default session configuration section
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Restart your tomcat server
Got to the `oetzi_game` folder in the repository repository clone
and install javascript dependencies with
`yarn install` or `npm install`
Change line 63/64 of main.js file in src/js folder by switching the comment.
This operation permits the ui to call the backend at `http://localhost:8080/oetzi_words/` instead of to the relative path.
Run the game ui with
`yarn run start` or `npm run start`
Now the game runs at `http://localhost:1234`
### Update the webapp ui
If you want to update the game ui in the tomcat backend switch again the comment on line 63/64 and run
`yarn run deploy` or `npm run deploy`
Make new web archive with `mvn packge` in the root folder of the repository and copy the new `war` file in the webapps folder of tomcat, wait the refresh the url `http://localhost:8080/OetziWords/`
### Repository content
- oetzi_game folder (game ui code)
- oetzi_words_image folder (sample set of images)
- OetziWordsSupportData.tar.gz file (file containing sprites, images used in game development)
- oetzi_words.sql file (dump of the database structure)
- src folder (code of the tomcat web application)
- pom.xml (maven project definition file)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment