nginx setup and make
This commit is contained in:
parent
264d368351
commit
fac62329e8
22
bin/build.sh
22
bin/build.sh
@ -5,9 +5,13 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
MNML_PATH=$(realpath "$DIR/../")
|
||||
|
||||
if [ ! -f $MNML_PATH/etc/mnml.env ]; then
|
||||
echo "create an env file in $MNML_PATH/etc/mnml.env"
|
||||
echo "see $MNML_PATH/etc/mnml.SAMPLE.env for details"
|
||||
exit 1;
|
||||
echo "-----------------------------------------------"
|
||||
echo "creating an env file in $MNML_PATH/etc/mnml.env"
|
||||
echo "-----------------------------------------------"
|
||||
|
||||
echo "export MNML_USER=\"$(whoami)\"" >> $MNML_PATH/etc/mnml.env
|
||||
echo "export MNML_PG_PASSWORD=\"$(openssl rand -base64 16)\"" >> $MNML_PATH/etc/mnml.env
|
||||
echo "export MNML_PG_HOST=\"localhost\"" >> $MNML_PATH/etc/mnml.env
|
||||
fi
|
||||
|
||||
source $MNML_PATH/etc/mnml.env
|
||||
@ -40,18 +44,22 @@ sudo -u postgres psql -c "alter user mnml with encrypted password '$MNML_PG_PASS
|
||||
cd $MNML_PATH/ops && npm run migrate
|
||||
|
||||
# RUST SETUP
|
||||
echo "DATABASE_URL=postgres://mnml:$MNML_PG_PASSWORD@$MNML_PG_HOST/mnml" > $MNML_PATH/server/.env
|
||||
# cargo build
|
||||
# cp -r $MNML_PATH/server/target/release /opt/mnml/bin
|
||||
|
||||
# NGINX
|
||||
if [ ! -f $MNML_PATH/etc/nginx/sites-available/mnml.gg.nginx.conf ]; then
|
||||
echo "create an env file in $MNML_PATH/etc/nginx/sites-available/mnml.gg.nginx.conf"
|
||||
echo "see $MNML_PATH/etc/nginx/sites-available/mnml.gg.DEV.nginx.conf for details"
|
||||
exit 1;
|
||||
echo "-----------------------------------------------"
|
||||
echo "using development nginx config"
|
||||
echo "$MNML_PATH/etc/nginx/sites-available/mnml.gg.nginx.conf"
|
||||
echo "-----------------------------------------------"
|
||||
|
||||
cp $MNML_PATH/etc/nginx/sites-available/mnml.gg.DEV.nginx.conf $MNML_PATH/etc/nginx/sites-available/mnml.gg.nginx.conf
|
||||
fi
|
||||
|
||||
sudo cp $MNML_PATH/etc/nginx/sites-available/mnml.gg.nginx.conf /etc/nginx/sites-available
|
||||
sudo ln -nfs /etc/nginx/sites-available/mnml.gg.nginx.conf /etc/nginx/sites-enabled/mnml.gg.nginx.conf
|
||||
cd $MNML_PATH/client && npm run build
|
||||
# cd $MNML_PATH/client && npm run build
|
||||
|
||||
sudo service nginx restart
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "parcel watch index.html --out-dir /var/lib/mnml/public",
|
||||
"start": "parcel watch index.html --out-dir /var/lib/mnml/public/dist",
|
||||
"anims": "parcel animations.html --host 0.0.0.0 --port 40080 --no-source-maps",
|
||||
"build": "parcel build index.html --out-dir /var/lib/mnml/public",
|
||||
"build": "parcel build index.html --out-dir /var/lib/mnml/public/dist",
|
||||
"scss": "node-sass --watch assets/scss -o assets/styles",
|
||||
"lint": "eslint --fix --ext .jsx src/",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
@ -7,7 +7,7 @@ const actions = require('./actions');
|
||||
const { TIMES } = require('./constants');
|
||||
const { getCombatSequence } = require('./utils');
|
||||
|
||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost:40000/api/ws';
|
||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost/api/ws';
|
||||
|
||||
function createSocket(store) {
|
||||
let ws = null;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const toast = require('izitoast');
|
||||
const cbor = require('borc');
|
||||
|
||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost:40000/api/ws';
|
||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost/api/ws';
|
||||
|
||||
function errorToast(err) {
|
||||
console.error(err);
|
||||
|
||||
@ -352,11 +352,9 @@ const removeTier = skill => {
|
||||
return skill;
|
||||
};
|
||||
|
||||
|
||||
const SERVER = process.env.NODE_ENV === 'production' ? '/api/' : 'http://localhost:40000/api';
|
||||
function postData(url = '/', data = {}) {
|
||||
// Default options are marked with *
|
||||
return fetch(`${SERVER}${url}`, {
|
||||
return fetch(`/api${url}`, {
|
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
// mode: 'no-cors', // no-cors, cors, *same-origin
|
||||
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
|
||||
@ -379,7 +377,6 @@ module.exports = {
|
||||
getCombatSequence,
|
||||
getCombatText,
|
||||
postData,
|
||||
SERVER,
|
||||
NULL_UUID,
|
||||
STATS,
|
||||
COLOURS,
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
error_log /var/log/nginx/mnml.nginx.log debug;
|
||||
|
||||
upstream mnml {
|
||||
server 127.0.0.1:40000;
|
||||
}
|
||||
@ -9,10 +11,9 @@ map $http_upgrade $connection_upgrade {
|
||||
|
||||
# DEV
|
||||
server {
|
||||
root /var/lib/mnml/public/;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
root /var/lib/mnml/public/dist;
|
||||
index index.html;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
|
||||
23
ops/migrations/20190709132153_mtx.js
Normal file
23
ops/migrations/20190709132153_mtx.js
Normal file
@ -0,0 +1,23 @@
|
||||
exports.up = async knex => {
|
||||
await knex.schema.createTable('mtx', table => {
|
||||
table.uuid('id')
|
||||
.primary();
|
||||
|
||||
table.uuid('account')
|
||||
.notNullable()
|
||||
.index();
|
||||
|
||||
table.foreign('account')
|
||||
.references('id')
|
||||
.inTable('accounts')
|
||||
.onDelete('RESTRICT');
|
||||
|
||||
table.string('variant')
|
||||
.notNullable()
|
||||
.index();
|
||||
|
||||
table.timestamps(true, true);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async () => {};
|
||||
@ -231,7 +231,8 @@ pub fn account_create(name: &String, password: &String, code: &String, tx: &mut
|
||||
None => return Err(err_msg("account not created")),
|
||||
};
|
||||
|
||||
for _i in 0..3 {
|
||||
// 3 constructs for a team and 1 to swap
|
||||
for _i in 0..4 {
|
||||
construct_spawn(tx, ConstructSpawnParams { name: generate_name() }, id)?;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user