E
E
Express7772017-09-01 09:11:58
Yii
Express777, 2017-09-01 09:11:58

How to deploy (deploy) YII2 in production on VPS hosting?

Hello.
There is a YII2 project on Bitbucket version 2.0.12, template basic. You need to deploy it on a VPS. But the project has /tests, /runtime folders that are not needed / create a load / take up space on the hosting. You need to deploy the project to production in the YII_ENV_PROD environment and without the /test & /runtime folders. Although this is a VPS, but, from external packages, you can only use git & composer.
gitignore for the base project:

gitignore
# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
/vendor

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml

tests/_output/*
tests/_support/_generated


Question:
How to correctly deploy a project without these extra folders?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
matperez, 2017-09-01
@matperez

In vain you are so with them. The tests and runtime folders do not give you any load. The size of tests is usually negligible compared to the rest of the system, and its very presence does not create any load on the server (nothing at all). Without the runtime folder, you will not be able to run the project, this is a folder for temporary files that appear during operation.
You can deploy the project manually, with a self-written script, or with the help of ready-made tools like Сapistrano .
When deploying, it's better to make sure that when installing packages, Composer starts with the --no-dev (do not install dependencies required for development) and -o (optimize autoloader) switches - this will really give a gain both in terms of system load and in terms of space occupied .

M
Maxim Fedorov, 2017-09-01
@Maksclub

runtime is needed for the cache, sort of like
adding folders to .gitignore (like a vendor folder) and deleting it from the repository
, but generally expand it:

git clone <_адрес_репо_>
composer update
./yii migrate/up

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question