Most of these are not hard requirements. Deviations will require adjustments be made to work with whatever you prefer to use instead. The project itself and all documentation is written expecting an environment that smells simliar to this. This is due to how Linux distros tend to compile their own opinions into things, such as where services should look for config files.
/etc/apache2/sites-enabled
./etc/php/<major>.<minor>/apache2
.
They contain a php.ini
file and conf.d
directory you can drop additional ini files into.
- Tips:
- Add
./vendor/bin
to yourPATH
to gain easy access to vendor scripts$ project.atl
,$ dev.atl
, etc, without typing the full path to it. All examples will be making use of this.- The
.atl
commands have help to see more info. Example:$ project.atl help db
will show all the possible db command arguments.
This project is under active development and is still depending on rolling source repository checkouts.
The following composer.json
settings are required to install and update.
They will be set automatically via the project bootstrapping.
"minimum-stability: "dev",
"prefer-stable": true
This will fetch some basic structure including a pre-configured composer.json
.
$ git clone https://github.com/netherphp/project app
$ cd app
$ rm -rf .git
Download the framework and dependencies.
$ composer require netherphp/atlantis dev-master
Set everything up. This will bootstrap a bare bones project to build upon in the project directory.
$ project.atl init -y
Update the autoloader, grabbing any last second updates along the way.
$ composer update
conf/config.php
file.
Update the ConfProjectID
, ConfProjectName
, and ConfProjectDomain
as a minimum.
Additionally there are environment specific config config/env/dev/config.php
for settings that may need to be specific to your local environment, for example a test domain or API keys.
prod
environment, copy the dev
environment and make any required changes.
$ cp -r conf/env/dev conf/env/prod
prod
: $ echo "prod" > env.lock
At this point PHP's built-in web server should be able to serve the application over basic HTTP. That can be tested with the following command:
$ php -S localhost:8080 -t www
The framework comes with a theme called soon
that will display a simple coming soon page to quickly park a project.
Within conf/config.php
set Surface\Library::ConfThemes
to [ 'local', 'soon', 'default' ]
.
The Themes work together as a stack. If you want to customise the parking page the version in soon
can be copied into local
, edited, and it will be loaded instead due to the order of the themes set.
Here is an example of adding that line after the Avenue configuration settings.
($Config)
->Set(Atlantis\Key::ConfLibraries, [ ])
->Set(Avenue\Library::ConfRouteFile, $App->FromProjectRoot('routes.phson'))
->Set(Avenue\Library::ConfRouteRoot, $App->FromProjectRoot('routes'))
->Set(Surface\Library::ConfThemes, [ 'local', 'soon', 'default' ]);
$ project.atl db --set --host=localhost --db=dbname --user=dbuser --pass=dbpass
$ web.atl config
$ web.atl setup
$ web.atl reload
There is an opinionated install script to get acme.sh
installed.
$ sh vendor/netherphp/atlantis/tools/acmesh-install-linux.sh email@for-ssl.notifications
/opt/acmesh
./opt/acmesh/local/confs
./opt/acmesh/local/certs
.
A list of the DNS hosts supported by acme.sh
via DNS API and how to configure them can be found here.
Atlantis comes with DNS scripts for DigitalOcean and Porkbun.
Copy the ones you need out and edit them to fill in the required information for that host.
$ cp vendor/netherphp/atlantis/templates/acmesh-issue-docean.txt bin/ssl.sh
$ cp vendor/netherphp/atlantis/templates/acmesh-issue-porkbun.txt bin/ssl.sh
Any SSL issue done in this method will only ever actually be used once.
After the initial issue acme.sh
will track what is needed to perform future renewals.
It is however advisable to keep your issue script laying around in the event you need to expand upon it, such as adding alternate domains your project might want to answer for.
Other modes of fetching certs with acme.sh can be found here.
acme.sh
should have automatically added a cron job for handling renewals.
This can be checked with $ crontab -l
.
It should look simliar to this:
20 4 * * * "/opt/acmesh"/acme.sh --cron --home "/opt/acmesh" --config-home "/opt/acmesh/local/confs" > /dev/null
The cron can be reinstalled with $ acme.sh --install-cronjob
.
Without doing anything by default the framework will scan for routes each request. This is fine on small projects and dev but it sucks for performance. The following command will generate a static routes.phson
file to speed things up.
$ dhd.atl update
This command will need to be re-run to add new routes later.
On my Macbook just this static site this is the performance difference:
cpu[ 0.023s ] mem[ 1.99 MiB ]
cpu[ 0.009s ] mem[ 1.06 MiB ]