Openstack juju yaml field explanations - openstack

Can someone explain the meaning of the following key-value pairs in the following text?(or share the link that explains this. I went through the link http://pythonhosted.org/juju-deployer/config.html#placement but have difficulty in understanding it). It is part of the yaml bundle for deploying openstack.
keystone:
annotations:
gui-x: '500'
gui-y: '0'
charm:
cs:trusty/keystone-31
num_units: 1
options:
admin-password: openstack
ha-mcastport: 5403
openstack-origin: cloud:trusty-liberty
to:
lxc:3

Although, this question is pretty old but let me explain a few things that I have little understanding about.
Annotations define where the service is placed on juju-gui (where juju gui is a graphical representation of services which you access from browser)
cs:trusty/keystone-31 is a charm URL format for a juju controller which specifies that keystone charm version 33 of trusty series should be fetched from juju charms store. Juju controller controls the deployment of services/charms.
num_units: 1 define the number of charm units to deploy
options are configuration parameters of a service (charm). Each charm has the configuration parameters defined in config.yaml file
to option defines where to deploy the service. In your example, lxc:3 specifies that the service should be deployed on Machine No. 3 in an LXC. It is to be noted that Juju 2.0 has replaced LXC provider with LXD, so services are now deployed in LXDs.

Related

How to integrate two Symfony projects that are on different servers?

I have two symfony projects and that share the same database servers.
I would like to, if possible, from one project call some Entity/Repository of another. The problem is:
Both project are in different servers.
So, is there some way to, maybe using services, make the projects talk to each other?
I tried to create a service passing SERVER IP + folder directory but it returns an error like:
what i did:
Ia\:
resource: "ftp://172.21.0.6/src/"
what returns:
Warning: file_exists(): connect() failed: Connection refused in
Short anwser: no. You cannot use php classes of another project hosted on another host.
What you could do:
Talk http: Expose functionality of project A in api endpoints and call those endpoints from project B.
Introduce your own library: Factor out common functionality into a third project, namely a library that you install in both projects (using composer).

Symfony 4 How To Use a Bundle To Share Entities + Repo Across Apps

I've a need to link 2 applications to the same database and same entities in Symfony 4, after some reading around it looks like this can be done with bundles. I've not actually worked with bundles before as i cam into symfony at version 4 where it wasn't really needed.
I've not been able to find any documentation for it, i see symfony's here https://symfony.com/doc/current/bundles.html but this just explains how to create the structure, it doesn't explain how to then use the bundle across the two apps.
Please could someone point out where i would find this information, or perhaps an example? My current setup is as follows:
api -> main app with symfony 4
admin -> my second app which will run an admin interface but is separate from the main app, this is the one that needs to share entities with api app.
I have so far created the directories in the "admin" one like:
src/MyOrg/MyOrgBundle/MyOrdBundle.php
I have then loaded this in the config/bundles.php -> this is where i am now a bit lost. The main thing is, i can't figure out how to load my bundle into both applications from a shared location, i don't really want to duplicate the files in both apps if i can get away with it.
UPDATE
I have just been playing around with config/doctrine.yaml and changed the following to test:
mappings:
App:
is_bundle: false
type: annotation
#dir: '%kernel.project_dir%/src/Entity'
dir: '%kernel.project_dir%/../share/Entity'
prefix: 'App\Entity'
alias: App
When i run php bin/console make:entity and put TestShare for example, it produces this error:
[ERROR] Only annotation or attribute mapping is supported by
make:entity, but the App\Entity\TestingShare
class uses a different format. If you would like this command to generate the properties & getter/setter methods,
add your mapping configuration, and then re-run this command with the --regenerate flag.
And it creates the entity in src/Entity instead of ../share/Entity - but i just told it where to put them in the config?

Scheduling Tasks in GoDaddy windows shared hosting

I am trying to create a scheduled task in GoDaddy windows shared hosting account. I have some logic in my .Net C# class project where I have to call a function on daily basis. I have tried by converting it to an executable(.exe) and configured in godaddy as per
https://in.godaddy.com/help/scheduling-tasks-with-plesk-shared-hosting-8970
But that doesn't work for an .exe.
Eventually I have tried calling that function from an aspx by referencing the class project in the WebApp (because that's what the URL suggests). Now I am blocked with some error which says Exception calling "DownloadString" with "1" argument(s): "URI formats are not supported."
Looks like I am doing something wrong while configuring my aspx.
These are my configuration details:
Path to an executable file:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments:
-c "(new-object system.net.webclient).downloadstring('http://DOMAIN_NAME.in\SOME_FOLDER\Default.aspx')"
Called up GoDaddy folks to provide a sample, But they said they do not any sample for the same (very irritating).
Can Someone help me with this?
Godaddy already removed task scheduler and they no longer support it since March 2018.
I have found the issue with my configuration, in fact I have just managed to make it work, here it is:
ASPX Deployment:
Path to an executable file:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments:
-c "(new-object system.net.webclient).downloadstring('http://YOUR_DOMAIN.in/Default.aspx')"
Note: Default.aspx must be placed in httpdocs folder (This is the default folder where you place your website related files).
PHP Deployment:
Path to an executable file:
C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP54\php-cgi.exe
Arguments:
G:\PleskVhosts\readefy.in\httpdocs\YOUR_SCHEDULED_TASK.php
NOTE: Looks like only these 2 options are available for scheduling your tasks via windows shared hosting.
you can create a API and call it by
Executable : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Argument : Invoke-RestMethod 'mysite.com/API/MethodName"
The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

Opsworks Chef 12.0 manage two cookbook with one common file

I am using AWS Opsworks and have a stack of Chef 12.0 .. Question since in Chef 12 cookbook dependency is not supported.. I managed to create a cookbook that install my webserver and deploy an APP .. to support 2 APP in different stack they have different cookbook but has a common file which is installing the webserver (/recipes/webserver.rb) , is there a method that the cookbooks can just inherit/call a common file? Coz I don't want that if there are changes in the webserver recipe I have to update two cookbooks.
Thanks in advance
You can use include_recipe to include one recipe in another. You also might want to look in to putting the common logic in a custom resource and using that in both application recipes. Check out https://github.com/poise/application_examples/ for some examples of resource-driven application deployment.

Spring Boot Environment-specific configurations

I have a spring boot application that uses the actuator, auto-configuration and JPA. I want to be able to use an in-memory DB in my test profile, a MySQL DB configuration during development and a separate production DB configuration when the app is deployed in production. Presumably from the java command line I should be able to specify the environment and the right configuration file or config block in application.properties (or .yml) will be picked up.
I have not found a good post with example describing how to do this switching so I thought I'd ask if anyone has a good example. My main aim is to pre-define the spring.datasource and spring.jpa properties at build time and then at run-time switch the app config per environment "dynamically" using the java command line argument. Secondary goal would be to do the same with the management configurations, etc.
Thank you.
Thanks to #Richard for the mention of spring.profiles.active JVM variable. Since my question was specific to the way Spring Boot does this and since there is much more to the answer, I am inclined to answer this myself and include all the details of how I arrived at the answer in the hopes that it will save others time.
First, you can indeed pick the correct profile on the java command line by adding -Dspring.profiles.active=profile_name when you are running your Spring Boot app. (this is assuming your deployment preference is an uber jar with embedded container - Tomcat in my case)
I wanted to leave MySQL datasource configurations under the default profile and put H2 in-memory datasource configuration under a test profile. However, the way Spring Boot picks the right datasource based on profile is not so obvious. Even though I had MySQL details under the default profile and I had the in-memory H2 datasource details under the test profile, it would still pick H2 as the datasource even when spring.profiles.active was omitted from the command line. This was contrary to my assumption that default profile will be picked, well, by default :-)
I ended up having to put H2 configuration under the default profile and then create a local profile that included the MySQL datasource configuration. Here's what I ended up with in my application.yml
spring:
profiles: default
spring:
datasource:
driverClassName: org.h2.Driver
url: jdbc:h2:mem:sampletest;MODE=MySQL
---
spring:
profiles: test
spring.jpa:
hibernate:
ddl-auto: create-drop
---
spring:
profiles: local
spring.datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1/sampledev
username: sample
password: sample
spring.jpa:
hibernate:
dialect: org.hibernate.dialect.MySQLInnoDBDialect
ddl-auto: update
This worked. I was able to switch between default profiles and the local profile by omitting or adding the -Dspring.profiles.active=local on the java command line. Because test profile inherits from default it is also using H2
One more nuance: I added ddl-auto: create-drop to the test profile which uses the in-memory DB to facilitate automatic table creation / teardown for unit tests. But for the local profile which uses MySQL I changed it to update. Implication being that for the local profile I have to first create the database outside of the application.
this article shows how to use spring profiles, available in spring 3.1 and later. It will do exactly what you want.
http://chariotsolutions.com/blog/post/spring-3-1-environment-profiles-2/
set a JVM variable like this: spring.profiles.active=development
then in your configuration xml you can wrap environment specific xml with the profile tags
<beans profiles="development">
<bean id="dataSource" class="..."></bean>
<bean id="messagingProvider" class="..."></bean>
</beans>
You can also set the profile on annotation-driven classes with #Profile("development") at the beginning of the class. That class will only be autowired if the profile matches.
For unit tests you can set the active profile on a test class with #ActiveProfile(profiles = "test", "CI"), it will run using test and CI resources

Resources