How to create an openstack VM instance on a specific port using jcloud api - openstack

I know how to create a VM instance in jCloud using ServerApi but it creates instance on any available port. I want to know how to create an instance on a given port number.
In openstack cli we use --nic port-id parameter to specify the port as show here:
$ nova boot \
--nic port-id=3c564dd5-fd45-4f61-88df-715f71667b3b \
--flavor m1.tiny \
--image fedora-20-x86_64 \
--key-name lars test0
How can I create server using this port-id in jClouds?

https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java#L694
In NovaTemplateOptions, you should be able to specify network details.

Related

How to change the ports in WSO2 APIM without changing the offset

I have a requirement to change the default port(9443) of wso2 apim being exposed.
This was kind of easily achieved using docker say with running and mapping with docker like:
docker run -it -p 2083:9443 -p 2092:8443 --name api-manager wso2/wso2am:2.6.0
This is because the server supports exposing 2083 but not 9443 to public. I would need something similar to be done when trying to run the binary with the following command
sh wso2server.sh
Cannot use the offset method <Offset>-7360</Offset> . As this will change other corresponding ports as well say need 2092 to be instead of 8443.

Fabric orderer not stating with Host IP - Multiple Node setup

I have successfully installed fabric in 5 nodes. One for peer0, peer1, orderer0, kafka and client respectively
I am trying to start order with the following environment set in start-order.sh
ORDERER_GENERAL_LOGLEVEL=info \
ORDERER_GENERAL_LISTENADDRESS=orderer0 \
ORDERER_GENERAL_GENESISMETHOD=file \
ORDERER_GENERAL_GENESISFILE=/root/bcnetwork/conf/crypto-config/ordererOrganizations/ordererorg0/orderers/orderer0.ordererorg0/genesis.block \
ORDERER_GENERAL_LOCALMSPID=OrdererOrg0MSP \
ORDERER_GENERAL_LOCALMSPDIR=/root/bcnetwork/conf/crypto-config/ordererOrganizations/ordererorg0/orderers/orderer0.ordererorg0/msp \
ORDERER_GENERAL_TLS_ENABLED=false \
ORDERER_GENERAL_TLS_PRIVATEKEY=/root/bcnetwork/conf/crypto-config/ordererOrganizations/ordererorg0/orderers/orderer0.ordererorg0/tls/server.key \
ORDERER_GENERAL_TLS_CERTIFICATE=/root/bcnetwork/conf/crypto-config/ordererOrganizations/ordererorg0/orderers/orderer0.ordererorg0/tls/server.crt \
ORDERER_GENERAL_TLS_ROOTCAS=[/root/bcnetwork/conf/crypto-config/ordererOrganizations/ordererorg0/orderers/orderer0.ordererorg0/tls/ca.crt,/root/bcnetwork/conf/crypto-config/peerOrganizations/org0/peers/peer0.org0/tls/ca.crt,/root/bcnetwork/conf/crypto-config/peerOrganizations/org1/peers/peer2.org1/tls/ca.crt] \
CONFIGTX_ORDERER_BATCHTIMEOUT=1s \
CONFIGTX_ORDERER_ORDERERTYPE=kafka \
CONFIGTX_ORDERER_KAFKA_BROKERS=[kafka-zookeeper:9092] \
orderer
Host orderer0 I have set it in /etc/hosts which has no issue in it. But on executing, I get the following error
2018-02-19 12:53:31.597 UTC [orderer/main] main -> INFO 001 Starting orderer:
Version: 1.0.2
Go version: go1.9
OS/Arch: linux/amd64
2018-02-19 12:53:31.602 UTC [orderer/main] initializeGrpcServer -> CRIT 002 Failed to listen: listen tcp XX.XXX.XXX.XX:7050: bind: cannot assign requested address
r
Machine Config FYR
Docker version 17.12.0-ce, build c97c6d6
docker-compose version 1.18.0, build 8dd22a9
go version go1.9.4 linux/amd64
OS : Ubuntu 16.04
You can try:
-e ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 -e ORDERER_GENERAL_LISTENPORT=7050
orderer0 itself can't resolve to any address unless specified in your host.conf.
I have deployed the fabric on multiple nodes using docker swarm mode. You will need to create the swarm mode on one host and have other hosts join it as manager node. After that, you create an overlay network on the top of the swarm. This network is shared among all the nodes and thus allow containers to communicate with each other. You can see the complete tutorial at
hyperledger-fabric-on-multiple-hosts

docker userdefined network - no connection to the outside world

I try to expose a docker container to the outside world (well, to be specific just in my internal network - 10.0.0.0/24) with a static ip adress. In my example the container should have the IP address 10.0.0.200.
Docker version is 1.10.3.
Therefore i created a userdefined network:
docker network create --subnet 10.0.0.0/24 --gateway 10.0.0.254 dn in bridge mode.
Then i created a container and attached it to the container.
docker run -d \
--name testhost \
-it \
-h testhost \
--net dn \
--ip 10.0.0.200 \
-p 8080:8080 \
some image
The container has the correct ip and gw assigned (10.0.0.200, 10.0.0.254 - which is also the ip from the docker created bridge interface) but no communication from the container to the outside world nor from the outside to the container is possible. only thing that works is nslookup but tbh i dont know why this is working.
From another host in the network i can ping the bridge interface which was created through the docker network create command.
A second container connected the the dn network can ping my first container. so communication inside the network seems fine.
As in the docker [network documentation][1]
[1]: https://docs.docker.com/engine/userguide/networking/#a-bridge-network "docker network docu" (second picture in bridge network) it should be possible
It seems that im missing some step or config. Any advice is appreciated, thank you.

How do I find the network ip using docker and travis?

In my local setup, I can run ...
docker run --name myapp -e HOST=$(docker-machine ip default) --user root myapp
... and then use $HOST to connect to any other container (e.g. one running mongodb).
However, in Travis, docker-machine does not exist. Thus, I cannot simply put that line in my .travis.yml.
How do I get the network IP?
The flag --link adds an entry to /etc/hosts with the ip address of the specified running container
docker run --name myapp --link mongodb:mongodb myapp
However please note that:
The default docker0 bridge network supports the use of port mapping
and docker run --link to allow communications between containers in
the docker0 network. These techniques are cumbersome to set up and
prone to error. While they are still available to you as techniques,
it is better to avoid them and define your own bridge networks
instead.
Another option is using the flag --add-host if you want to add a known ip address
docker run --name myapp --add-host mongodb:10.10.10.1 myapp
Option 2
Create a network
docker network create --subnet=172.18.0.0/16 mynet123
Run mongodb container assigning an static ip
docker run --network mynet123 --ip 172.18.0.22 -d mongodb
Add that ip to the other container
docker run --network mynet123 --add-host mongodb:172.18.0.22 -d myapp

Allow Http and Https traffic

When I create my hadoop and spark cluster via bdutil, I would like to set the flags for Allow HTTP and HTTPS flags. I see that when you create VM using GC utill you set the tags. I tried playing around with bdutil to do the same with out any success :( Does anyone have any suggestions??
Thanks,
Ami
One workaround I can think of is that you can create a new network and than create a GCE firewall rule to allows port 80 and port 443 for all the instances without using any tags. Create your new GCE instances with bdutil on this new network. You can use a bdutil flag --network which will specify a network name with which to associate new virtual machines. You can find more information on the bdutil flags on this link.
The bdutil script does not handle parameters in order to tag the VM during their creation. Nevertheless you could try to modify the following section of the script:
run_gcutil_cmd \
addinstance \
--machine_type=${GCE_MACHINE_TYPE} \
--service_account=default \
--image=${GCE_IMAGE} \
--network=${GCE_NETWORK} \
--service_account_scopes=${GCE_SERVICE_ACCOUNT_SCOPES} \
--persistent_boot_disk \
--external_ip_address=ephemeral \
${optional_disk_arg} ${MASTER_HOSTNAME} &
await_async_jobs 'addinstance'
You would have to use the gcloud command which replaces gcutil and is able to tag the instances as well as using the other parameters (i.e zone, machine type, image, etc). You can refer to https://cloud.google.com/compute/docs/instances#tags.

Resources