Skip to content

Instantly share code, notes, and snippets.

@beminee
Last active March 29, 2021 03:45
Show Gist options
  • Save beminee/e1670f449d82c96bac55107c9c37da00 to your computer and use it in GitHub Desktop.
Save beminee/e1670f449d82c96bac55107c9c37da00 to your computer and use it in GitHub Desktop.

Ubuntu 16.04 Installation:

Installing prerequisites

sudo su
apt-get update
apt-get install default-jdk

Downloading the source and getting it ready

git clone https://github.com/ajanata/PretendYoureXyzzy.git
cd PretendYoureXyzzy
mv "build.properties.example" "build.properties"

now you might want to edit build.properties a bit;

nano build.properties

on line 13; you might want to add your own IP adress in order to be able to reach admin.jsp.

pyx.admin_addrs=ADD.YOUR.IP.ADRESS,127.0.0.1,0:0:0:0:0:0:0:1

you need to uncomment line 61 to 63 and comment 65 to 68. Also change

hibernate.url=jdbc:postgresql://localhost/pyx to hibernate.url=jdbc:postgresql://localhost/cah

60 # for production use, use postgres
61 hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
62 hibernate.driver_class=org.postgresql.Driver
63 hibernate.url=jdbc:postgresql://localhost/cah
64
65 # for local use, you can also use sqlite
66 # hibernate.dialect=net.socialgamer.cah.hibernate.SqliteDialect
67 # hibernate.driver_class=org.sqlite.JDBC
68 # hibernate.url=jdbc:sqlite:pyx.sqlite

then you need to set your password on line 72

# these likely need specified even with sqlite, even though they don't matter
hibernate.username=pyx
hibernate.password=PASSWORDHERE

Setting up the Tomcat Server

apt-get install tomcat7 tomcat7-admin

once all the installations have finished you will need to stop the tomcat service

service tomcat7 stop

next, you have to edit users file in order to add yourself an administrator account

sudo nano /etc/tomcat7/tomcat-users.xml

there, you might see tomcat-users tag. You need to add the following line inside of that tag, obviously replacing username and password with something you are comfortable with.

<user username="admin" password="password" roles="manager-gui,admin-gui"/>

Setting up the PostgreSQL

now we need to install PostgreSQL for our database.

apt-get install postgresql

switch to postgres user

sudo -i -u postgres

Then run the following by order, don't forget to replace information (username and password in build.properties should match these ones)

createdb cah
psql template1
CREATE USER pyx WITH PASSWORD 'PASSWORDHERE';
GRANT ALL PRIVILEGES ON DATABASE "cah" to pyx;
\q
exit

now, you finally can import .sql file

psql -h localhost -d cah -U pyx -f cah_cards.sql

Building and running the source

you need to install Maven package in order to build the source code

apt-get install maven

after the installation is done, it's time to build and run it

mvn clean package war:war -Dmaven.buildNumber.doCheck=false -Dmaven.buildNumber.doUpdate=false

you will get a file called ZY.war inside of the target file.

at this point, you need to start tomcat service back up

service tomcat7 start

afterwards, you need to go to: http://localhost:8080/manager/html/

login with information you set when you were editing the tomcat-users.xml file.

Then deploy the ZY.war

last thing to do is restarting the tomcat service:

service tomcat7 restart

then all you have to do is, go:

tomcat: http://localhost:8080/ZY/game.jsp

@MrKich
Copy link

MrKich commented Jul 30, 2018

I had issues in that a lot of the maven files required for build are using old googlecode URLs. I spent half the night manually downloading the poms and jars from the maven central repo into their proper respective directories in the local ~/.m2/repository repo.

if you could elaborate on any troubles with this, it may help, since I was having it happen on multiple machines. this even happened with a clean local repo. there was no way around it. the time spent was merciless but the fruits of my labor are glorious.

This fixes errors during jars download:

https://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty

@yugimutou92
Copy link

@vamtrok ca-certificates-java, linux mint just updated it and my problem is gone. weird.

@Yotus
Copy link

Yotus commented Jul 31, 2018

I've gotten my install working correctly, everything is fine over local network, but through my domain logging in isn't possible;

https://pyx.jess.pw/game.jsp I'm a bit stumped, has anyone else run into this?

@Koyyle
Copy link

Koyyle commented Aug 1, 2018

I always get this when I try to install tomcat7, when i press tab it goes straight to tomcat8, Could I have some help? (I'm new to linux and ubuntu.)
image

@NicoWde
Copy link

NicoWde commented Aug 2, 2018

@Koyyle are you using ubuntu 16.04?

@Yotus have you set up a reverse-proxy right to e.g. http://localhost/ZY ?

@Koyyle
Copy link

Koyyle commented Aug 3, 2018

No I'm using 18, Should I use 16.04?

@Seikatsuuna
Copy link

So do these instructions even work on windows, and if so how. I'm not the smartest when it comes to this stuff and I've been having a few issues, thanks in advance for any help.

@beminee
Copy link
Author

beminee commented Aug 4, 2018

@SeikatsuChan should work but you might need to improvise a bit (i.e install windows version of Tomcat & PostgreSQL & Maven)

@Toiwing
Copy link

Toiwing commented Aug 5, 2018

If I want to edit the game.jsp page to include my own Twitter feed and a few lines of text of my own like some of you have, where do I do that? @AstralBlader

@hory-portier
Copy link

hory-portier commented Aug 5, 2018

After doing everything with the only change in the port of Tomcat from 8080 to 8088. I opened Tomcat Web Application Manager and deployed ZY.war but it seems like there's some problem with it as I'm getting message "FAIL - Application at context path /ZY could not be started" while trying to start it.
Any ideas what could it be?

Added few days later: I'm still waiting for help. Anyone?

@ZVNexus
Copy link

ZVNexus commented Aug 8, 2018

Heyo! Having a bit of a problem where I can't connect to the server using my public IP.

I have port 8080 open but when I enter my public IP+ its port it fails to connect. From what I understand Cox is not blocking it, so what could it be?

@LordGoldfish
Copy link

LordGoldfish commented Aug 13, 2018

This guide works great even thru ubuntu in windows 10, but I can't get it to run outside och the host PC.
I can connect using:
localhost:8080/ZY/
127.0.0.1:8080/ZY/
LAN_IP_HERE:8080/ZY/
on the host PC, but when I try: LAN_IP_HERE:8080/ZY/ on another PC in my network I get a "connection timed out" message.
I've added both my LAN and WAN IP in build.properties
Is there anything I should do with Tomcat?

Edit:
I did done goof up. ('-_-)
It was all due to me forgetting a simple thing such as a firewall setting.

Thanks for this detailed guide!

@SudosFTW
Copy link

@Koyyle it will run on tomcat8 just fine on modern Ubuntu.

@darkpegasus333
Copy link

darkpegasus333 commented Sep 4, 2018

I absolutely cannot get Tomcat to run on my system. It can't find java

Edit: Nevermind, got that working. Now the cards won't load...not sure where I screwed up.

@TehJawknee
Copy link

Is there a certain setting I can change if I want to set my blank card limit higher? With thousands of cards added to the cardcast stack, my games rarely get blank cards in them.

@dheimerl
Copy link

the src/main/java/net/socialgamer/cah/data/GameOptions.java has this line
public static final int MAX_BLANK_CARD_LIMIT = 30;

Change that to what you want the limit to be for blank cards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment