-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from codeigniter4projects/develop
Deploy
- Loading branch information
Showing
26 changed files
with
850 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh -e | ||
|
||
# Deploys the official site to the production server. | ||
# See ../workflows/deploy.yml | ||
|
||
REPO="/opt/website" | ||
RELEASE_DIR="/home/public_html/site/releases" | ||
SHARED_DIR="/home/public_html/site/shared" | ||
USERGUIDE_DIR="/home/public_html/userguides" | ||
CONFIG_FILE="/home/public_html/config/.env.site" | ||
|
||
if [ "$(id -u)" = "0" ]; then | ||
echo "Cannot be run as root. Please run as the user for deployment." | ||
exit 1 | ||
fi | ||
|
||
RELEASE=`date +"%Y-%m-%d-%H-%M-%S"` | ||
|
||
echo 'Update website repository\n' | ||
cd $REPO | ||
git switch master | ||
git pull | ||
|
||
echo 'Copy current release\n' | ||
cd $RELEASE_DIR | ||
sudo cp -pr $REPO ./$RELEASE | ||
|
||
echo 'Install composer dependencies\n' | ||
cd $RELEASE_DIR/$RELEASE | ||
composer install --no-dev | ||
|
||
if [ ! -d "$SHARED_DIR" ]; then | ||
echo 'Create shared directory\n' | ||
sudo mkdir -p "$SHARED_DIR" | ||
echo 'Setup folder permissions\n' | ||
sudo chown -R www-data:www-data writable | ||
sudo chmod -R 755 writable | ||
sudo cp -rp writable "$SHARED_DIR" | ||
fi | ||
|
||
echo 'Link writable\n' | ||
sudo rm -rf writable | ||
sudo ln -nsf "$SHARED_DIR/writable" writable | ||
|
||
echo 'Link .env\n' | ||
sudo ln -nsf $CONFIG_FILE .env | ||
|
||
echo 'Link user guides\n' | ||
ln -nsf $USERGUIDE_DIR/userguide4 public/user_guide | ||
ln -nsf $USERGUIDE_DIR/userguide3 public/userguide3 | ||
ln -nsf $USERGUIDE_DIR/userguide2 public/userguide2 | ||
|
||
echo 'Deploy: update symlink\n' | ||
cd $RELEASE_DIR | ||
sudo ln -nsf $RELEASE_DIR/$RELEASE "../current" | ||
|
||
echo 'Reload PHP8.1-FPM\n' | ||
sudo service php8.1-fpm reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
namespace Config; | ||
|
||
use CodeIgniter\Config\BaseConfig; | ||
|
||
/** | ||
* Cross-Origin Resource Sharing (CORS) Configuration | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS | ||
*/ | ||
class Cors extends BaseConfig | ||
{ | ||
/** | ||
* The default CORS configuration. | ||
* | ||
* @var array{ | ||
* allowedOrigins: list<string>, | ||
* allowedOriginsPatterns: list<string>, | ||
* supportsCredentials: bool, | ||
* allowedHeaders: list<string>, | ||
* exposedHeaders: list<string>, | ||
* allowedMethods: list<string>, | ||
* maxAge: int, | ||
* } | ||
*/ | ||
public array $default = [ | ||
/** | ||
* Origins for the `Access-Control-Allow-Origin` header. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin | ||
* | ||
* E.g.: | ||
* - ['http://localhost:8080'] | ||
* - ['https://www.example.com'] | ||
*/ | ||
'allowedOrigins' => [], | ||
|
||
/** | ||
* Origin regex patterns for the `Access-Control-Allow-Origin` header. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin | ||
* | ||
* NOTE: A pattern specified here is part of a regular expression. It will | ||
* be actually `#\A<pattern>\z#`. | ||
* | ||
* E.g.: | ||
* - ['https://\w+\.example\.com'] | ||
*/ | ||
'allowedOriginsPatterns' => [], | ||
|
||
/** | ||
* Weather to send the `Access-Control-Allow-Credentials` header. | ||
* | ||
* The Access-Control-Allow-Credentials response header tells browsers whether | ||
* the server allows cross-origin HTTP requests to include credentials. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials | ||
*/ | ||
'supportsCredentials' => false, | ||
|
||
/** | ||
* Set headers to allow. | ||
* | ||
* The Access-Control-Allow-Headers response header is used in response to | ||
* a preflight request which includes the Access-Control-Request-Headers to | ||
* indicate which HTTP headers can be used during the actual request. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers | ||
*/ | ||
'allowedHeaders' => [], | ||
|
||
/** | ||
* Set headers to expose. | ||
* | ||
* The Access-Control-Expose-Headers response header allows a server to | ||
* indicate which response headers should be made available to scripts running | ||
* in the browser, in response to a cross-origin request. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers | ||
*/ | ||
'exposedHeaders' => [], | ||
|
||
/** | ||
* Set methods to allow. | ||
* | ||
* The Access-Control-Allow-Methods response header specifies one or more | ||
* methods allowed when accessing a resource in response to a preflight | ||
* request. | ||
* | ||
* E.g.: | ||
* - ['GET', 'POST', 'PUT', 'DELETE'] | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods | ||
*/ | ||
'allowedMethods' => [], | ||
|
||
/** | ||
* Set how many seconds the results of a preflight request can be cached. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age | ||
*/ | ||
'maxAge' => 7200, | ||
]; | ||
} |
Oops, something went wrong.