如何在不通过SSH和CLI访问生产的情况下部署symfony项目 [英] How to deploy a symfony project without SSH and CLI access to production

查看:53
本文介绍了如何在不通过SSH和CLI访问生产的情况下部署symfony项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数托管服务提供商仅具有FTP访问权限.

Most of the hosting providers only have FTP access.

是否可以/通常在本地安装symfony项目(3.x或4.x),然后再通过FTP上传并手动创建/更新数据库?

Is it possible/common to do a local installation of a symfony project (3.x or 4.x) and later upload it via FTP and manually create/update the database?

这个问题使我无法完全从symfony开始.

That question is holding me back on starting fully with symfony.

谢谢!

推荐答案

这种情况虽然不理想,但是可以做到.

This scenario it is not ideal but it can be done.

实际上,我们将采用这种方式通过持续集成服务器构建所有内容,并只有一个zip文件,其中所有内容都可以将生产部署到AWS Beanstalk,因此我们可以将部署过程从几分钟缩短到几秒钟.

Actually we are going that way building everything with our continuous integration server and having just a zip file with everything ready for production to deploy to AWS Beanstalk so we can speedup the deployment process from minutes to seconds.

场景

先前的生产版本:/var/www/mywebsite-old

Previous production version: /var/www/mywebsite-old

当前生产版本:/var/www/mywebsite

Current production version: /var/www/mywebsite

下一个生产版本:/var/www/mywebsite-new

Next production version: /var/www/mywebsite-new

准备构建

您需要离线准备应用程序:

You will need to prepare the app offline:

  • 设置parameters.yml
  • 环境变量-我认为它们是在$ parameter-> resolve()期间复制到缓存的.
  • 作曲家安装
  • composer dump-autoload
  • cache:clean --env产品
  • 删除日志
  • 资产:安装--env产品

上传构建版本

完成构建"后,将所有内容上载到服务器,而不是非活动位置.在此阶段,您的项目非常繁琐,因此可能需要花费一些时间来上载,或者它可以部分上载,因此您不希望破坏生产服务器. 在var/cache和var/logs var/sessions以及上载文件夹中设置正确的文件夹权限.

Once you finish your "build" you upload everything to your server preferable to a non live location. At this stage your project is quite heavy so it may take time to upload, or it can partially upload so you do not want to break your production server. Set the right folder permissions in var/cache and var/logs var/sessions as well as in the upload folders.

示例:/var/wwww/mywebsite-new/

Example: /var/wwww/mywebsite-new/

交换版本

Capistrano为此提供了一个非常有趣的模型.

Capistrano has a really interesting model for this.

  1. 将/var/www/mywebsite重命名为/var/www/mywebsite-old
  2. 将/var/www/mywebsite-new重命名为/var/www/mywebsite

运行学说迁移

您有一个本地设置来进行构建,如果您必须进行一些数据库迁移,请在本地数据库中运行它们以连接到生产数据库

You have a local setup to do your build, if you have to do some database migrations run them there connected to the production database

最终推荐

这是很多步骤,可能会出现问题,我真的建议您将所有操作自动化以进行升级和降级(如果将旧版本重命名为生产版本),以防万一您做错了什么.

This are many steps where things can go wrong and I really recommend you to automate everything to do an upgrade as well as a downgrade (rename the old version back to production) in case you did something wrong.

选项:

  • Bash脚本/Makefile
  • Capistrano
  • 部署者

这篇关于如何在不通过SSH和CLI访问生产的情况下部署symfony项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆