SVN repo What is difference between http://server/ ... / and svn://server/ .. / - c++

I'm new in Linux world and recently start messing around with ubuntu server. For week or so I was able to understand the basics and now I'm shooting for more difficult tasks like setting up web server, ssh and SVN.
The question is: how to set url to be visible like svn://......../....
I found this and the book http://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html perhaps i'm not doing something right:
svnserve as daemon
The easiest option is to run svnserve as a standalone “daemon” process. Use the -d option for this:
$ svnserve -d
$
# svnserve is now running, listening on port 3690
When tape this line and restart the service apache2 nothing changes. And I'm not sure is this the way to make it.

When tape this line and restart the service apache2 nothing changes
Apache in any way does not related to handling svn:// protocol
Quote from referenced by you page of SVN Book
Once we successfully start svnserve as explained previously, it makes
every repository on your system available to the network. A client
needs to specify an absolute path in the repository URL. For example,
if a repository is located at /var/svn/project1, a client would reach
it via svn://host.example.com/var/svn/project1.
(Bolded parts is important)

Related

How to host a web page that was made using Wt(C++ Web toolkit)?

I have created a small project using Wt(C++ Web Toolkit). and I now want to host it.
Since there are very sparse resources for this, I read somewhere that LAMP is required for this(since I am using Linux). So after creating an Ubuntu instance at Digital Ocean, I installed my code in it with Apache2, MySql, and PHP. The Apache2 server is working, but it is used for hosting HTML/CSS/JS files. my web page is written entirely in C++.
I got directed to this website: https://www.webtoolkit.eu/wt/doc/reference/html/overview.html#wthttpd where it mentions "connectors" like libwthttp and libwtfcgi. I tried to install them using apt but I get this error: E: Unable to locate package libwtfcgi-dev (same for libwthttp).
The website mentioned above also does not provide clear steps for using these connectors.
I have also looked at other related answers : Host for Wt C++ web framework, deplowment issue but since I am new to web hosting, I would really appreciate a step-by-step guidance.
Even here: https://redmine.webtoolkit.eu/projects/wt/wiki/Fastcgi_on_apache The language is very unclear ast to where fastcgi.conf is located.
This answer assumes that you have the project running locally and just need to 'get it on the web'. You have a few options...
Reverse Proxy
From the tutorial it looks like there is a built in web-server. One option could be to use this, and then setup a reverse proxy (this can be done through Apache) to map traffic from yourwebsite.com to http://localhost:port, where port is whatever you started the web-server with.
The example they give to start the local webserver is:
$ g++ -std=c++14 -o hello hello.cc -lwthttp -lwt
$ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090
here, port would be 9090.
Fast CGI
From the hello world and this thread it seems like a webserver setup with FastCGI may be able to do what you are looking for. Maybe this doc from Digital Ocean can help you get started?
It seems unlikely that you specifically need the full LAMP stack (Linux, Apache, MySQL, PHP) specifically for this. The doc you link does suggest that you need to link against the appropriate library for whichever approach you take, libhttpd or libwtfcgi, and you are correct that apt would be the place to get them on Ubuntu. This is a separate issue, but maybe this answer could be a starting point?
Is LAMP needed?
LAMP is definitely not required by Wt:
Linux is supported, but Windows too.
Apache could be used as a Reverse Proxy, but some alternatives may be even better (f.ex. HAProxy)
MySQL is supported, but also other database backends such as Postgres.
PHP/Perl/Python: not needed in any way.
Reverse proxy
Using a reverse proxy is a great way to deploy your Wt application (see eisaac's answer). If you already use Apache for other websites on your server. It's perfectly ok to use it as a reverse proxy. If you don't need all the features of Apache, using a HAProxy may be the better choice. See also some deployment configuration mentioned in the Wt docs:
https://redmine.emweb.be/projects/wt/wiki/Wt_Deployment
Easiest solution (but not scalable): let Wt directly listen on port 80 (or port 443)
If Wt is the only site running on your Ubuntu instance, you can also make it listen directly on port 80 (or port 443 in case of https):
./hello --docroot . --http-address 0.0.0.0 --http-port 80
See also the different command line options in the Wt doc: https://www.webtoolkit.eu/wt/doc/reference/html/overview.html#config_wthttpd

Get err_connection_refused accessing django running on wsl2 from Windows but can curl from Windows terminal

I got the err_connection_refused when trying to accessing django running on wsl2 (http://localhost:8000) from Windows but when I use curl http://localhost:8000 from Windows terminal bash, it's working fine. I have tried to add a new firewall inbound rule for port 8000 but it's still not working. Is there anything else I need to take care of.
Thanks a lot
Seems like a forwarding problem. WSL2's interface is NAT'd, whereas WSL1 was bridged by default. WSL seems to do some "auto-forwarding" of ports, but only on localhost. However, sometimes this auto-forwarding mechanism seems to "break down". The main culprit seems to be hibernation or Windows Fast Startup (which are both closely-related features).
Does the problem resolve if you do a wsl --shutdown and then restart the WSL2 session? If so, try disabling Windows' Fast Startup. I already had Fast Startup disabled due to a different (non-WSL issue) on my system, so that could be related to why I am not able to reproduce.
Along the same lines, do you Hibernate instead of powering off? In that case, a wsl --shutdown might resolve as well.
For future readers, note that the above two points seem to resolve the issue for most people who have upvoted and responded in the comments. However, if that does not work for you, the following were my original "additional suggestions":
For some additional ideas, see this github issue. There are some suggestions on services that might be needed. (Side question - Are you running Windows Home or Professional?)
Is there any chance that your Windows hosts file (e.g. c:\windows\system32\drivers\etc\hosts) points localhost to an IP other than 127.0.0.1? If I attempt to access via my local Windows IP address, rather than 127.0.0.1 or localhost, I get an ERR_CONNECTION_REFUSED as well.
Since you were looking at the firewall rules, maybe look at a forwarding rule instead of just an inbound allow?
If all else fails, try exporting/backing up the WSL2 session (see wsl --export), then import it in as a new WSL1 session. See if it works there.
On my WSL2/Ubuntu 20.04 system, I attempted to reproduce (but haven't been able to yet) with the following steps:
mkdir -p ~/src/dj-test
cd ~/src/dj-test
python3 -m venv dj
source dj/bin/activate
pip install Django
django-admin startproject config .
python manage.py runserver
(although I used activate.fish since I'm running the fish shell)
From Vivaldi web browser in Windows, accessed localhost:8000, which returned "The install worked successfully! Congratulations! ..."
curl under Powershell Core worked as well.

How to configure Elastic IP with django app in aws?

I am building an app using django in EC2-ubuntu and i have associated Elastic ip with my instance.
i have done following steps :
1. first created instance of ubuntu in ec2 free tier.
2. installed python.
3. installed pip.
4. installed django.
5. create a django project using django-admin startproject.
6. run server using these commads python manage.py runserver 0.0.0.0:80
7. created an elastic ip and associated to the instance.
8. configure security inbound settings with http 0.0.0.0:80 address.
9. able to ping my project using any browser.
But the problem is when i am closing my putty session where i supplied runserver command, django project is also stopped. i did not stop it manually.
Please, help me to keep on running after closing putty session as well.
Thanks,
Kripa Sharma
Take a look at this Answer
I highly recommend that you start using Elastic Beanstalk (Python instance) to take care of all these steps for you. Very simple to setup, and no need to worry about any of the steps you listed.
You can use this instruction to see how you can deploy a Django app in less than 5 minutes.
The problem
You are trying to persist the debug server for a remotely deployed application.
You probably need to review the runserver command documentation. Here are the relevant parts:
django-admin runserver [addrport]
Starts a lightweight development Web server on the local machine. By default, the server runs on port 8000 on the IP address 127.0.0.1. You can pass in an IP address and port number explicitly.
...
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
A webserver
Having skimmed the above docs, you may want to look at "How to deploy with WSGI" section, which gives a few recommendations for commonly used Web servers. My favorite, Gunicorn, includes a usage example:
$ pip install gunicorn
$ gunicorn myproject.wsgi
Having decided, and installed a webserver, you'd need to "daemonize" it and expose it to the world.
The former is usually done by creating a service on your OS, for ubuntu it would be either upstart or systemd depending on the version. Gunicorn docs have examples for both.
The latter is usually achieved with an http-server/proxy such as nginx or apache httpd. And again, Gunicorn has an example for us.
You can see why I like it so much ☺️
Epilogue
While technically possible to run the debug server as a service or even in a terminal multiplexer such as GNU screen or tmux, it's not a recommended or stable long term solution.
That said, these are very useful to know about, so read on the above tools and learn to use them, since they would be invaluable to have in your toolset in the future, for example to avoid accidentally terminating a long running command (such as migration), etc.

Running Shoutcast from Openshift Permission Denied Error

I've been following along this blog to setup a shoutcast server on openshift using the diy cartridge. After replacing the destip with my server's OPENSHIFT_DIY_IP and editing the action and stop hooks I find that the server isn't starting when I visit the application's url, instead I'm getting:
503 Service Temporarily Unavailable
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
When I checked the log file used in the action hook I'm finding:
server.log
nohup: failed to run command `/var/lib/openshift/xxxx app-id xxxx/app-root/runtime/repo//diy/sc_serv.exe': Permission denied
(while using window's shoutcast distribution) and
nohup: failed to run command `/var/lib/openshift/xxxx app-id xxxx/app-root/runtime/repo//diy/sc_serv': Permission denied
(while using linux's shoutcast distribution)
I've read on several forums that often openshift resets the chmod file permissions and prevents applications from being executed, and that's exactly what I found my openshift application doing (after using filezilla to edit the file permissions). Since sc_serv or sc_serv.exe is the main application (a command line application) to keep the server going I'm wondering how I could get around this odd permissions error.
start action hook (when I used window's shoutcast distribution)
nohup $OPENSHIFT_REPO_DIR/diy/sc_serv.exe $OPENSHIFT_REPO_DIR/diy/sc_serv.conf > $OPENSHIFT_DIY_LOG_DIR/server3.log 2>&1 &
start action hook (when I used linux's shoutcast distribution)
nohup $OPENSHIFT_REPO_DIR/diy/sc_serv $OPENSHIFT_REPO_DIR/diy/sc_serv.conf > $OPENSHIFT_DIY_LOG_DIR/server3.log 2>&1 &
I'd like to note that the blogger used linux and I'm using windows to edit the openshift repository and I assume that the files extracted from the linux distribution of shoutcast are the same whether from windows or linux, but I clearly can't test that. All I can tell so far is that openshift is blocking the main executable (whether it's linux or windows) which essentially runs the whole service. I've tested the server myself on my own localhost and found it working perfectly so I have no doubt if it were to run (with the right settings listed in this blog that it would work.
Edit: Solved
In order to have the permissions changed and kept that way they need to be edited from git using
git update-index --chmod=+x filename
git commit -m 'update file permissions ect...'
git push origin master
After stumbling across more stackoverflow answers (and feel free to link one that explains this I don't remember which one I used) I read that openshift will reset everything (permission wise) on every git push (to retain the safety of the code I assume). So the only way to solve the permissions issue is in fact with git, not through ftp software like filezilla or through ssh. This way changing the chmod will remain permanently.
git update-index --chmod=+x filename
git commit -m 'update file permissions ect...'
git push origin master
In the end what I have in openshift's diy folder is the linux distribution of shoutcast (which can be extracted with 7-Zip. Modified so that it can be reached through port-forwarding like in this blog. To reach the server (having set up openshift's tools) all you'll have to do before broadcasting is this in command line:
rhc port-forward [app-name]
If you're using Sam broadcasting software the good news is that you can easily add a mysql database, and also port-forward into that as well using that same command. Port-forwarding would mean that instead of finding the ip:port for your stream and mysql on openshift you would use localhost or 127.0.0.1 and whatever ports indicated by rhc port-forward. You could also be using your other favorite software to broadcast in which case I'd recommend setting up a batch file like so:
cd C:\YourSoftwarePath
start YourSoftware.exe
start rhc port-forward [app-name]
If you have hardware doing the streaming like through a barix box there will probably be some way of doing this in some other tricky manner.

plone change in code not visible in development site

I am very new to plone. I have a project folder in eclipse. I have imported it from the cvs project. I have zope as server and I start zope with ./bin/instance restart. When I make changes in my folder, I cannot see the changes in the development website. I can't seem to find what is happening. I even restarted zope after making changes in python. Can anyone help me with this?
Make sure you start your Zope server with bin/instance fg, most likely the name of the script if you used the Plone universal installer buildout.
To see changes in python code you'll either need to restart the server (CTRL-C then start again) or use something like plone.reload to request a reload of changed code.
When starting your server with the fg command, it is automatically running in debug mode and any templates, resources and skin items are reloaded automatically. Start the server with console or start and it'll run in production mode and templates and such are loaded from disk only once.
See the Plone.org documentation on buildout for more information.
The bin/instance command has a built-in help command, try:
bin/instance help
for a list of supported commands or run:
bin/instance help console
to get help on a specific command; the above example will print the help on the console command.