bingo: serve bingo.asxp.io too, credit asxp.io in footer
datacenterbingo.xyz is not in the .xyz zone yet, while bingo.asxp.io already resolves. Serve the card on both (BINGO_ALT_HOST) so it is reachable now; canonical and hreflang links keep pointing at the .xyz domain. Footer gets a copyright line linking back to asxp.io. Assisted-by: Claude:opus-5
This commit is contained in:
parent
90e1bbc9c5
commit
cd04b01e57
7 changed files with 22 additions and 9 deletions
|
|
@ -20,3 +20,5 @@ MAIL_TO=ie@asxp.io
|
||||||
|
|
||||||
# Datacenter bingo hostname (same process, routed by Host). Unset = bingo off.
|
# Datacenter bingo hostname (same process, routed by Host). Unset = bingo off.
|
||||||
# BINGO_HOST=bingo.localhost
|
# BINGO_HOST=bingo.localhost
|
||||||
|
# Optional second hostname serving the same card.
|
||||||
|
# BINGO_ALT_HOST=bingo2.localhost
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ jobs:
|
||||||
LTC_ADDRESS=${LTC_ADDRESS}
|
LTC_ADDRESS=${LTC_ADDRESS}
|
||||||
CRYPTO_ADDRESSES=${CRYPTO_ADDRESSES}
|
CRYPTO_ADDRESSES=${CRYPTO_ADDRESSES}
|
||||||
BINGO_HOST=datacenterbingo.xyz
|
BINGO_HOST=datacenterbingo.xyz
|
||||||
|
BINGO_ALT_HOST=bingo.asxp.io
|
||||||
EOF
|
EOF
|
||||||
chmod 600 /opt/asxpio/.env
|
chmod 600 /opt/asxpio/.env
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,15 @@
|
||||||
# AsxpioWeb (config.ru dispatches by Host). Read-only: no session, no CSRF.
|
# AsxpioWeb (config.ru dispatches by Host). Read-only: no session, no CSRF.
|
||||||
# Content is managed from asxp.io/admin/bingo (lib/bingo_admin.rb).
|
# Content is managed from asxp.io/admin/bingo (lib/bingo_admin.rb).
|
||||||
class BingoWeb < Sinatra::Base
|
class BingoWeb < Sinatra::Base
|
||||||
|
HOSTS = [ENV['BINGO_HOST'], ENV['BINGO_ALT_HOST']].compact.reject(&:empty?).freeze
|
||||||
|
|
||||||
configure do
|
configure do
|
||||||
set :root, $root
|
set :root, $root
|
||||||
set :views, File.join($root, 'views', 'bingo')
|
set :views, File.join($root, 'views', 'bingo')
|
||||||
set :erb, layout: :layout, escape_html: true
|
set :erb, layout: :layout, escape_html: true
|
||||||
set :show_exceptions, $env == 'development'
|
set :show_exceptions, $env == 'development'
|
||||||
set :host_authorization,
|
set :host_authorization,
|
||||||
{ permitted_hosts: $env == 'production' && ENV['BINGO_HOST'] ? [ENV['BINGO_HOST']] : [] }
|
{ permitted_hosts: $env == 'production' ? HOSTS : [] }
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,19 @@ require 'sinatra/base'
|
||||||
require './asxpio.rb'
|
require './asxpio.rb'
|
||||||
require './bingo_web.rb'
|
require './bingo_web.rb'
|
||||||
|
|
||||||
# One process, two sites: BINGO_HOST gets the bingo, everything else asxp.io.
|
# One process, two sites: the bingo hosts get BingoWeb, everything else
|
||||||
|
# asxp.io. BINGO_HOST is canonical (www. redirects to it); BINGO_ALT_HOST
|
||||||
|
# serves the same card, e.g. while the canonical domain's DNS settles.
|
||||||
asxpio = AsxpioWeb.new
|
asxpio = AsxpioWeb.new
|
||||||
bingo = BingoWeb.new
|
bingo = BingoWeb.new
|
||||||
bingo_host = ENV['BINGO_HOST']
|
bingo_host = ENV['BINGO_HOST']
|
||||||
|
bingo_hosts = BingoWeb::HOSTS
|
||||||
|
|
||||||
run lambda { |env|
|
run lambda { |env|
|
||||||
req = Rack::Request.new(env)
|
req = Rack::Request.new(env)
|
||||||
if bingo_host && req.host == "www.#{bingo_host}"
|
if bingo_host && req.host == "www.#{bingo_host}"
|
||||||
[301, { 'location' => "https://#{bingo_host}#{req.fullpath}" }, []]
|
[301, { 'location' => "https://#{bingo_host}#{req.fullpath}" }, []]
|
||||||
else
|
else
|
||||||
(bingo_host && req.host == bingo_host ? bingo : asxpio).call(env)
|
(bingo_hosts.include?(req.host) ? bingo : asxpio).call(env)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,9 @@ services:
|
||||||
- "traefik.http.routers.asxpio.service=asxpio"
|
- "traefik.http.routers.asxpio.service=asxpio"
|
||||||
- "traefik.http.services.asxpio.loadbalancer.server.port=3000"
|
- "traefik.http.services.asxpio.loadbalancer.server.port=3000"
|
||||||
# Datacenter bingo: same container, routed by Host in config.ru.
|
# Datacenter bingo: same container, routed by Host in config.ru.
|
||||||
# BINGO_HOST is interpolated from /opt/asxpio/.env (written by deploy).
|
# BINGO_HOST / BINGO_ALT_HOST are interpolated from /opt/asxpio/.env
|
||||||
- "traefik.http.routers.asxpio-bingo.rule=Host(`${BINGO_HOST}`) || Host(`www.${BINGO_HOST}`)"
|
# (written by deploy).
|
||||||
|
- "traefik.http.routers.asxpio-bingo.rule=Host(`${BINGO_HOST}`) || Host(`www.${BINGO_HOST}`) || Host(`${BINGO_ALT_HOST}`)"
|
||||||
- "traefik.http.routers.asxpio-bingo.entrypoints=websecure"
|
- "traefik.http.routers.asxpio-bingo.entrypoints=websecure"
|
||||||
- "traefik.http.routers.asxpio-bingo.tls=true"
|
- "traefik.http.routers.asxpio-bingo.tls=true"
|
||||||
- "traefik.http.routers.asxpio-bingo.tls.certresolver=letsencrypt"
|
- "traefik.http.routers.asxpio-bingo.tls.certresolver=letsencrypt"
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer><%= t(:footer) %></footer>
|
<footer>
|
||||||
|
<p><%= t(:footer) %></p>
|
||||||
|
<p>© <%= Date.today.year %> <a href="https://asxp.io">asxp.io</a></p>
|
||||||
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<% b.cells.each do |dc| %>
|
<% b.cells.each do |dc| %>
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@
|
||||||
dialog ul { padding-left: 18px; }
|
dialog ul { padding-left: 18px; }
|
||||||
dialog button { font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
|
dialog button { font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
|
||||||
footer { margin-top: 32px; color: var(--muted); font-size: 13px; }
|
footer { margin-top: 32px; color: var(--muted); font-size: 13px; }
|
||||||
|
footer p { margin: 0 0 4px; }
|
||||||
@media (max-width: 560px) {
|
@media (max-width: 560px) {
|
||||||
.cell { padding: 5px; border-radius: 6px; }
|
.cell { padding: 5px; border-radius: 6px; }
|
||||||
.cell .sub, .cell .n, .cell .tag { display: none; }
|
.cell .sub, .cell .n, .cell .tag { display: none; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue