Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed namespace from Teiserver to Barserver #212

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Teiserver
# Barserver

An Elixir middleware server for game management; primarily used by [Beyond all Reason](https://www.beyondallreason.info/). Currently implementing the Spring protocol but with work being done on a new protocol [Tachyon](https://github.com/beyond-all-reason/tachyon).

Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- Added `Communication.use_discord?/1` to make it easier to not make discord calls in dev
- Unit tests for microblog system
- Converted some tests for old pages into the new liveview pages
- Moved nearly all of the `Central` stuff over to be part of Teiserver
- Moved nearly all of the `Central` stuff over to be part of Barserver
- Started making progress on
- Added `hms_or_hms_ymd` format to `TimexHelper`
- Added framework for adding more discord commands
Expand Down
64 changes: 32 additions & 32 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@ import Config
config :iex,
ansi_enabled: true

config :teiserver, Teiserver,
config :teiserver, Barserver,
site_title: "BAR",
site_suffix: "",
site_description: "",
site_icon: "fa-duotone fa-robot",
credit: "Teifion Jordan"

# Default configs
config :teiserver, Teiserver.Config,
config :teiserver, Barserver.Config,
defaults: %{
tz: "UTC"
}

config :teiserver,
ecto_repos: [Teiserver.Repo]
ecto_repos: [Barserver.Repo]

# Configures the endpoint
config :teiserver, TeiserverWeb.Endpoint,
config :teiserver, BarserverWeb.Endpoint,
url: [host: "localhost"],
# This is overriden in your secret config, it's here only to allow things to run easily
secret_key_base: "6FN12Jv4ZITAK1fq7ehD0MTRvbLsXYWj+wLY3ifkzzlcUIcpUJK7aG/ptrJSemAy",
live_view: [signing_salt: "wZVVigZo"],
render_errors: [
formats: [html: TeiserverWeb.ErrorHTML, json: TeiserverWeb.ErrorJSON],
formats: [html: BarserverWeb.ErrorHTML, json: BarserverWeb.ErrorJSON],
layout: false
],
pubsub_server: Teiserver.PubSub
pubsub_server: Barserver.PubSub

config :esbuild,
version: "0.14.41",
Expand All @@ -40,7 +40,7 @@ config :esbuild,
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]

config :teiserver, Teiserver,
config :teiserver, Barserver,
ports: [
tcp: 8200,
tls: 8201,
Expand All @@ -63,8 +63,8 @@ config :teiserver, Teiserver,
game_name_short: "Game",
main_website: "https://site.com/",
discord: nil,
default_spring_protocol: Teiserver.Protocols.Spring,
default_tachyon_protocol: Teiserver.Protocols.Tachyon.V1.Tachyon,
default_spring_protocol: Barserver.Protocols.Spring,
default_tachyon_protocol: Barserver.Protocols.Tachyon.V1.Tachyon,
github_repo: "https://github.com/beyond-all-reason/teiserver",
enable_discord_bridge: false,
enable_coordinator_mode: true,
Expand Down Expand Up @@ -102,58 +102,58 @@ config :logger, :console,
config :phoenix, :json_library, Jason

# This secret key is overwritten in prod.secret.exs
config :teiserver, Teiserver.Account.Guardian,
config :teiserver, Barserver.Account.Guardian,
issuer: "teiserver",
# This is overriden in your secret config, it's here only to allow things to run easily
secret_key: "9vJcJOYwsjdIQ9IhfOI5F9GQMykuNjBW58FY9S/TqMsq6gRdKgY05jscQAFVKfwa",
ttl: {30, :days}

config :teiserver, Oban,
repo: Teiserver.Repo,
repo: Barserver.Repo,
plugins: [
{Oban.Plugins.Pruner, max_age: 3600},
{Oban.Plugins.Cron,
crontab: [
# Every hour
{"0 * * * *", Teiserver.Admin.HourlyCleanupTask},
{"0 * * * *", Barserver.Admin.HourlyCleanupTask},

# Every day at 1am
{"0 1 * * *", Teiserver.Admin.DailyCleanupTask},
{"0 1 * * *", Barserver.Admin.DailyCleanupTask},

# Every day at 2am
{"0 2 * * *", Teiserver.Logging.AggregateViewLogsTask},
{"0 2 * * *", Barserver.Logging.AggregateViewLogsTask},

# 1:07 am
{"7 1 * * *", Teiserver.Account.Tasks.DailyCleanupTask},
{"22 1 * * *", Teiserver.Telemetry.EventCleanupTask},
{"7 1 * * *", Barserver.Account.Tasks.DailyCleanupTask},
{"22 1 * * *", Barserver.Telemetry.EventCleanupTask},

# At 17 minutes past every hour
{"17 * * * *", Teiserver.Battle.Tasks.CleanupTask},
{"17 * * * *", Barserver.Battle.Tasks.CleanupTask},

# Every minute
{"* * * * *", Teiserver.Logging.Tasks.PersistServerMinuteTask},
{"* * * * *", Teiserver.Moderation.RefreshUserRestrictionsTask},
{"* * * * *", Barserver.Logging.Tasks.PersistServerMinuteTask},
{"* * * * *", Barserver.Moderation.RefreshUserRestrictionsTask},

# Every minute
{"* * * * *", Teiserver.Battle.Tasks.PostMatchProcessTask},
{"* * * * *", Barserver.Battle.Tasks.PostMatchProcessTask},

# 2am
{"1 2 * * *", Teiserver.Logging.Tasks.PersistServerDayTask},
{"2 2 * * *", Teiserver.Logging.Tasks.PersistServerWeekTask},
{"3 2 * * *", Teiserver.Logging.Tasks.PersistServerMonthTask},
{"4 2 * * *", Teiserver.Logging.Tasks.PersistServerQuarterTask},
{"5 2 * * *", Teiserver.Logging.Tasks.PersistServerYearTask},
{"6 2 * * *", Teiserver.Logging.Tasks.PersistMatchDayTask},
{"7 2 * * *", Teiserver.Logging.Tasks.PersistMatchMonthTask},
{"8 2 * * *", Teiserver.Telemetry.InfologCleanupTask},
{"9 2 * * *", Teiserver.Logging.Tasks.PersistUserActivityDayTask},
{"1 2 * * *", Barserver.Logging.Tasks.PersistServerDayTask},
{"2 2 * * *", Barserver.Logging.Tasks.PersistServerWeekTask},
{"3 2 * * *", Barserver.Logging.Tasks.PersistServerMonthTask},
{"4 2 * * *", Barserver.Logging.Tasks.PersistServerQuarterTask},
{"5 2 * * *", Barserver.Logging.Tasks.PersistServerYearTask},
{"6 2 * * *", Barserver.Logging.Tasks.PersistMatchDayTask},
{"7 2 * * *", Barserver.Logging.Tasks.PersistMatchMonthTask},
{"8 2 * * *", Barserver.Telemetry.InfologCleanupTask},
{"9 2 * * *", Barserver.Logging.Tasks.PersistUserActivityDayTask},

# 2:43
{"43 2 * * *", Teiserver.Game.AchievementCleanupTask},
{"43 2 * * *", Barserver.Game.AchievementCleanupTask},

# 0302 and 1202 every day, gives time for multiple telemetry day tasks to run if needed
{"2 3 * * *", Teiserver.Account.RecalculateUserDailyStatTask},
{"2 12 * * *", Teiserver.Account.RecalculateUserDailyStatTask}
{"2 3 * * *", Barserver.Account.RecalculateUserDailyStatTask},
{"2 12 * * *", Barserver.Account.RecalculateUserDailyStatTask}
]}
],
queues: [logging: 1, cleanup: 1, teiserver: 10]
Expand Down
10 changes: 5 additions & 5 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Config

config :teiserver, Teiserver.Setup, key: "dev_key"
config :teiserver, Barserver.Setup, key: "dev_key"

# Configure your database
config :teiserver, Teiserver.Repo,
config :teiserver, Barserver.Repo,
username: "teiserver_dev",
password: "123456789",
database: "teiserver_dev",
Expand All @@ -18,7 +18,7 @@ config :teiserver, Teiserver.Repo,
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with webpack to recompile .js and .css sources.
config :teiserver, TeiserverWeb.Endpoint,
config :teiserver, BarserverWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4000],
debug_errors: true,
code_reloader: true,
Expand Down Expand Up @@ -49,7 +49,7 @@ config :dart_sass,
cd: Path.expand("../assets", __DIR__)
]

config :teiserver, Teiserver,
config :teiserver, Barserver,
certs: [
keyfile: "priv/certs/localhost.key",
certfile: "priv/certs/localhost.crt",
Expand All @@ -66,7 +66,7 @@ config :teiserver, Teiserver,
accept_all_emails: true

# Watch static and templates for browser reloading.
config :teiserver, TeiserverWeb.Endpoint,
config :teiserver, BarserverWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
Expand Down
8 changes: 4 additions & 4 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Config
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :teiserver, TeiserverWeb.Endpoint,
config :teiserver, BarserverWeb.Endpoint,
url: [host: "yourdomain.com"],
https: [
port: 8888,
Expand Down Expand Up @@ -69,7 +69,7 @@ config :teiserver, TeiserverWeb.Endpoint,
check_origin: ["//yourdomain.com", "//*.yourdomain.com"],
version: Mix.Project.config()[:version]

config :teiserver, Teiserver,
config :teiserver, Barserver,
certs: [
keyfile: "/var/www/tls/privkey.pem",
certfile: "/var/www/tls/cert.pem",
Expand All @@ -80,7 +80,7 @@ config :teiserver, Teiserver,
enable_managed_lobbies: true,
tachyon_schema_path: "/apps/teiserver/lib/teiserver-0.1.0/priv/tachyon/schema_v1/*/*/*.json"

config :teiserver, Teiserver.Repo,
config :teiserver, Barserver.Repo,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "40"),
timeout: 120_000,
queue_interval: 2000
Expand Down Expand Up @@ -118,7 +118,7 @@ config :logger, :info_log,
level: :info

# Overwritten in secret
config :teiserver, Teiserver.Account.Guardian,
config :teiserver, Barserver.Account.Guardian,
secret_key: "yix2DcXsA9MzAI8WldmYiJ38j2GyyXf5beWGAOJHl0FKNH04n1VACYbepqutma27"

import_config "prod.secret.exs"
25 changes: 18 additions & 7 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import Config
config :argon2_elixir, t_cost: 1, m_cost: 8

# Configure your database
config :teiserver, Teiserver.Repo,
username: "teiserver_test",
config :teiserver, Barserver.Repo,
username: "barserver_test",
password: "123456789",
database: "teiserver_test",
database: "barserver_test",
hostname: "localhost",
queue_target: 5000,
queue_interval: 100_000,
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 50,
timeout: 300_000

config :teiserver, Teiserver,
config :teiserver, Barserver,
certs: [
keyfile: "priv/certs/localhost.key",
certfile: "priv/certs/localhost.crt",
Expand All @@ -39,14 +39,14 @@ config :teiserver, Teiserver,

config :teiserver, DiscordBridgeBot,
token: nil,
bot_name: "Teiserver Bridge TEST",
bot_name: "Barserver Bridge TEST",
bridges: [
{"bridge_test_room", nil}
]

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :teiserver, TeiserverWeb.Endpoint,
config :teiserver, BarserverWeb.Endpoint,
http: [port: 4002],
server: false

Expand All @@ -58,7 +58,18 @@ config :teiserver, Oban, testing: :manual
# plugins: false,
# crontab: false

config :teiserver, Teiserver.Mailer,
config :teiserver, Barserver.Mailer,
adapter: Bamboo.TestAdapter,
noreply_address: "noreply@testsite.co.uk",
contact_address: "info@testsite.co.uk"


try do
import_config "test.secret.exs"
rescue
_ in File.Error ->
nil

error ->
reraise error, __STACKTRACE__
end
2 changes: 1 addition & 1 deletion documents/clustering/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ You can now run [documents/clustering/scripts/ssh_setup.sh](scripts/ssh_setup.sh
At this stage you should be able ssh into the boxes using `ssh deploy@ip_address` and not require a password.

## Software install
Next we need to install some of the software required to run Teiserver.
Next we need to install some of the software required to run Barserver.

You can do this by running [documents/clustering/scripts/install.sh](scripts/install.sh)
2 changes: 1 addition & 1 deletion documents/dev_designs/caches.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
- GenerateAchievement types

#### Keep - Changes needed to backend before clustering but otherwise can remain as they are
- Permission sets (needs to become a Teiserver.store system)
- Permission sets (needs to become a Barserver.store system)
- Update group caches for new groups (only needs to be run if the groups don't already exist)

#### Replace with Singleton GenServer
Expand Down
2 changes: 1 addition & 1 deletion documents/dev_designs/throttles.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Throttles are Genservers sitting between Teiserver main and the LiveViews. They batch up messages to prevent floods of updates lagging the liveview.
Throttles are Genservers sitting between Barserver main and the LiveViews. They batch up messages to prevent floods of updates lagging the liveview.
6 changes: 3 additions & 3 deletions documents/dev_designs/users.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Users are stored in 3 places:
Teiserver.Account.User - This is the core user used by the system
Teiserver.Account.User - An extension of the central user, used by the Teiserver system
Teiserver.Account.UserStat - Even more extension, this time for things that don't need to be updated often
Barserver.Account.User - This is the core user used by the system
Barserver.Account.User - An extension of the central user, used by the Barserver system
Barserver.Account.UserStat - Even more extension, this time for things that don't need to be updated often
2 changes: 1 addition & 1 deletion documents/guides/client/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Guides for developing a client interfacing with Teiserver.
Guides for developing a client interfacing with Barserver.
2 changes: 1 addition & 1 deletion documents/guides/discord_bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To get a channel ID in your discord settings enable developer mode in advanced s
Finally you need to enable the bot in either `config/prod.secret.exs` or `config/prod.exs`.

```
config :teiserver, Teiserver,
config :teiserver, Barserver,
enable_discord_bridge: true
```

Expand Down
4 changes: 2 additions & 2 deletions documents/guides/fixing_the_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ scp -i ~/.ssh/id_rsa backup.tar.gz deploy@yourdomain.com:./restore.db

Step 2: Remote into the server
```
# Stop Teiserver running
# Stop Barserver running
sudo systemctl stop teiserver.service

# Swap to postgres
Expand Down Expand Up @@ -52,7 +52,7 @@ exit
sudo systemctl start teiserver.service

# Run the migrations
teiserverapp eval "Teiserver.Release.migrate"
teiserverapp eval "Barserver.Release.migrate"

# Restart the app so it can build the initial data needed for various things
sudo systemctl restart teiserver.service
Expand Down
4 changes: 2 additions & 2 deletions documents/guides/hot_reloading.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ I highly recommend you read [A guide to hot code reloading in Elixir](https://bl
```python
#!/usr/bin/env python3
# Example usage:
# hot_reload Teiserver.Helper.TimexHelper Teiserver.Coordinator.ConsulCommands
# hot_reload Barserver.Helper.TimexHelper Barserver.Coordinator.ConsulCommands

import os, sys

Expand Down Expand Up @@ -43,7 +43,7 @@ if __name__ == '__main__':

# Print out instructions
instructions = "ssh to server\n---\ntsapp remote"
instructions += f"\nTeiserver.hot_reload([" + ", ".join(module_list) + "])"
instructions += f"\nBarserver.hot_reload([" + ", ".join(module_list) + "])"

print(instructions)
```
10 changes: 5 additions & 5 deletions documents/guides/local_setup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is still a work in progress but loosely the sequence of steps you will need to take to setup a Teiserver is:
This is still a work in progress but loosely the sequence of steps you will need to take to setup a Barserver is:

## Local/Dev
### Install services
Expand Down Expand Up @@ -105,12 +105,12 @@ If you want to do things like have a discord bot in development you don't want t
```elixir
import Config

config :teiserver, Teiserver,
config :teiserver, Barserver,
enable_discord_bridge: true

config :teiserver, DiscordBridgeBot,
token: "------",
bot_name: "Teiserver Bridge DEV",
bot_name: "Barserver Bridge DEV",
bridges: [
{"---", "main"},
{"---", "promote"},
Expand Down Expand Up @@ -139,8 +139,8 @@ When running locally it's likely you won't want to connect the server to an emai
Run your server with `iex -S mix phx.server` and then once it has started up use the following code to update your password.

```elixir
user = Teiserver.Account.get_user_by_email("root@localhost")
Teiserver.Account.update_user(user, %{"password" => "your password here"})
user = Barserver.Account.get_user_by_email("root@localhost")
Barserver.Account.update_user(user, %{"password" => "your password here"})
```

### Main 3rd party dependencies
Expand Down
Loading