markdown 将EngineYard迁移到更新的堆栈

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 将EngineYard迁移到更新的堆栈相关的知识,希望对你有一定的参考价值。

### Steps for Migration
* Make sure all versions of your database are upgraded to versions that are supported in the 
new stack!
* Create a copy of your environment:
  * EY copies your environment structure **without the data**
  * Copied:
    * Applications
    * SSH keypairs
    * Custom chef recipes
    * SSL certificates
  * Not copied:
    * Application data
    * Load balancers
    * Unix packages
    * System gems
  * Must perform a backup and restore of your database
  * Log into EY and navigate to the environment you want to copy
  * You must have atleast one instance in your environment!
  * In the `More Options` area, click on `Copy environment`. A copy of the environment should now be
  available for editing.
  * Make changes and then click on `Copy Environment`
  * Status is shown 

---
### Backup PSQL Database
* Connect to your database via SSH
* `sudo -i eybackup -e postgresql --new-backup`
* [More info](https://support.cloud.engineyard.com/hc/en-us/articles/205408068-Back-Up-the-Database#topic2)
---
### Load Database
* specifically, this assumes you are **moving data from one environmnent to another**
* copy the name of the database file obtained from the command above
* `scp [database file] [username]@[database host]:[target directory]/[filename]`
  * `[database file]` is the name of the database backup file
  * `[username]` is the user for the database instance (default for EY Cloud is `deploy`)
  * `[database host]` is the hostname of the database instance
  * `[target directory]` is the directory you want to copy the backup file to
  * `[filename]` is the name for the file in its new location
  * ex: `scp myapp.2011-11-18T12-20-03.pgz deploy@ec2-172-16-139-19.us-west-1.compute.amazonaws.com:/tmp/postgres/myapp.2011-11-18T12-20-03.pgz`
* Via SSH, connect to the application and database instance and change to the directory where you copied the database backup
file, ex: `/tmp/postgres`
* IF your database came from an EY environment, import the database backup file to the database with command:
  * `pg_restore -d [app_name] [filename] --clean -U postgres`
    * `[app_name]` is the name of the database
    * `[filename]` is the name of the database backup file
    * `--clean` permits overwriting of the existing databas with the backup file
    * `-U` sets the user to the postgresql user who has permission to overwrite the database **(deply user does not have these privileges)**
* [More info](https://support.cloud.engineyard.com/hc/en-us/articles/205408058-Restore-or-Load-a-Database) 
* Restore:
  * List backups: `sudo -i eyrestore --env production --database todo --action list`
  * `todo` is the name of the database
* Restore by index:
  * `sudo -i eyrestore --env production --database todo --action restore --index`
  * `--index` will be obtained by running the list backup command which will output ex: `0:todo`

以上是关于markdown 将EngineYard迁移到更新的堆栈的主要内容,如果未能解决你的问题,请参考以下文章

markdown EngineYard技巧

markdown 使用更新数据库脚本进行迁移

markdown 使用迁移将列添加到现有表

markdown Laravel 5.4:从gulp迁移到webpack

markdown 将Magento 2升级到更新版本

markdown 将自定义厨师食谱从V4迁移到V5