Deploy your Astro Site to Space
本頁內容尚未翻譯。
Deta Space is a personal computer that lives in the cloud — a ‘personal cloud’. You can build and run apps for yourself in your own “Space”. You can publish the apps you’ve built, and they’ll run for people all around the world.
This guide includes step-by-step instructions for building sites in Space. Both static and server-side rendered (with the @astrojs/node
adapter) Astro sites are supported.
The following instructions will not work for v3.0+ Astro projects as Space currently only supports Node.js 16.
Prerequisite
Section titled PrerequisiteTo push an Astro site to Space, make sure you first:
- Create a Space account.
- Install the Space CLI and log in.
Create a Space project inside the directory of your Astro project. Run the CLI and follow the instructions on the screen.
The Space CLI will try to auto-detect the configuration for your app. Accept the suggested configuration and then follow the instructions below, depending on the type of Astro app you want to deploy.
Project Configuration
Section titled Project ConfigurationStatic site
Section titled Static siteMake the following changes to the Spacefile
file at the root of your project generated by the Space CLI.
- Change the engine to
static
. - Add Astro’s build command to the list of
commands
. - Serve the
dist
directory generated by Astro.
Server-side rendered site
Section titled Server-side rendered siteMake the following changes to the Spacefile
file at the root of your project generated by the Space CLI:
- Configure the
nodejs16
engine. - Add the
build
command. - Include the
dist
directory generated by Astro. - Run the node command.
How to deploy
Section titled How to deployDeploy your project with the following command:
This will run the build process and create a new Space app instance where you can access your Astro app.
By default Space apps are private and are only accessible to you.
If you want to make your app available to others you can use Public Routes to make parts of your app public. Or, you can create a release to let others install your app into their own personal cloud.
Next steps
Section titled Next stepsExamples
Section titled Examples- Astro in Space – GitHub