How to publish an ASPNET Website automatically to a Linux VPS? - asp.net-core

Hello I want to build a build pipeline for a website. Whenever someone pushs something to git I want to trigger an action which builds the website (got that working with teamcity) and automatically deploys it to a staging server (docker container on some linux vps)
I could upload the artifact per ftp and check the ftp folder on the server per cronjob or something similar. But there has to be a better solution. Can you help me with that? Thank you.
TLDR I want to build, deploy and restart a website on every push to git.
Everything is selfhosted. No AWS, Azure or similar

Related

I want to turn my localhost server into a real website

I created an application that runs on a localhost server using expressjs. And I also bought a domain.
I'm wondering if there is a way to take that localhost server and turn it into a real shared server
I tried once to use a hosting service like hostgator but I still don't know how I can turn the express app into a real website.
I have no experience with any web development services so please don't tell me to use ....... whatever because I will have no idea what that is.
For one thing it is not clear how your website actually works: if it is only express does it generate HTML or is it purely JSON passed to browser clients via get requests (to each their own).
There are so many options as to how you might do this: one of the best options is to first make sure your server runs on Docker. Find a tutorial on YouTube/google/Stack Overflow/Blogs on how to run your Express server with docker. If you do that you can deploy it to a Container manager like Google/Amazon/Digital Ocean. If this seems hard to you there are other options.
Presumably you run your server with something like npm start. This guide can show you how to do essentially that but on a cloud computer.
Before you begin make sure that you're locally working server is checked in to a cloud Git provider like Github, GitLab, Bitbucket, etc.
Since Amazon AWS, and Google Cloud have free tier or options for hosting for free for a certain amount of time (AWS 1 year) or for a certain amount of money (Google Cloud). These two seem like viable place to start.
If you find the option that you'd like you'll need to:
create an account
Create a server (choose a cheap one especially initially like mice/small/cheap etc).
Find a tutorial on how to "SSH" into that server (which basically means remotely control the terminal on that server). Google actually makes this fairly easy there's a big button that says SSH into this server.
Once you've logged into that Computer you'll be able to run the same commands you probably normally do on your home computer:
The computer you'll be getting is likely to be a virtual Linux Computer probably something like Linux Ubuntu. Find a tutorial on how to get git and node installed there (but it's something like sudo apt-get update && sudo apt-get install git node).
Once you have git and node try mkdir www and cd into that: mkdir www && cd project (This isn't critical but conventional.)
Copy the link that allows you to "Clone your repo using HTTPS" (there's a link at the top right of your GitHub (or others) repo that allows you to do that. You'll need to enter your password
Now all the files that you had on your computer are on this new computer.
Next you'll have to probably npm i to install your dependent NPM packages. (This assumes you properly used .gitignore to prevent GitHub from being filled with extra copies of your npm packages.)
Now you should be able to run your code as usual: npm run start
If all those steps work you'll want to get something that will run these "forever" like https://www.npmjs.com/package/forever npm i -g forever or even better: https://www.npmjs.com/package/pm2 will allow you to continuously run your express server.
Finally, you'll need to configure this server on AWS/Google/whatever service you're using to push traffic coming in on port 80 and 443 to port 3000 and open traffic to all. And depending on the service you chose that's different so find a tutorial for doing just that part.
This will only allow people across the internet to see your service on an AWS URL or a google URL. But it's a good chance to make sure everything works perfectly. Once you're happy with everything associate your purchased domain with that special AWS/Google domain. You can do that on the AWS side, or the GoDaddy/NameCheap/where-ever you bought your domain side.
For the docker option you can download aws-cli tools and upload your built docker container to AWS and have it available. Find a tutorial to do that.
Essentially your question is very broad so I sometimes brushed over some details, but this is essentially what you have to do.

Move files from node.js to apache server

Is there any possible for moving files from platform like Heroku to second server like Apache? I want to create application and push it to Heroku, but I have also Apache server and I want send to this server all images which I upload from frontend forms.
EDIT
ok so You want to use Heroku as the main application server. But then Heroku makes HTTP/HTTPS requests to the Apache server?
I think thats what you are asking.
Yeah no issues with that. if you want to set up API id go with Laravel 5.3 and use its passport function on your Apache server ( but this is not required, this is only for security.)
https://laravel.com/docs/5.3/passport
END OF EDIT
what the web server is really does not matter at all.
Its about if the server has internet access and im pretty sure they do.
Easiest way is ftp,SSH,or git. unless they both have a web server then id just zip up your app without the node_modules folder and move it into the web directory. then go to the address of your server in a web browser. eg. http://mywebsite.com/files-i-just-zipped.zip and download them. (i normally log onto the new server via SSH and do wget http://mywebsite.com/files-i-just-zipped.zip)
I need more info but yeah. once you unzip then you need to install node but my guess is they already have it.
then do npm install in the package.json directory.

qooxdoo's api-viewer run offline

I dont know how to make qooxdoo's api-viewer run offline.
http://www.qooxdoo.org/current/apiviewer/#
Any help?
just run generate with the api target and you get a local copy of the api viewer wich also documeents your own project.
./generate.py api
then start a local web server in the newly generated api directory
cd api
python -mSimpleHTTPServe
and open http://localhost:8000

Why does aspnet_compiler need write access to the Temporary ASP.NET Files folder on my build server?

We use a CI server (Jenkins) to compile an ASP.NET project and deploy to our web servers.
I want to precompile the site before deployment to increase performance, so I've set the PrecompileBeforePublish property in the Publish Profile (.pubxml).
However, when Jenkins runs the build, the AspNetPreCompile task fails with the error:
AspNetPreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe
-v /
-p c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\Source
-c
c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\TempBuildDir
ASPNETCOMPILER : error ASPRUNTIME: The current identity (JenkinsUser)
does not have write access to
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files'.
Note that this is not the machine where the web site will be deployed to, it is just a build server. I could grant the current identity (JenkinsUser) access to the Temporary ASP.NET Files folder, but I'd rather not have to mess around with filesystem permissions on a box that is just acting as a dumb Jenkins slave.
Is there any way around this? Why is aspnet_compiler trying to write the site to the Temporary ASP.NET Files folder, and is there any way to make it use a different temporary directory instead, such as %TEMP%?
I guess you could play around with this:
<AspNetCompiler ToolPath="C:\Windows\Microsoft.NET\Framework\v2.0.50727" VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\Web" />
But you're gonna have to give ~some directory the rights.
It's just one of those "live with it" things.........my instructions document for setting up a CI machine has the "give rights to asp.net directory" as you explain.

Create New Application of Yii Framework on cPanel

I uploaded Yii Framework to my cpanel and now I dont know how to create new application while I did it on my local host using CMD.
I have not any shell access on cpanel and search this question but I found no related answer for this question.
Please help me out!
Thanks!
You have to deploy your application in another way, eg. with FTP, git or rsync.
Upload your complete application, but make sure to exclude and/or set the correct permissions manually for certain folders eg. assets and protected/runtime.
create your app on a local pc, then upload your app to your host. It's that simple.
you can skip making app using cmd on your host!
then just point to the frameworks location in index.php
if you have other apps which are been used by your YII app make sure to install them from Cpanel install php packages.For instance if your using LDAP authentication run a php5-ldap package. If your not using any packages upload your site and your good to go.