Is possible deploy c++ web server on OpenShift3? - c++

I am trying to deploy a c++ Http web server on OepnShift3 then I referred this.
The problem is:
Shall I put the source code on OpenShift or compile it first then put the executable file on OpenShift?
Is possible to access the OpenShift3 server via Xshell or Ftp?
Any way to get the OepnShift2 account?

It is no longer possible to get accounts on OpenShift 2.
For OpenShift 3, if you wanted to use a custom HTTP server you would need to be able to build a Docker image which includes it and any other files you need. If you can get the Docker image built, then you can deploy it to OpenShift 3.
Although you can get an interactive terminal in the container which runs your application, it doesn't work like traditional web hosting. That is, it isn't a shell access account where you would upload files using FTP or some other means.
Can you explain more about what it is you want to host? Depending on what you are doing there may be builder images already supported by OpenShift which can pull down files from a Git repository and build an image for you.
If OpenShift is new to you, I would suggest you try out:
https://learn.openshift.com
so you understand some of what it can do and how you interact with it.
Also grab down the free eBook and read it:
https://www.openshift.com/promotions/for-developers.html

Related

Unable to send bundle from aws app deployed using aws copilot via github actions

I have deployed my application using copilot deploy which works. It creates a load balancer and when I go to the designated url I can view my react app. However, I'm trying to create a CI workflow using github actions.
My github actions appear to work, they appear to deploy the app. But when I go to the new designated url, I get Uncaught SyntaxError: Unexpected token '<'
If I go to that same url and hit a specific route on it, that actually does work. So I can do url/test and it return "hello world" but it won't return the bundle for the application or it's returning a broken version of it for some reason.
I can't figure out why using copilot deploy normally works, but this doesn't
For context, my app is set up like this. In the root folder there is a Server folder that has the node server file with the routes. In the root folder is also a src folder with the react code. There is a public file. There is the docker file containing instructions. And then there is the build file. So far I've been generating the build ahead of time and then deploying everything. The node server then sends the build.
So presumably, something about the way the docker container is being built via github actions is significantly different than the way it is building using copilot deploy. But, my understanding is that in both cases it is following the same docker file. So I can't figure out what is different about the directory structure it is creating, or maybe its having trouble creating the bundle at all. If anyone has any insight it would be appreciated.
Thanks!

Deploy simple PHP website to Swisscom Application Cloud: how to configure the server?

I am trying to deploy a simple PHP website to the Swisscom Application Cloud, based on cloud foundry.
My website is working fine locally, served by Apache.
I have followed the tutorial, but I am not clear on some aspects.
In the tutorial, the way to check if the app is working normally is to run it in the built-in web server in php through php -S. This doesn't work for me because my website has html extensions for php files and these are not interpreted correctly by the built-in server. In Apache, I can configure that just fine in the httpd.conf file, but here I don't know how to configure such a behaviour.
That's fine by me, because I can still check the website locally serving via Apache. The problem is that it looks that in the cloud this is the way to run the app as well, although I couldn't find more info in the documentation.
I'd be surprised that this is how the app is run in production because the php documentation states the following about the built-in server:
"It is not intended to be a full-featured web server. It should not be
used on a public network."
Are the web apps being run on Apache in the Swisscom Application Cloud? If yes, how do I get access to configure the httpd.conf and php.ini files? If no, how can I configure the special behavior I need for my app?
UPDATE:
Here is a sample php app which summarizes what I am trying to achieve: deploy it in cloud foundry interpreting html files as php files.
https://github.com/atineoSE/sample-php-app-cloudfoundry
Following #daniel-mikusa 's links to documentation I added special config related to the mime types under .bp-config/httpd/extra/httpd-mime.conf. This doesn't work as expected, though. Accessing from firefox, I am prompted to download the file. It works fine when I serve it locally via Apache with the same directive in the httpd.conf file.
The PHP build pack does not use php -s. I suppose that you could, but it's not the default. The default setup is to use PHP-FPM & Apache HTTPD, or ou can optionally use PHP-FPM w/Nginx.
For the most part, the PHP build pack should just run your app. There are occasionally things you need to adjust, and they are easily configurable by adding .bp-config/options.json to the root of your app.
I don't know anything about your app though, so I can't really say. If you can't get what you need with options.json you can customize the configuration for HTTPD, Nginx or PHP too. Check out the docs here for instructions to do that.
http://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html#engine-configurations
Hope that helps!

Serving an Angular2 App on aws s3

I have created a Angular 2 form which posts the form data to a postgres DB using a Rest API. Now, I want to serve my Angular 2 app on AWS S3. I googled on this and I found that creating a webpack is a solution but not able to create one. I want to know where to start with, to bundle my code and serve it on s3.
GitHub link for Form: https://github.com/aanirudhraj/Angular2form_signaturepad_API
Thanks for the Help!!
The quickest way is to build the app using angular-cli and then deploy the content of the 'dist' directory as a static site in S3 (an S3 bucket can be configured to host a static site; make sure you assing read permission to 'anybody' to avoid http 4xx return codes).
You just need to host it as a static site on S3.
Check this: http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html
I infer from your code that you are using angular-cli.
Create a dev/production build
ng build --dev / ng build --prod
Content of your dist folder will contain bundled files for deployment. Your primary file for refrence will be 'index.html' as this will load you angular app.
You need to decide what kind of server you'll be using to serve you webapp.
For development purpose when we do ng serve , webpack-dev-server is used as a static file server (local development). I'll recommend should go with the most comfortable/cost effective solution you can have when deploying to actual server.
Static file Server
Directly hosting website is aws space as a static website.
Aspnet Core with static file server middleware. (*)
Nodejs Express with static file server middleware.(*)
Java serverlet for serving static files. (*)
(*)Following aproach will also allow you to have some server-side code if you require in future.
When you deploy your ng2-app, you should use AOT(ahead of time) compile.
I guess you are using JIT(just in time) compile.
In angular2 guide page,
With AOT, the browser downloads a pre-compiled version of the application. The browser loads executable code so it can render the application immediately, without waiting to compile the app first.
When you use JIT compile, your browser will download vendor.js which is defined by angular2 compiler and it will compile your app just in time. It will be too slow and your client have to download vendor file. When you use AOT, you dont have to use vendor file, so resources are being smaller.
I recommend to use AOT compile when you deploy your app, and use lazy loading for resource size.
If you are curious about ng2 AOT compile, read this guide.
angualar2-cookbook-AOT
And here is example angular2 app with webpack2 and lazy load.
use file structure and config files in here.
When I tested with example app, files bundled with aot was smaller than 500KB.
angular2-webpack2-aot
When you use aot compile with #ngtools/webpack or whatever,
just put all files in dist directory which have files compiled with aot in your S3 bucket, and I recommend to use aws cloudfront cache for your s3 bucket resources.

webservice deployment issue

I deployed webservice written in .net language through IIS from my local machine,Is there any possible way to access remote HTTP server which contain different OS and different technologies
Sorry for being confused, but can you define:
different OS and different
technologies
Do you mean deploy your webservice to another host or
Do you mean consume a webservice from another host?
Option 1
If the host is not running IIS/ASP.NET I think you are going to have some issues as Mono may not run what your code base requires.
But you could try the following:
publish your site to a folder
zip up that folder
scp/ftp/upload this zip to the remote server
unzip the files (or upload individual files/folder) to directory configured by IIS Management
try to run
Option 2
You need to use either the svcutil tool to create the proxy clients to consume that webservice or you use the Add Web Reference in Visual Studio to automate this for you.
Hope this answers your requirements. Update your question with more information for the community to offer more support.
I think that is one of the main things that web services are for.

Is there a way to bind my flex builder to my django application

I am trying to create simple flex application, which uses django as a back-end part. Have a question:
Usually when I run my application Flex Builder creates a file in a directory on my local PC and then opens a browser and points to it. Everything was fine, but when I decided to link django server to flex applications via xml data providers I started to get security errors. (Related to absence of crossdomain.xml). When I created the file and put it on the server:
<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="http://127.0.0.1:8000"/>
<allow-access-from domain="127.0.0.1"/>
</cross-domain-policy>
Then tried the application again, I got error in console of my FB Error: Request for resource at http://127.0.0.1:8000/go/active/ by requestor from file:///Users/oleg/Documents/FB3/usersList/bin-debug/usersList.swf is denied due to lack of policy file permissions.
I don't know how to fix the error. But also the question is there a way to configure FB3 to put my swf files to the server directly, so I will not need any crossdomain?
Thanks
Oleg
We struggled with this a lot. The Flex security stuff didn't strike me as well built, but perhaps we just had different approaches in mind than Adobe's developers. The solution that worked for us was to serve both the SWF and the dynamic data from the same host and port.
On our development boxes, we tell Apache to serve the SWF from a directory in the workspace, and the dynamic data from a local copy of the app. When we push to production, SWF and app get pushed simultaneously to the same virtual host.
If that's inconvenient for you, the Apache ProxyPass directive can be used to make Apache front for other servers. I've not used that in production, but it's been very handy for developer setups.
I don't know a way to get FlexBuilder to automatically deploy your changed SWF; you could certainly look into an automation approach (like Maven and Flex-Mojos) to make that happen.
That said, getting rid of that error is usually just a matter of adding a policy file to the server.
The second error is caused because you're trying to fetch http resources from a "file" location. My recommendation is that you change your Flex Builder project so it outputs to a location within the Django web site, rather than to the flex-bin directory. This setting can be changed in the properties dialog of the project. Then, you should be able to have your front-end and back-end share the same protocol and domain.