Deploy Drupal 9 site from ubuntu local machine to shared hosting - web-deployment

I am newbie with drupal. My Drupal 9.4.3 sit dev.xyz.in created with composer is ready for deployment. I have a linux based shared hosting plan.
My Local web development environment/IDE is :
OS Ubuntu 18.04LTS
php 7.4.3
mariaDB 15.1
local server nginx
My website directory structure – var/www/dev.xyz.in
dev.xyz.in
| - config
| | - sync
| | | - .htaccess
| - drush
| | - Commands
| | - sites
| | - drush.yml
| | - README.md
| - scripts
| | - composer
| - vendor
| | - composer
| | - drush
| | - bin
| | - twig
| | - symphony
| | - …. more
| - web
| | - core
| | - modules
| | | - contrib
| | | - ds
| | - profiles
| | - sites
| | | - default
| | | - default.services.yml
| | | - default.settings.php
| | | - settings.local.php
| | | - settings.php
| | - themes
| | | - contrib
| | | - custom
| | - update.php
| | - .htaccess
| | - …. more
| - .github
| - composer.json
| - composer.lock
| - load.environment.php
| - phpunit.xml.dist
| - README.md
| - .editorconfog
| - .env.example
| - gitattributes
| - .gitignore
I have changed some settings locally on settings.php as given below:
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
and
$settings['trusted_host_patterns'] = [
'^localhost',
];
I have changed some settings locally on settings.local.php as given below:
$settings['rebuild_access'] = TRUE;
changed it to
$settings['rebuild_access'] = FALSE;
How can I deploy my website to linux based shared hosting using ftp (filezilla) and what necessary change will taken before deployment of local website? please help me!

Related

Nginx root directory with nested symlinks

Our website (laravel) project directory is like this:
/home/user/project/{app,route,public_html,storage,...}
New releases are placed in:
/home/user/releases/v1
For some reason we have to link public_html directory for every release, so:
/home/user/releases/v1/public_html > /home/user/project/public_html
Nginx root diretory is:
/home/user/www/site/public_html
Which:
/home/user/www/site > /home/user/releases/v1
Since NGINX will follow symlinks, final root directory would be:
/home/user/project/public_html
Is there a way to fix this situation?
Since the root of your virtual host is /home/user/www/site/public_html and since /home/user/www/site/public_html is a symlink to /home/user/project/public_html and since /home/user/project/public_html is a symlink to your latest release - nginX location blocks will actually search inside /home/user/releases/v1/public_html.
Here is an example. Let's say we have a folder /my_releases. Everytime I publish/deploy a new release I will create a new subfolder inside /my_releases with the version of the release (/my_releases/v1, then /my_releases/v2 and so on). All assets of the release will be inside the corresponding subfolder - so I will have
/my_releases
|
+---- /v1
| |
| +--- /css
| | |
| | +--- /home.a120cd8.css
| |
| +--- /img
| | |
| | +--- /logo.7f40c3a.svg
| |
| +--- /js
| | |
| | +--- /main.ba4de98.js
| |
| +--- /api
| | |
| | +--- /index.php
| | |
| | +--- /routes
| | |
| | +--- /login.php
| +--- /index.html
|
+---- /v2
| |
| +--- /css
| | |
| | +--- /home.7845c7.css
| |
| +--- /img
| | |
| | +--- /logo.23038ad.svg
| |
| +--- /js
| | |
| | +--- /main.acb33f1.js
| |
| +--- /api
| | |
| | +--- /index.php
| | |
| | +--- /routes
| | |
| | +--- /login.php
| +--- /index.html
........ next releases until the end of the world
My nginX is configured in such a way, that my virtual host has
server {
server_name my.personal.web.site;
root /var/www/public_html;
.....
}
Before starting nginX, I have run the following 2 commands:
ln -s -f -n /my_releases/current /my_releases/v1
ln -s -f -n /var/www/public_html /my_releases/current
Then I started nginX - service nginx start. It will now serve v1 of my web site/application.
Now, any time I deploy a new release, I run the following command (replace v2 with the relevant revision)
ln -s -f -n /my_releases/current /my_releases/v2
Don't forget to set the proper filesystem permissions and ownership.

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems
According to the official documentation Mitaka official documentation operations, Step 3 Upload the image to the image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it:
I execute the following command
openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
The size of the image in the output is zero. How should I check this problem
[root#controller ~]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | d41d8cd98f00b204e9800998ecf8427e |
| container_format | bare |
| created_at | 2020-05-24T14:45:54Z |
| disk_format | qcow2 |
| file | /v2/images/c89f6866-0c48-4ee5-84f1-bf7fa0998edf/file |
| id | c89f6866-0c48-4ee5-84f1-bf7fa0998edf |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | a9629b19eb9348adbf02a5432dd79411 |
| protected | False |
| schema | /v2/schemas/image |
| size | 0 |
| status | active |
| tags | |
| updated_at | 2020-05-24T14:45:54Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+

docker - multiple projects on one Dockerfile and docker-compose.yml

I'm starting with Docker and in my opinion is great! Now I'm looking solution for this organization:
Now I have this structure:
Applications
| +--app1
| | +--node_modules
| | +--package.json
| | +--...
| +--app2
| | +--node_modules
| | +--package.json
| | +--...
| ....
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile //my personalized image for all projects
But I want reach this:
Applications
| +--app1
| | +--node_modules //empty in host
| | +--package.json
| | +--docker-compose.app1.yml //override compose
| | +--...
| +--app2
| | +--node_modules //empty in host
| | +--package.json
| | +--...
| ....
| +--node_modules //global node_modules folder (linked to projects)
| docker-compose.yml //principal compose
| Dockerfile //my personalized image for all projects
I thinking too about create one global "server" and link all projects on VHosts but how I'll get access to each of project?
You are looking for docker-comopose extends. Thas permits you override previus configurations.
web:
extends: file: common-services.yml
service: webapp
See full documentation in : https://docs.docker.com/compose/extends/#extending-services

glance doesn't work due to authentication fail

I'm setting up Openstack on some machines. I was following this guide http://docs.openstack.org/liberty/install-guide-ubuntu/ until I ran into this problem:
When I'm verifying Image service (Glance), I got the following problem:
$ cat admin-openrc.sh
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=passw0rd
export OS_AUTH_URL=http://Renaissance:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
$ source admin-openrc.sh
$ glance --debug image-create --name "cirros" \
> --file cirros-0.3.4-x86_64-disk.img \
> --disk-format qcow2 --container-format bare \
> --visibility public --progress
curl -g -i -X GET -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'User-Agent: python-glanceclient' -H 'Connection: keep-alive' -H 'X-Auth-Token: {SHA1}7ce8d893ef6cdaca2ed5a876c8211a841455ba65' -H 'Content-Type: application/octet-stream' http://Renaissance:9292/v2/schemas/image
Request returned failure status 401.
Invalid OpenStack Identity credentials.
I would get same error using any other glance function (e.g. glance image-list).
I think I'm having my configurations correct since I followed the guide.
Here's my Openstack services, projects, users, roles and endpoints
+----------------------------------+----------+----------+
| ID | Name | Type |
+----------------------------------+----------+----------+
| bf585630a5cb475b9e883493de3813fa | glance | image |
| fc29e468dae849e6afb97ecc3bf487f6 | keystone | identity |
+----------------------------------+----------+----------+
+----------------------------------+----------+
| ID | Name |
+----------------------------------+----------+
| 0bc473b2e77a4a9bb7871ed2afacb995 | admin |
| dcaf480621164c409b6704c3f42e0869 | service |
| e9f709d860fe46e2819b6bf1c78ccd0f | nonadmin |
+----------------------------------+----------+
+----------------------------------+----------+
| ID | Name |
+----------------------------------+----------+
| 485374adcbe54ce5b9ef465b84aa2c9f | admin |
| 7447f4cd56f64ccfb111cba74f9a4b92 | nonadmin |
| d9ffc32240d24328b10af8b2550ec414 | glance |
+----------------------------------+----------+
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 466fea231ef54d3ca4564fb42f51bb5c | admin |
| a36c726d27f04ebf92d336c3acfcd945 | user |
+----------------------------------+-------+
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------+
| 01f62a7b9f7f4fa782e8bc695e74afc1 | RegionOne | glance | image | True | internal | http://Renaissance:9292 |
| abb7e5052d8646428e82ef58ca21b376 | RegionOne | keystone | identity | True | public | http://Renaissance:5000/v2.0 |
| d5b3180255b44a0eafe0810a20e104bc | RegionOne | glance | image | True | public | http://Renaissance:9292 |
| e0392842c6f64ac389a5688bc2581192 | RegionOne | keystone | identity | True | internal | http://Renaissance:5000/v2.0 |
| e0eb3dd0ed774669bce9a74dd3831c05 | RegionOne | keystone | identity | True | admin | http://Renaissance:35357/v2.0 |
| ec855dca8f87454e997fd55c47f17703 | RegionOne | glance | image | True | admin | http://Renaissance:9292 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------+
My auth configuration of glance (in glance-api.conf and glance-registry.conf) is listed below:
...
[keystone_authtoken]
# Complete public Identity API endpoint. (string value)
auth_uri = http://Renaissance:5000
auth_uri = http://Renaissance:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = passw0rd
...
And I can get token using Openstack:
$ openstack token issue
+------------+----------------------------------+
| Field | Value |
+------------+----------------------------------+
| expires | 2016-10-01T01:16:48.482839Z |
| id | 2a4e052a2c4140a28f550158d95ecd3b |
| project_id | 0bc473b2e77a4a9bb7871ed2afacb995 |
| user_id | 485374adcbe54ce5b9ef465b84aa2c9f |
+------------+----------------------------------+
I'm guessing its the api version problem, but I've been changing the version number in the uri but it didn't work. Any help is appreciated. Thanks!
in your glance configuration, the project name is service, but your env var project name is admin.
solutions:
ensure passw0rd is the real pw to glance:service account
change glance conf to use admin project instead

How do I get a list of bundles in symfony2/symfony3?

I've just started using symfony and I'd like to get a list of bundles from a particular vendor, iterate through them and call a $bundle->renderSomething() function on each default controller.
Firstly, I need to get the list of bundles to iterate, or iterate through each object. Any ideas on the best way to do that?
The easiest way to do it in console and that outputs bundle names correctly is:
Symfony 2
php app/console config:dump-reference
Symfony 3
php bin/console config:dump-reference
The key here is not to provide any options or arguments. In this case, the command simply outputs all available bundles:
Available registered bundles with their extension alias if available:
+------------------------------------+-----------------------------------+
| Bundle name | Extension alias |
+------------------------------------+-----------------------------------+
| FrameworkBundle | framework |
| SecurityBundle | security |
| TwigBundle | twig |
| MonologBundle | monolog |
| SwiftmailerBundle | swiftmailer |
| DoctrineBundle | doctrine |
| AsseticBundle | assetic |
| GearmanBundle | gearman |
| SMMemcacheBundle | sm_memcache |
| PrestaSitemapBundle | presta_sitemap |
| DoctrineCacheBundle | doctrine_cache |
| CybernoxAmazonWebServicesBundle | cybernox_amazon_web_services |
| FOSFacebookBundle | fos_facebook |
| HWIOAuthBundle | hwi_oauth |
| FkrSimplePieBundle | fkr_simple_pie |
| RMSPushNotificationsBundle | rms_push_notifications |
| RobertoTruToInlineStyleEmailBundle | roberto_tru_to_inline_style_email |
| InsomniaMaxMindGeoIpBundle | insomnia_max_mind_geo_ip |
| EWZRecaptchaBundle | ewz_recaptcha |
| MopaBootstrapBundle | mopa_bootstrap |
| JanThomas89MailSafeBundle | jan_thomas89_mail_safe |
| WebProfilerBundle | web_profiler |
| SensioDistributionBundle | sensio_distribution |
| SensioGeneratorBundle | |
+------------------------------------+-----------------------------------+
If you have container object available then you can get array of the enabled bundles by $this->container->getParameter('kernel.bundles');
You can define a static function in each bundle. Ex: YourBundle::yourStaticFunction();
Use $this->container->getParameter('kernel.bundles') to get the list of bundles. This only returns the bundle class names instead of the Bundle object. Go through each bundle, check if the bundle has the function yourStaticFunction(), Hint: Use method_exists(). If the method exists, then call ::yourStaticFunction();
In console you can use php app/console container:debug --parameter=kernel.bundles
If you want to call a non static method of registered bundle object (not class) then you can do the following:
$kernel = $this->container->get('kernel');
$bundles = $kernel->getBundles();
$bundles['YourBundleName']->someMethod();
Where 'YourBundleName' is the name of your bundle, which you can get by calling from console:
php app/console config:dump-reference

Resources