import {useState} from "react"; import URI from "urijs"; import {Namespace} from "../nws-api/types"; import {useNWSAccount, useNWSAuthKey} from "../nws-api/hooks"; import {useSearchParams} from "react-router-dom"; export default function CreateCruisePage() { const [page, setPage] = useState('info'); const [strat, setStrat] = useState<'raw-html' | 'react-js'>('raw-html'); const [owner, setOwner] = useState(''); const [repo, setRepo] = useState(''); const [name, setName] = useState(''); const [gitUriInput, setGUI] = useState(''); const [hostUriInput, setHUI] = useState(''); const authKey = useNWSAuthKey(); const acct = useNWSAccount(); const [search, useSearch] = useSearchParams(); function deploy() { fetch("https://api-nws.nickorlow.com/" + acct!.id + "/service", { method: 'POST', headers: { "Authorization": authKey, "Content-Type": "application/json" }, body: JSON.stringify({ "serviceName": name, "containerUrl": `ghcr.io/${owner}/${repo}`, "namespaceId": search.get("namespaceId"), "serviceUrl": hostUriInput, }) }).then((response)=> { if(response.status === 200) { } }).catch((ex) =>{ alert(ex) }); } return (

Create Container Deployment

{ page === 'info' &&

Some information before we get started:

  • NWS is free to use
  • Currently, your DNS provider must support DNS flattening if you intend to point your root domain (e.g. nickorlow.com) to NWS. Subdomains should work fine though. (Cloudflare, Route 53, and Pagely). (Moving to Cloudflare is pretty easy)
  • Through the Web UI, you may only add one domain name. If you need to add more, contact me
  • NWS does not guarantee any uptime
  • NWS is run by a college student with little free time, support may reflect this
  • This platform is very early in development. It may require you to have some technical knowledge.
  • NWS may cease operations in the event of a widespread viral infection transmitted via bites or contact with bodily fluids that causes human corpses to reanimate and seek to consume living human flesh, blood, brain or nerve tissue and is likely to result in the fall of organized civilization.
} { page === 'framework-hostname' &&
What is this deployment's name?
May only be lowercase letters and dashes, max 20 chars
{setName(e.currentTarget.value)}}/>
How did you create your website?

Don't see your technology/framework? Email me: nws-support@nickorlow.com


What is the url of the github repo where your code is hosted? (e.g. https://github.com/nickorlow/personal-site)

Other git hosting providers are not currently supported through the Web UI

The repo must be public to create it through the Web UI

{setGUI(e.currentTarget.value)}}/>
What domain name will you use with your website? (e.g. nickorlow.com)
{setHUI(e.currentTarget.value)}}/>
} { page === 'scriptgen' &&

Copy & Paste the below into your terminal to add NWS deployment scripts to your webapp

curl -s https://raw.githubusercontent.com/nickorlow/nws-ghactions-templates/main/add-nws.sh | bash -s {strat} {owner} {repo}
Ensure the script finishes running before continuing
} { page === 'dns' &&

Add the following DNS entry to {new URI(hostUriInput).hostname()}

{ new URI(hostUriInput).subdomain().length == 0 &&

If your DNS provider is:

  • Cloudflare
  • Route 53
  • Pagely

Type: CNAME

Name: @ ({hostUriInput})

Value: entry.nws.nickorlow.com

} { new URI(hostUriInput).subdomain().length > 0 &&

Type: CNAME

Name: {new URI(hostUriInput).subdomain()} ({new URI(hostUriInput).hostname()})

Value: entry.nws.nickorlow.com

}
} { page === 'done' &&

Welcome to NWS



}
); }