Format buildscripts (pretty unsubstantial but needed to happen :3)

This commit is contained in:
Elizabeth Hunt 2023-02-11 23:37:47 -07:00
parent e5ac660413
commit 7568b61444
Signed by: simponic
GPG Key ID: 52B3774857EB24B1
9 changed files with 72 additions and 71 deletions

View File

@ -167,7 +167,7 @@ function build_server_nodes() {
copy_ssh_keys copy_ssh_keys
for node_id in "${server_node_ids[@]}" for node_id in "${server_node_ids[@]}"
do do
build_server $node_id build_server $node_id &
done done
} }

View File

@ -23,8 +23,8 @@ server {
# Grab deps # Grab deps
if [ $(which node) == "" ] if [ $(which node) == "" ]
then then
curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt install -y nodejs sudo apt install -y nodejs
fi fi
[ "$(which git)" != "" ] || sudo apt install -y git [ "$(which git)" != "" ] || sudo apt install -y git
[ "$(which nginx)" != "" ] || sudo apt install -y nginx [ "$(which nginx)" != "" ] || sudo apt install -y nginx
@ -32,16 +32,16 @@ fi
# Checkout source # Checkout source
if [ ! -d $chessh_path ] if [ ! -d $chessh_path ]
then then
mkdir -p $chessh_path mkdir -p $chessh_path
cd $chessh_path cd $chessh_path
git init git init
git remote add origin $chessh_source git remote add origin $chessh_source
git pull origin git pull origin
git checkout main git checkout main
git config pull.rebase true git config pull.rebase true
else else
cd $chessh_path cd $chessh_path
git pull origin main git pull origin main
fi fi
# Build # Build

View File

@ -9,22 +9,22 @@ chessh_path="$HOME/src/chessh"
[ "$(which git)" != "" ] || sudo apt install -y git [ "$(which git)" != "" ] || sudo apt install -y git
if [ "$(which docker)" = "" ] if [ "$(which docker)" = "" ]
then then
curl -sSL https://get.docker.com | sh curl -sSL https://get.docker.com | sh
fi fi
# Checkout source # Checkout source
if [ ! -d $chessh_path ] if [ ! -d $chessh_path ]
then then
mkdir -p $chessh_path mkdir -p $chessh_path
cd $chessh_path cd $chessh_path
git init git init
git remote add origin $chessh_source git remote add origin $chessh_source
git pull origin git pull origin
git checkout main git checkout main
git config pull.rebase true git config pull.rebase true
else else
cd $chessh_path cd $chessh_path
git pull origin main git pull origin main
fi fi
# Build # Build

View File

@ -7,7 +7,7 @@ export $(cat $env_file | xargs)
docker build ../.. -t chessh/server docker build ../.. -t chessh/server
docker build \ docker build \
--build-arg REACT_APP_DISCORD_OAUTH=${REACT_APP_DISCORD_OAUTH} \ --build-arg REACT_APP_DISCORD_OAUTH=${REACT_APP_DISCORD_OAUTH} \
--build-arg REACT_APP_SSH_SERVER=${REACT_APP_SSH_SERVER} \ --build-arg REACT_APP_SSH_SERVER=${REACT_APP_SSH_SERVER} \
--build-arg REACT_APP_SSH_PORT=${REACT_APP_SSH_PORT} \ --build-arg REACT_APP_SSH_PORT=${REACT_APP_SSH_PORT} \
../../front -t chessh/frontend ../../front -t chessh/frontend

View File

@ -8,50 +8,50 @@ container_names=("chessh-redis" "chessh-database" "chessh-server" "chessh-fronte
export $(cat $env_file | xargs) export $(cat $env_file | xargs)
for name in ${container_names[@]}; do for name in ${container_names[@]}; do
docker stop $name docker stop $name
docker rm $name docker rm $name
done done
docker network ls | grep -q $project_name || docker network create --driver bridge $project_name docker network ls | grep -q $project_name || docker network create --driver bridge $project_name
docker volume ls | grep -q $project_name-redisdata || docker volume create $project_name-redisdata docker volume ls | grep -q $project_name-redisdata || docker volume create $project_name-redisdata
docker run \ docker run \
-d \ -d \
--restart unless-stopped \ --restart unless-stopped \
--env-file $env_file \ --env-file $env_file \
--network $project_name \ --network $project_name \
--name $project_name-redis \ --name $project_name-redis \
--net-alias redis \ --net-alias redis \
--volume $project_name-redisdata:/data/ \ --volume $project_name-redisdata:/data/ \
redis redis
docker volume ls | grep -q $project_name-pgdata || docker volume create $project_name-pgdata docker volume ls | grep -q $project_name-pgdata || docker volume create $project_name-pgdata
docker run \ docker run \
-d \ -d \
--restart unless-stopped \ --restart unless-stopped \
--env-file $env_file \ --env-file $env_file \
--network $project_name \ --network $project_name \
--name $project_name-database \ --name $project_name-database \
--net-alias database \ --net-alias database \
--volume $project_name-pgdata:/var/lib/postgresql/data/ \ --volume $project_name-pgdata:/var/lib/postgresql/data/ \
postgres postgres
docker run \ docker run \
-d \ -d \
--restart unless-stopped \ --restart unless-stopped \
--env-file $env_file \ --env-file $env_file \
--network $project_name \ --network $project_name \
--name $project_name-server \ --name $project_name-server \
--publish "${HOST}:${SSH_PORT}:${SSH_PORT}/tcp" \ --publish "${HOST}:${SSH_PORT}:${SSH_PORT}/tcp" \
--net-alias server \ --net-alias server \
chessh/server chessh/server
docker run \ docker run \
-d \ -d \
--restart unless-stopped \ --restart unless-stopped \
--env-file $env_file \ --env-file $env_file \
--network $project_name \ --network $project_name \
--name $project_name-frontend \ --name $project_name-frontend \
--publish "${HOST}:${WEB_PORT}:80/tcp" \ --publish "${HOST}:${WEB_PORT}:80/tcp" \
--net-alias frontend \ --net-alias frontend \
chessh/frontend chessh/frontend

View File

@ -17,6 +17,9 @@ export const Root = () => {
</Link> </Link>
</div> </div>
<div className="nav"> <div className="nav">
<Link className="link" to="/man-pages">
Man Pages
</Link>
{signedIn ? ( {signedIn ? (
<> <>
<Link className="link" to="/home"> <Link className="link" to="/home">
@ -42,9 +45,6 @@ export const Root = () => {
</a> </a>
</> </>
)} )}
<Link className="link" to="/man-pages">
Man Pages
</Link>
</div> </div>
</div> </div>
<div className="content"> <div className="content">

View File

@ -3,11 +3,10 @@ import { Link } from "react-router-dom";
import { useAuthContext } from "../context/auth_context"; import { useAuthContext } from "../context/auth_context";
const generateSSHConfig = (username) => ` const generateSSHConfig = (username) => `Host chessh
Host chessh
Hostname ${process.env.REACT_APP_SSH_SERVER} Hostname ${process.env.REACT_APP_SSH_SERVER}
Port ${process.env.REACT_APP_SSH_PORT} Port ${process.env.REACT_APP_SSH_PORT}
User "${username}" User ${username.includes(" ") ? '"' + username + '"' : username}"
PubkeyAuthentication yes PubkeyAuthentication yes
`; `;

View File

@ -56,7 +56,7 @@ export const ManPages = () => {
<ul> <ul>
<li>Ctrl + b / Escape to return to the main menu.</li> <li>Ctrl + b / Escape to return to the main menu.</li>
<li>Ctrl + c / Ctrl + d to exit CheSSH at any point.</li> <li>Ctrl + c / Ctrl + d to exit CheSSH at any point.</li>
<li>Arrow keys / vim keybinds to move around the board.</li> <li>Arrow keys / hjkl keybinds to move around the board.</li>
<li> <li>
Select a piece with "enter", and move it to a square by pressing Select a piece with "enter", and move it to a square by pressing
"enter" again. "enter" again.

View File

@ -21,13 +21,15 @@ defmodule Chessh.DiscordNotifier do
@impl true @impl true
def handle_info({:attempt_notification, notification} = body, state) do def handle_info({:attempt_notification, notification} = body, state) do
[discord_notification_rate, discord_notification_rate_ms] = [discord_notification_rate, discord_notification_rate_ms, reschedule_delay] =
Application.get_env(:chessh, RateLimits) Application.get_env(:chessh, RateLimits)
|> Keyword.take([:discord_notification_rate, :discord_notification_rate_ms]) |> Keyword.take([
:discord_notification_rate,
:discord_notification_rate_ms,
:reschedule_delay
])
|> Keyword.values() |> Keyword.values()
reschedule_delay = Application.get_env(:chessh, RateLimits)[:reschedule_delay]
case Hammer.check_rate_inc( case Hammer.check_rate_inc(
:redis, :redis,
"discord-rate", "discord-rate",