Closed Vijay-1979 closed 8 years ago
Sure, I will update the group matches shortly after their results are online. Then, you will get points according to your bets.
Great. But we have very old server, so it can´t run node.js Is there any other way to use this?
Sure, I will update the group matches shortly after their results are online. Then. you will get points according to your bets.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/syxolk/euro2016/issues/8#issuecomment-221255152
wetten2016.de is installed on an EC2 instance at Amazon which is free for the first year (including an PostgreSQL Server)
Hi. Thanks for the info. I have created a virtual Server on Amazon. But do you have a quick guide to for further prosess on how to install?
wetten2016.dehttp://wetten2016.de is installed on an EC2 instance at Amazonhttp://aws.amazon.com/ which is free for the first year (including an PostgreSQL Server)https://aws.amazon.com/free/faqs/?nc1=h_ls
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/syxolk/euro2016/issues/8#issuecomment-221348684
wetten2016.de is installed on an EC2 instance at Amazon which is free for the first year (including an PostgreSQL Server)
I installed your app on an EC2 instance with nodejs and postgresql and I get an error on first run (see below). I must be doing something wrong.
_/home/ec2-user/euro2016/routes/login.js:16
where: {email}
^
SyntaxError: Unexpected token }
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/home/ec2-user/euro2016/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at module.exports (/home/ec2-user/euro2016/routes/index.js:2:5)
at Object.
I used an Amazon Linux AMI and did the following:
_sudo yum update sudo yum install -y nginx git sudo yum install -y --enablerepo=epel npm sudo npm install -g forever sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs sudo service postgresql initdb sudo service postgresql start sudo -u postgres psql postgres postgres=# \password postgres postgres=# CREATE DATABASE euro2016; postgres=# CREATE USER lukaku password 'origi'; postgres=# GRANT ALL ON DATABASE euro2016 TO lukaku; postgres=# \q git clone https://github.com/syxolk/euro2016.git cd euro2016 npm install sudo npm install -g bower cp template.config.coffee config.coffee nano config.coffee
db: 'postgres://lukaku:origi@localhost:5432/euro2016'
node index.js_
Any hints?
What is your nodejs version? node --version
You need something up to date, since I am using ES2015.
node --version
v0.10.42
You need at least 4.x
Thanks, I hadn't paid attention to that while installing nodejs. How do I install the latest nodejs on my instance? Disclaimer: not a real programmer, just a hobbyist :)
Have you tried this: https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
Thanks for the hint! I tried that but I got an error while adding the repo:
curl -sL https://rpm.nodesource.com/setup_6.x | bash -
...
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.l5LK0adQWr'
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
Error executing command, exiting_
Didn't have enough rights so ran as root:
sudo -s
curl -sL https://rpm.nodesource.com/setup_6.x | bash -
yum install -y nodejs
Still no luck as he is complaining about conflicts with files:
file /usr/lib/node_modules/npm/bin/npm from install of nodejs-6.2.0-1nodesource.el7.centos.x86_64 conflicts with file from package npm-1.3.6-5.el6.noarch
...
Probably need to remove the previous version first?
I managed to update nodejs. From root directory as superuser:
yum remove node*
curl -sL https://rpm.nodesource.com/setup_6.x | bash -
yum install -y nodejs
node -v
v6.2.0
Getting another error now. I guess we're making progress :)
node index.js
_/home/ec2-user/euro2016/node_modules/bcrypt/node_modules/bindings/bindings.js:83 throw e ^
Error: Module did not self-register.
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (/home/ec2-user/euro2016/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at bindings (/home/ec2-user/euro2016/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
at Object.
you may need (sry)sudo
sudo gets me the same error. How is your setup different from mine? Maybe that could lead us in some direction.
This bcrypt module gets compiled by npm. You should not get any errors when doing npm install
.
Otherwise install gcc/g++
How silly of mine:
rm -rf node_modules/
npm install
Now postgresql is throwing up errors:
Unhandled rejection SequelizeConnectionError: Ident authentication failed for user "lukaku"
at /home/ec2-user/euro2016/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:101:20
...
I'll take a look at my pg_hba.conf
and pg_ident.conf
files tomorrow. I think I forgot something during postgresql setup. Thanks for helping out! I'll return tomorrow evening and if everything works out I'll write a howto.
Either you change the Sequelize connection string to use the ident authentification (I've never tried this) or you change Postgres to allow logins via password from localhost.
Thank you for contributing :smiley:
I edited pg_hba.conf
at this location:
sudo nano /var/lib/pgsql9/data/pg_hba.conf
local all all trust
host all 127.0.0.1/32 trust
Restarted postgres afterwards:
service postgresql restart
node index.js
seems to do its job!
Getting SQL commands from db setup and this message at the end:
Visit http://localhost:8080
Can't get the app to show up in my browser though. What am I missing?
If you are running this on the Amazon EC2 instance you have to open port 8080.
It's working! But... the lay-out and images aren't displaying. Everything is in plain html.
Added this rule to AWS Security Groups pane to allow inbound http traffic:
HTTP TCP 80 0.0.0.0/0
Edited sysctl.conf
to allow port forwarding:
sudo nano /etc/sysctl.conf
net.ipv4.ip_forward 1
sudo sysctl -p /etc/sysctl.conf
Added necessary rules to iptables:
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
I'm starting to get the hang of this :)
Change the setting origin: 'http://localhost:8080'
in your config.coffee
file to the server's IP address.
You could also open your browser's developer tools (usually with F12
), open the 'Network' tab and look for 404 responses
Thanks! I was thinking in that direction and changed that value in config.coffee. Things got a bit messy with conflicting ports so I decided to restart the server.
Now I get these db errors:
_Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432
at /home/ec2-user/euro2016/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:89:20
at .
The db conncetion worked flawlessly before?
Nevermind, I forgot to start postgresql again and I had to put in the iptables prerouting again :)
The ip address matches the one in config.coffee but I'm still not getting any lay-out.
I'll do some inspecting in my browser.
Upon inspection these files are missing: /bootstrap-social/bootstrap-social.css /bootstrap/dist/css/bootstrap-theme.min.css /bootstrap/dist/css/bootstrap.min.css /bootstrap/dist/js/bootstrap.min.js /font-awesome/css/font-awesome.min.css /jquery/dist/jquery.min.js
How to fix this? So close :)
Did you do bower install
?
I would swear I did, but running bower install
again did the trick! Everything seems to be working.
Only issue I have is that nodejs stops when I exit terminal. How can I prevent that?
Login doesn't work either because of recaptcha settings. I'll figure it out tomorrow.
Thanks again!
Only issue I have is that nodejs stops when I exit terminal. How can I prevent that?
Discovered forever start
. Nice!
Login doesn't work either because of recaptcha settings. I'll figure it out tomorrow.
Got recaptcha working.
Mailgun setup tomorrow because I need my own domain name for that. Yeey :)
I was able to log in to my site, but I can't bet on matches. The /me page only displays my username and "Score 0, Ranking 1".
This resets the database and adds all Euro 2016 matches: node tools/populate.js tools/euro2016.json
Thanks, that did the trick! Had to register again but that was no biggie :)
Just a few questions:
Will new matches be added automatically after the group stage?
Nope, I didn't find any good (and free) API for this
When will participants be able to bet on new matches in further stages?
Users can bet on matches at the time when they get created in the datebase.
How do you login as admin or "game master" to exclude users?
There is currently no real exclude functionality. You can just delete the user from the database. This will delete all his bets automatically. But there is an admin panel at example.com/admin
. You need to give yourself admin rights before in table User
, column admin
. Set it to true
for your own user id. You can use pgadmin for this.
How does the news section work?
You can publish news in the admin panel. Adding matches or setting match results will automatically generate news.
Hi. Great code. I was wondering if you are going to update it further, when the group matches are finished?