init db and socket changes for prod

This commit is contained in:
ntr 2018-10-23 17:50:53 +11:00
parent f2c8213255
commit a3eab9dc79
2 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,8 @@ const cbor = require('borc');
const actions = require('./actions');
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'ws://cryps.gg:40000' : 'ws://localhost:40000';
function errorToast(err) {
console.error(err);
return toast({
@ -21,7 +23,7 @@ function createSocket(store) {
let gameStateTimeout;
function connect() {
ws = new WebSocket('ws://localhost:40000');
ws = new WebSocket(SOCKET_URL);
ws.binaryType = 'arraybuffer';
// Connection opened

View File

@ -1,11 +1,11 @@
#!/bin/bash
sudo apt-get install -y postgresql postgresql-contrib
# sudo apt-get install -y postgresql postgresql-contrib
sudo service postgresql start
sudo -u postgres dropdb cryps
sudo -u postgres createdb cryps
sudo -u postgres echo "craftbeer" > /var/lib/postgres/.pgpass
sudo -u postgres createuser --encrypted cryps
sudo -u postgres psql -c "alter user cryps with encrypted password 'craftbeer';"
npm i
npm run migrate