Install your storefront on the server
Install your Nuxt, React or SvelteKit storefront from its npm package with one command, or create the project yourself and run the install command of the orionplace-nuxt, orionplace-react or orionplace-svelte package. Either way the storefront is built on the server, runs as a system service that starts with the server and restarts after a failure, and its domains are connected with HTTPS. Choose your package below.
How it works
Each storefront gets its own service named orionplace- followed by the storefront name, on a free local port from 3000. The service runs as the orionplace user and reads the domain mapping files on every request, so a new domain needs no restart. nginx passes the requests of each domain to the storefront that serves it.
1 Install from npm with one command
Prepare the server first. Then run:
sudo orionplace app install svelteThe command asks for the storefront name (shop by default), your personal backend and the storefront domain, and shows what it will install. It adds the domain with its certificate first, so a DNS problem shows up before the build. Then it creates the project from the newest release of the package in /srv/orionplace/shop, installs the dependencies, connects the backend and the domain and runs the install command described below. If a step fails, fix the problem and run the same command again: it continues in the same folder.
Give the answers as options to run it without questions:
sudo orionplace app install svelte shop \
--domain shop.example.com \
--backend my-shop.orionplace.app| Option | What it does |
|---|---|
--version <version> | Package version, version range or tag. By default latest, the newest release. |
--domain <domain> | Storefront domain. Without it the command asks. |
--backend <name.orionplace.app> | Personal backend domain from your orionmarket.place profile. Without it the command asks. |
--port <port> | Local port of the service. By default the first free port from 3000. |
--www / --no-www | Also serve the www name of the domain and redirect it to the domain (--www), or not (--no-www). By default yes for example.com, no for shop.example.com. |
--skip-dns-check | Skip the DNS check, for example when a proxy in front of the server answers for the domain. |
--yes | Take the defaults instead of asking questions. |
List the published versions of the package, or install one of them (0.3.0 or newer). The project then keeps exactly that version:
sudo orionplace app versions svelte
sudo orionplace app install svelte --version 0.3.02 Or create the storefront yourself
To go step by step instead, create the project in /srv/orionplace, the folder that setup prepared for storefronts:
cd /srv/orionplace
sudo npx --yes orionplace-svelte init shop
cd shop
sudo npm installTo install a project you already have, copy it to a folder such as /srv/orionplace/shop (for example with git clone) and run sudo npm install in it. The service user cannot read a project in /root or another closed folder.
3 Connect your backend and domain
Use the personal backend domain from your orionmarket.place profile and your storefront domain. You can skip this step: install asks for both when they are missing.
sudo npx orionplace-svelte set backend my-shop.orionplace.app
sudo npx orionplace-svelte add frontend shop.example.com4 Install as a service
In the project folder run:
sudo npx orionplace-svelte installInstall builds the project with npm run build, creates the service that runs build/index.js with your .env, trusting the host, protocol and address headers from nginx and allowing uploads of up to 64 MB, starts it and waits until the storefront answers. Then it runs orionplace domain add for each storefront domain, which sets up nginx, the certificate and the domain mapping.
At the end it prints the address of each domain, for example https://shop.example.com. If a domain is not connected, usually because its DNS record does not point to the server yet, fix that and run sudo orionplace domain add shop.example.com. A failed build leaves the running service unchanged.
5 Update and redeploy
After you change the code or update the package, run install again. It rebuilds the storefront and restarts the service on the same port:
sudo npx orionplace-svelte update
sudo npx orionplace-svelte installTo serve one more domain, add it to the project and run install again:
sudo npx orionplace-svelte add frontend shop2.example.com
sudo npx orionplace-svelte install6 Manage the service
Manage the service from the project folder with the package command. restart waits until the storefront answers again and shows the last log lines when it does not:
cd /srv/orionplace/shop
npx orionplace-svelte status
sudo npx orionplace-svelte logs 200
sudo npx orionplace-svelte restart| Command | What it does |
|---|---|
npx orionplace-svelte status | Whether the service runs and starts with the server, its local port, whether the home page answers and the storefront domains. Ends with code 3 when the storefront is stopped or does not answer. |
sudo npx orionplace-svelte start | Start the service and wait until the home page answers. |
sudo npx orionplace-svelte stop | Stop the service. Its domains do not answer until you start it again. |
sudo npx orionplace-svelte restart | Restart the service, for example after you change .env, and wait until the home page answers. |
sudo npx orionplace-svelte logs [lines] [--follow] | The last log lines, 100 by default. With --follow new lines keep coming until you press Ctrl+C. |
npx orionplace-svelte list | Every storefront service on this server with its type, port and state. |
sudo npx orionplace-svelte uninstall [--dry-run] [--yes] | Stop the service, take it out of autostart and delete its unit file and registration; cleanup does the same. The project folder and its build stay. With the server tool it runs orionplace app remove, which also turns the domains into a placeholder page. --dry-run shows what it would remove, --yes skips the question. |
The commands find the service by the project folder. From another folder, give its name. start, stop, restart, logs and uninstall need sudo; status and list do not:
sudo npx orionplace-svelte restart --name shopThe server tool does the same by storefront name from any folder:
sudo orionplace app list
sudo orionplace app logs shop
sudo orionplace app restart shop7 Install options
| Option | What it does |
|---|---|
--name <service> | Service name. By default the name of the project folder, for example shop. |
--port <port> | Local port. By default the first free port from 3000; later runs keep it. |
--user <user> | System user that runs the service. By default the owner of the folder, or orionplace when the folder belongs to root. |
--no-build | Install the build that is already in the folder instead of building again, for example one built on another computer. Without a build the project is built anyway. |
--no-domains | Build and restart without connecting the domains. |
--yes | Take the defaults instead of asking questions. |
--dry-run | Show the planned service; nothing changes. |
With --dry-run install shows the service it would create and changes nothing:
sudo npx orionplace-svelte install --dry-run
sudo npx orionplace-svelte install --name shop --port 3000
sudo npx orionplace-svelte install --no-domains