From b90860f2516d58f471b6c901437bc0558c2efeb7 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Sat, 27 Jan 2018 17:26:47 -0600 Subject: [PATCH] client - add error message if user account does not have battletag --- README.md | 54 +++++++++++++++++++ client/.gitignore | 4 +- client/app/pages/oauth/oauth.tsx | 22 ++++++-- .../app/pages/user-account/user-account.tsx | 5 +- config/prod.secret.exs.template | 1 + makefile | 2 +- 6 files changed, 79 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 21b1fbc..c667df9 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ mix local.hex - Check out `.exguard.exs` for configuration. # Postgres setup +[Setup on Centos7](https://linode.com/docs/databases/postgresql/how-to-install-postgresql-relational-databases-on-centos-7/) + Change password to postgres user ``` sudo -u user_name psql db_name @@ -120,3 +122,55 @@ https://localhost { } } ``` + +# Hosting on Vultr + +### Centos setup from scratch +[Enable private networking](https://www.vultr.com/docs/configuring-private-network) +``` +/etc/sysconfig/network-scripts/ifcfg-eth1 + +DEVICE=eth1 +ONBOOT=yes +NM_CONTROLLED=no +BOOTPROTO=static +IPADDR= +NETMASK= +IPV6INIT=no + MTU=1450 +``` + +Disable firewalld (make sure firewall is enabled in vultr config) +``` +systemctl disable firewalld +``` + +Install and start postgresql +``` +sudo yum install postgresql-server postgresql-contrib +sudo postgresql-setup initdb +sudo systemctl start postgresql +sudo systemctl enable postgresql +``` + +Configure user +``` +sudo passwd postgres +su postgres +psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';" +``` + + +Allow connections on all interfaces +``` +/var/lib/pgsql/data/postgresql.conf + +listen_address='*' +``` + +``` +/var/lib/pgsql/data/pg_hba.conf + +host all all 0.0.0.0/0 md5 +``` + diff --git a/client/.gitignore b/client/.gitignore index 4a5cc83..04bf3f5 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,4 +1,6 @@ .vscode node_modules yarn-error* -dist \ No newline at end of file +dist +prod_ssh_key +copy_build_prod.sh diff --git a/client/app/pages/oauth/oauth.tsx b/client/app/pages/oauth/oauth.tsx index ea2304f..a576f40 100644 --- a/client/app/pages/oauth/oauth.tsx +++ b/client/app/pages/oauth/oauth.tsx @@ -1,13 +1,22 @@ import React from 'react'; import { RouteComponentProps } from 'react-router-dom'; import { parse } from 'query-string'; +import { ContentContainer } from '../../components'; import { UserService } from '../../services'; interface Props extends RouteComponentProps {} -interface State {} +interface State { + errorMessage?: string; +} export class Oauth extends React.Component { + + constructor(props: Props) { + super(props); + this.state = {}; + } + componentDidMount() { this.login(this.props.location.search); } @@ -17,14 +26,19 @@ export class Oauth extends React.Component { const code = parse(queryString).code; await UserService.authorize(code); window.opener.location.reload(); - // TODO: this doesn't work on mobile currently window.close(); } catch (e) { - console.error(e); + this.setState({ + errorMessage: 'Unable to log in. Your account may not be in the right region, or you may not have set a battletag.', + }); } } render() { - return
; + return ( + + {this.state.errorMessage} + + ); } } diff --git a/client/app/pages/user-account/user-account.tsx b/client/app/pages/user-account/user-account.tsx index 473b387..f372429 100644 --- a/client/app/pages/user-account/user-account.tsx +++ b/client/app/pages/user-account/user-account.tsx @@ -198,9 +198,8 @@ export class UserAccount extends React.Component { {noCharacters && } diff --git a/config/prod.secret.exs.template b/config/prod.secret.exs.template index 64c2179..d00233d 100644 --- a/config/prod.secret.exs.template +++ b/config/prod.secret.exs.template @@ -14,6 +14,7 @@ config :myapp, MyAppWeb.Endpoint, # Configure your database config :myapp, MyApp.Repo, adapter: Ecto.Adapters.Postgres, + hostnamae: "localhost", username: "postgres", password: "postgres", database: "myapp_prod", diff --git a/makefile b/makefile index 360a10e..9fa3e6e 100644 --- a/makefile +++ b/makefile @@ -6,6 +6,6 @@ build-client: cd client && yarn install && yarn run build build-server: - mix deps.get && MIX_ENV=prod mix release --env=prod + MIX_ENV=prod mix deps.get && MIX_ENV=prod mix release --env=prod all: clean build-client build-server