How to build wso2am docker with customizing? - wso2-api-manager

I add some new java class in carbon-apimgt source code,which was cloned from github.
After building with command "mvn clean install -Dmaven.test.skip=true", i get some changed jar and wars , and i replace it to wso2am-4.0.0 server path corresponding, it works fine as i can access [1] [2] [3] from browser.
[1]. https://localhost:9994/publisher [2]. https://localhost:9994/devportal[3]. https://localhost:9994/carbon[4]. https://localhost:9994/admin
All this are runned by wso2am-4.0.0.zip binnary.I need to make a docker image and run it in centos or ubunto , so how can i do to build a docker image to run anywhere, and use mysql instead h2?

You can use [1] to create a docker image of the product with your custom binary. However, this will use the h2 databases by default. If you want to use MySQL, you'll have to setup the databases seperately and change the relevant configurations in deployment.toml
Alternatively, you can use [2] to run APIM with MySQL. In that case, you'll have to update [3] with the custom image you create.
[1] https://github.com/wso2/docker-apim/tree/master/dockerfiles
[2] https://github.com/wso2/docker-apim/tree/master/docker-compose/apim-with-analytics
[3] https://github.com/wso2/docker-apim/blob/master/docker-compose/apim-with-analytics/dockerfiles/apim/Dockerfile#L20

Related

Why running go env in GoLand's terminal is different from system terminal

The output in GoLand's terminal:
The output of go env in the OS terminal:
GoLand manages some of the environment variables and settings and overrides what's configured in the system so that it can create a reproducible environment between running code in the builtin terminal or when using the editor itself.
From what I can see in the images, I see that there are some differences around the GOFLAGS, GOPROXY, and GOMOD.
If I understand correctly what you are trying to do, then you need to enable the Go Modules support via Preferences | Go | Go Modules (vgo) and enable the Go Modules integration. Once you do this, you'll see that the GOFLAGS value will change.
There you can also set the Proxy field value to configure the GOPROXY environment variable.
The GOMOD difference comes from the directory where you invoked the go env command, as in this case they seem to be different directories. Invoke the command in the same directory in both IDE terminal and OS terminal and you'll see the same value. It indicates which, if any, go.mod file is used in the current command.
Finally, I recommend upgrading to GoLand 2019.3 as it will automatically enable Go Modules support when it detects that the project is created in a directory with a go.mod file present.

Artifactory backup directory is not recognized

I wanted to change the backup to a different disk. I mounted the disk to /mnt2 on centos and when I navigate to Admin > Backups > Backup Daily > Edit backup-daily Backup, I see an option Server Path For Backup. I tried the following two things.
I entered the mount directory /mnt2 and hit run now. The background job fails with the following error in logs.
An error occurred while performing a backup: Backup directory provided
in configuration: '/mnt2' cannot be created or is not a directory.
I also tried creating a tmp2 directory on local drive and entered /tmp2 and hit run now. The background job fails with the same error as above.
Note 1:
I restarted the docker container just to see if it's not picking up file system changes in real time. That did not work.
Note 2:
There is a browse button next to Sever Path for Backup and I dont see /mnt2 or /tmp2 directories I created. I couldnot find anything useful in the documentation either.
How do I change the backup directory for artifactory?
The setup is artifactory with docker.
For artifactory docker instance, a volume needs to be specified so it maps to the local folder, say, /opt/artifactory/.
In my case, /var/opt/jfrog/artifactory(docker) is mapped to /opt/artifactory(local)
I am supposed to create a folder here -- /opt/artifactory/backup_mount. Give read and write access for 1039 user and group. It shows up in artifactory UI as /var/opt/jfrog/artifactory/backup_mount.
Note:
If you create a directory, it shows up without any docker restart.
If you create a mount, restart docker so the mount is recognized.

Docker directory structure in local system

I am using http://blog.thoward37.me/articles/where-are-docker-images-stored/ to understand the directory structure of the docker.That link suggests that every docker image entry under /var/lib/docker/graph/ has three fields json,layersize and /layer. But in my local system i dont find the /layer directory for any image.why is that so ?.Docker version iam using is 1.3.2
No issues.I found the answer. The link i specified uses docker 0.8 and i am using docker 1.3.2. In the new docker version layers of rootfs are found in /var/lib/docker/aufs/mnt/

Build and run a development environment with Docker

We are trying to create a Docker container which will host and run our webapp (mainly written in PHP with Symfony2).
For the moment, the container embeds all the application code, cloned when building the image (through a Dockerfile). The app runs correctly, on OSX, through Vagrant (Precise64 base image).
We are now struggling to share the container embedded code with the host (Vagrant -> OSX) for development purpose (edit a file on the host OSX should affect the container code).
Seems that there is no way to share this folder from container to the host.
Sharing a folder from host to container (-v option of the run command) overwrites the original container folder.
A soft link does not work as well since the hosts (Vagrant and OSX) could not read the original location.
I'm sure that the solution is with the Docker's volumes (http://docs.docker.io/en/latest/use/working_with_volumes/) but we have not figured out yet how to make it works.
Do you have feedback / experience on it ?
You can share your file in OSX to container in the following line:
OSX dir(host) -shared fold-> /vagrant(vagrant) -volume-> container dir(container)
but the the file is saved in you host not container.
If you want save the file in container and share it to your OSX host, all your container file is in a aufs dir in /var/lib/docker/aufs/mnt/{container id}, your can share this fold to you OSX by the feather supported by vagrant or others:
container dir(container) -aufs-> /var/lib/docker/aufs/mnt/{id}(vagrant) -some-> OSX dir(host)

How do I migrate an Artifactory repo to a shared filesystem repo?

I teach high school computer science using Scala and I've managed to set up an Artifactory repo so that when my students download dependencies, we're doing most of our downloading inside the lab, rather than over the internet.
However, all our home folders are on a network drive and the terminals the students use don't have their own hard disks, so it seems silly to have dozens of copies of the same dependencies. Unfortunately, even with an Artifactory repo, SBT/Ivy copies all the artifacts into each user's ~/.ivy2/cache directory.
I've heard that, if I set up a shared filesystem repo then the artifacts won't be copied. What I can't figure out is how to export all the artifacts that Artifactory has cached for me in a format that would be recognized as a filesystem repo. (Exporting normally puts each remote repo in a separate folder that I suppose I'd have to somehow unify, but I'm not exactly sure how to do that. If that's the easiest thing to do, please explain how carefully.)
What I think I'd like to export is the remote-repos virtual repository, but that's not available as a choice on the Export page.
The other tricky part of this is that the same build file should be usable at home, where there is no proxy repo, so I'm relying on the fact that I can use /etc/sbt/sbtopts to override the repository resolution within the lab environment.
Change Ivy home
Define your sbt script with ${SBT_OPTS}:
exec java -Xmx1512M -XX:MaxPermSize=512M ${SBT_OPTS} -jar /etc/sbt/sbt-launch-0.13.0.jar "$#"
Then only in your network environment set SBT_OPTS as:
$ export SBT_OPTS="-Dsbt.ivy.home=/etc/sbt/repository"
The students probably need writing rights to the dir.
What you also can do is use davfs2 on Linux or "web folders" on Windows to simply mount Artifactory as a WebDAV resource (read-only). This avoids any indirection via a local file system, and keeping such a copy up to date.
Unmanaged dependency
How about a solution that will get you out of Ivy?
In your original build using managed dependency, run
> show full-classpath
This should display something like the following:
[info] List(Attributed(/home/foo/helloworld/target/scala-2.10/classes), Attributed(/home/foo/.ivy2/cache/com.eed3si9n/treehugger_2.10/jars/treehugger_2.10-0.3.0.jar), Attributed(/foo/.sbt/0.13.0/boot/scala-2.10.2/lib/scala-library.jar), Attributed(/home/foo/.ivy2/cache/com.github.scopt/scopt_2.10/jars/scopt_2.10-3.0.0.jar))
Create a directory named /shared/project1/lib or something and copy all the above jars in there, except for scala-library.jar.
Next, make a copy of your build and replace libraryDependency with the following:
unmanagedBase := file("/shared/project1/lib")
You should still be able to compile the code.

Resources