text Lando设置模板文件 - apache

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Lando设置模板文件 - apache相关的知识,希望对你有一定的参考价值。

# **[PROJECT NAME]** Wordpress
This is the repository for **[PROJECT NAME]**


## Local Dev Environment setup
### First time Docker/Lando setup (optional if you’ve already done it)
* Install Docker version 18.06.1-ce-mac73 2018-08-29. Link: https://download.docker.com/mac/stable/26399/Docker.dmg
	* *IMPORTANT* - please DON'T UPDATE Docker to the most recent version yet
* Install Lando version v3.0.0-rc.1. Link: https://github.com/lando/lando/releases/download/v3.0.0-rc.1/lando-v3.0.0-rc.1.dmg

### Project Setup
#### Git
* Open your terminal into the parent folder of your local sites. eg `cd /users/you-user/Sites/Redstamp/`
* Clone the repo into a folder called 'exabeam.local'. eg. `git clone git@gitlab.com:**[PROJECT NAME]**/wordpress.git **[PROJECT NAME]**.local`
* cd into the exabeam.local folder eg. `cd **[PROJECT NAME]**.local`
* Run the redstamp_local.sh file: `bash **[PROJECT NAME]**_local.sh`
* This will add '**[PROJECT NAME]**.local' to your hosts file, and setup your docker environment using Lando
    * If you already have the **[PROJECT NAME]**.local entry in your hosts file, you can press 'n' when prompted during the script

#### Database
* Open Sequel Pro (https://sequelpro.com/download)
	* Open a new connection window
	* Click on the gear in the bottom left corner, and select ‘import’
	* Navigate to your **[PROJECT NAME]**.local folder, and import the file called ‘**[PROJECT NAME]**.local.plist’
	* Update the password field to ‘redstamp’ and click save connection info.

### Starting and stopping your local environment
* After your initial installation, your environment will be running.
* To stop your environment, open your console in the root of your project, and type `lando stop`
    * Note - It is a good idea to stop your environment when switching tasks (leaving multiple Lando environments running will consume a lot of resources).
* If you reboot your compuer, your environment will be stopped. To start it again, open your console in the root of your project, and type `lando start`
* You can also type `lando poweroff` anywhere in your console to shut down all lando environments currently running.
* For additional commands and documentation, see: https://docs.devwithlando.io/cli/usage.html

## Changes

We use branches dedicated to each change request. Once a change is ready for production, we merge it into master.

IMPORTANT: Never create changes on the `master` branch!

To start a change, make sure master is up to date, and then create a new branch:

```
git pull                   # Update the repository, all branches
git checkout master        # Checkout master. All new branches need to be based from master.
git checkout -b my_changes # Create a new branch based on master. New branches need to be based off master. 
```

IMPORTANT: Use a unique branch name that reflects the change you are performing. Do not perform changes for multiple requests in one branch unless all of these changes relate to a single deployment.

Periodically, a new change will be merged into master. These changes need to be merged into your branch in order for your branch to be kept up to date and free of merge conflicts. To do this:

```
git pull origin master
git checkout my_changes
git merge master
```

## Master

When you have completed your changes and you have merged master into your branch one final time to make sure it contains any updates since your last merge, you will then use gitlab to perform the final merge request into master. 

https://gitlab.com/**[PROJECT NAME]**/wordpress/branches

Find your branch here and press the 'Merge Request' button to start the request. 

Confirm that your 'target branch' is set to master and press 'submit merge request'

Press the 'merge' button to complete the merge to master. 

## Deployments

When making changes, some of them will include changes that are reflected in the database only. These changes need to be documented in the task underthe subheading 'PROD' so they can be replicated during deployment. Advanced Custom Fields allows you to create exports of field groups. 

Deployments are done using the Gitlab CI: https://gitlab.com/**[PROJECT NAME]**/wordpress/pipelines

Anything on the 'master' branch will be given the option to push to production.  

IMPORTANT: Only a Sr. Developer will handle deployment requests.  Do not attempt without one present. 
#!/bin/bash

# Add URL to Hosts file
echo -e '\033[0;32mAdd **[PROJECT NAME]** to your hosts file? (y/n)'
read answer_hosts
if [ "$answer_hosts" != "${answer_hosts#[Yy]}" ] ;then
    echo ' ' | sudo tee -a /etc/hosts
    echo -e 'Adding the following entries to /etc/hosts'
    echo '# **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
    echo '127.0.0.1         **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
    echo '::1               **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
    echo ''
else
    echo Skipping
fi

# Install NPM Dependencies
echo -e 'Install NPM dependencies for Gulp? (y/n)'
read answer_npm
if [ "$answer_npm" != "${answer_npm#[Yy]}" ] ;then
    echo "Installing NPM dependencies"
    npm install
else
    echo Skipping
fi
echo "Gulp is found in the root directory. Run 'gulp' to compile sass/scripts"
echo "Installing / starting lando"

# Install Lando/Docker container
lando start

# Install blank Wordpress DB (for migration)
echo 'Install blank Wordpress & Migrate DB plugin ? (y/n)'
read answer_db
if [ "$answer_db" != "${answer_db#[Yy]}" ] ;then
    cd dist && lando wp core install --url=**[PROJECT NAME]**.local --title=Redstamp --admin_user=redstamp --admin_password=redstamp --admin_email=tools@redstamp.ca --skip-plugins --skip-themes --skip-packages
    # Activate DB Migration plugins
    lando wp plugin activate wp-sync-db-1.5 && lando wp plugin activate wp-sync-db-media-files-1.1.5
else
    echo -e 'Skipping'
fi

echo -e '\033[0;32mInstallation complete. See Readme.md for additional commands / troubleshooting info.'
name: **[PROJECT NAME]**
recipe: wordpress
config:
  via: apache
  php: '7.2'
  webroot: dist
  ssl: true
  xdebug: false
services: 
  database:
    type: mysql
    portforward: [NEW PORT NUMBER HERE]
    creds:
      user: redstamp
      password: redstamp
      database: **[PROJECT NAME]**
  node:
    type: node:8.9
    globals:
      gulp-cli: "latest"
proxy:
  appserver:
    - **[PROJECT NAME]**.lndo.site
    - **[PROJECT NAME]**.local
tooling:
  composer:
    service: appserver
    description: Run composer commands
    cmd: composer --ansi
  php:
    service: appserver
  mysql:
    user: redstamp
    service: database
    description: Drop into a MySQL shell
  npm:
    service: appserver
  node:
    service: appserver
  git:
    service: appserver
define('DB_NAME', '[database name declared in the lando.yml file]');

/** MySQL database username */
define('DB_USER', 'redstamp');

/** MySQL database password */
define('DB_PASSWORD', 'redstamp');

/** MySQL hostname */
define('DB_HOST', 'database');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

以上是关于text Lando设置模板文件 - apache的主要内容,如果未能解决你的问题,请参考以下文章

在drupal模板项目上运行Lando start或rebuild后如何阻止此错误返回

Lando 无法从我系统上的非 Lando 应用程序访问 URL

text 使用CSV文件设置维护时段。邮件设置文件模板。

text 使用CSV文件设置维护时段。配置文件模板。

markdown Lando,连接数据库

text Apache 2基本虚拟主机模板