Download the PHP package jonnitto/uberspace-deployer without Composer
On this page you can find all versions of the php package jonnitto/uberspace-deployer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jonnitto/uberspace-deployer
More information about jonnitto/uberspace-deployer
Files in jonnitto/uberspace-deployer
Package uberspace-deployer
Short Description Unofficial deployer recipes for Uberspace interacting with Neos CMS
License MIT
Informations about the package uberspace-deployer
Deployer tasks for Uberspace & Neos CMS
These deployer scripts are built on top of Deployer. Most of the tasks are provided by this library already; this package adds just some optimization for the install process and the needed actions for deploying a project. Some helper tasks are available that should make your life as a developer a bit easier. Please run the deployer scripts only in your development environment, as Deployer connects automatically to the needed server.
You can look at the example folder to look how to set up a deployment. The files should be saved at the root of your project.
For a list of all available commands, enter dep
in the command line
Uberspace
Uberspace is a superb hosting provider from Germany. You can find their complete manual here.
First, you have to register your own uberspace. Then, add your SSh key to the admin interface. If you don't know what SSH is, you can read more about this in the SSH section in the uberspace manual or on the SSH manual on github.
Installation of the deployment scripts
Enter this on the root of your project:
Create a file with the name deploy.php
with the following content:
Create a file with the name deploy.yaml
with the following content and edit it following points:
- Replace
domain.tld
with the corresponding domain, withoutwww.
- Replace
__SERVER__
with the corresponding server name. You'll find the info on the uberspace dashboard. - Replace
__USER__
with the corresponding uberspace username - Replace
__OWNER__/__REPOSITORY
with the corresponding repository - Add the
slack_webhook
. (optional) You can register it here
The command dep deploy
checks if Neos is installed and starts either the installation process or a fresh deployment.
Warning
Do not delete the fileSettings.yaml
in theshared/Configuration/
folder.
This file is used to check if Neos is already installed. If the installation fails, please remove the whole folder and start again.
The --composer_auth
input option for the tasks
If you want to pass an authentication configuration (for private repositories) during deploy
task, you can do this via the --composer_auth
input option:
Example:
This option doesn't add the authentication global to composer on the host, just locally. If you want to install the authentication globally, connect via dep ssh
to the server and enter (as an example) composer config --global --auth http-basic.repo.packagist.com token XYZ
in the CLI.
Add a domain
The add a domain to your uberspace, you can either follow the instructions on the uberspace manual
or run the command dep server:domain:add
.
Cronjobs
To edit the cronjobs on the server, run the command dep server:cronjob
.
In the case you have to run a CLI PHP command, it is essential to set the full path to the PHP binary.
Publish the document root
In order for a website to be accessible to visitors, it must be published in the correct directory. The default directory for all requests is /var/www/virtual/<username>/html
. But you can also host multiple domains in one instance. You can create folders (and symlinks) in the form of /var/www/virtual/<username>/<domain>
. Make sure your domain is set up and configured correctly. To use RewriteRules, you have to create a .htaccess
file within the DocumentRoot with the following content: RewriteBase /
. In the example folder, you'll find an example of an .htaccess
file with a dynamic FLOW_CONTEXT
configuration based on the URL.
Warning
Do not delete the/html
folder. If this folder doesn’t exist, the RewriteRules
implementing the additional DocumentRoots don’t work, so all your domains will be unaccessible.
You can use the command dep server:symlink:add
to create a correct symlink.
Set the DNS records
To go live, the A
(IPv4) and the AAAA
(IPv6) Records need to be set in the domain DNS settings. To find out which are the correct IP addresses, take a look at your uberspace dashboard, or copy the addresses after the dep server:domain:add
command.
Set the Flow Context via .htaccess
You must set the FLOW_CONTEXT
correctly.
Example:
General commands
Run these tasks with dep COMMAND
. If you want to list all commands, enter dep
or dep list
Command | Description |
---|---|
Main tasks | |
deploy |
Deploy/install your project |
rollback |
Rollback to previous release |
ssh |
Connect to host through ssh |
flow |
Run any flow command |
help |
Displays help for a command |
Deploy tasks | |
deploy |
Deploy your project |
deploy:unlock |
Unlock deploy |
Database task | |
database:backup |
Create a backup from the current database on the server |
database:delete |
Delete a database on the server |
database:download:current |
Download current database from the server |
database:download:dump |
Download dump from the backup folder on the server |
database:import |
Import a database from the backup folder |
database:list |
List all databases on the server |
Flow tasks | |
flow |
Run any flow command |
flow:configuration |
Edit shared configuration yaml files |
flow:create_admin |
Create a new administrator |
flow:flush_caches |
Flush all caches |
flow:import |
Import your local content or a site from a package within DistributionPackages |
flow:node:migrate |
List and run node migrations |
flow:node:repair |
Repair inconsistent nodes in the content repository |
flow:publish_resources |
Publish resources |
flow:run_migrations |
Apply database migrations |
Git tasks | |
git:commit |
Commit current changes to git |
git:ssh:key |
Output private key for SSH_PRIVATE_KEY secret and upload public key to host |
git:ssh:know_hosts |
Output the know host for the SSH_KNOWN_HOSTS secret |
git:tag |
Create release tag on git |
Server tasks | |
server:cronjob |
Edit the cronjobs |
server:dns |
Output the IP addresses for the A and AAAA record |
server:domain:add |
Add a domain to uberspace |
server:domain:list |
List all domains and subdomains |
server:domain:remove |
Remove a domain from uberspace |
server:ssh_key |
Create and/or read the deployment key |
server:symlink:add |
Set the symbolic link for this site |
server:symlink:list |
List current symlinks on the web root |
server:symlink:remove |
Remove a symbolic link from the web root |
server:php:restart |
Restart PHP |
server:php:version |
Set the PHP version on the server |
Config tasks | |
config:current |
Show current paths |
config:dump |
Print host configuration |
config:hosts |
Print all hosts |
Usage with ddev
If you use ddev for local development, the task dep flow:import
will not work. You have to enable the setting ddev
to true
to make it work. Please run this task not inside the container.
Slack notifications
The parameter slack_webhook
accepts an array with strings beside a simple string.
With this, you can post the notifications to multiple channels.
Example:
Deployment to multiple stages and/or via GitHub Actions
Deployment of staging and production to the same hosts
If you want to have a staging and production instance on the same host, you should set up at least two branches, e.g., `staging` and `production`. It is recommended that you name the `stage` and the `branch` name the same. `redis_start_db_number` has to be set because you don't want to share the same Redis database for staging and production. In the [Default parameter](#default-parameter) section, you can read more about this.Deployment of staging and production to the multiple hosts
Automatic deployment with GitHub actions
In the [example] folder, you'll find a file called `deployment_werkflow.yaml`. To enable automatic deployments via GitHub actions, you have to put a file like this in your repository under `.github/workflows/deploy.yaml` This example is just meant as an inspiration; you can (and should) edit this to fit your needs. In this workflows are some GitHub secrets you can set: | Secret | Description | | ------------------- | -------------------------------------------------------------------------------------------------- | | `COMPOSER_AUTH` | As described [above](#the---composer_auth-input-option-for-the-tasks) | | `SLACK_WEBHOOK_URL` | It is recommended to let GitHub handle the slack notifications | | `SSH_KNOWN_HOSTS` | Enter here the host from uberspace. You can output these with the command `dep git:ssh:know_hosts` | | `SSH_PRIVATE_KEY` | Enter here the private key. You can output the private key with the command `dep git:ssh:key` |Default parameter
This package sets some default parameters. All of them are defined in config.php.
You can override them in your yaml
or directly in your PHP
file.