4

我们的服务器上有一个 Ruby 应用程序作为守护程序服务运行。目前,该应用程序位于 Ubuntu 机器上的/usr/share/theapp.

我的问题可能值得商榷,但我只是想知道哪个位置实际上是 Ruby 应用程序的最佳、最传统的位置?以上是否可以,或者是否有用于守护程序应用程序的不同位置?

例如,通常情况下,我们将使用 Apache 托管的 PHP Web 应用程序放在 下/var/www/...,所以我认为必须有一个更好的、良好实践的位置来放置 Ruby 应用程序。

位置可能无关紧要,因此如果托管并位于不同的文件夹中,应用程序不会中断,但我相信需要某种形式和方法来应对这种疯狂。

有什么建议么?

4

3 回答 3

3

在阅读了通常使用的各种目录的几个描述之后,我们将我们的应用程序放在 /usr/local/share 中。

“bin”子目录中的任何应该对用户可用的命令然后通过我们在安装时运行的 rake 任务从 /usr/local/bin 获取到它的软链接。

我同意这样的评论,即当它们不提供 HTML 时,将它们放在“www”目录下是没有意义的。

于 2013-04-29T13:21:01.023 回答
2

I'm just adding this as an answer to my own question as I think others might find it useful, this comes from http://www.ubuntugeek.com/linux-or-ubuntu-directory-structure.html:

  • /bin -- binary applications (most of your executable files)
  • /boot -- files required to boot (such as the kernel, etc)
  • /dev -- your devices (everything from drives to displays)
  • /etc -- just about every configuration file for your system
  • /etc/profile.d -- contains scripts that are run by /etc/profile upon login.
  • /etc/rc.d -- contains a number of shell scripts that are run on bootup at different run levels. There is also typically an rc.inet1 script to set up networking (in Slackwar), an rc.modules script to load modular device drivers, and an rc.local script that can be edited to run commands desired by the administrator, along the lines of autoexec.bat in DOS.
  • /etc/rc.d/init.d -- contains most of the initialization scripts themselves on an rpm-based system.
  • /etc/rc.d/rc*.d -- where "*" is a number corresponding to the default run level. Contains files for services to be started and stopped at that run level. On rpm-based systems, these files are symbolic links to the initialization scripts themselves, which are in * /etc/rc.d/init.d.
  • /etc/skel -- directory containing several example or skeleton initialization shells. Often contains subdirectories and files used to populate a new user's home directory.
  • /etc/X11 -- configuration files for the X Window system
  • /home -- locally stored user files and folders
  • /lib -- system libraries (similar to Program Files)
  • /lost+found -- lost and found for lost files
  • /media -- mounted (or loaded) devices such as cdroms, digital cameras, etc.
  • /mnt -- mounted file systems
  • /opt -- location for “optionally” installed programs
  • /proc -- dynamic directory including information about and listing of processes
  • /root -- “home” folder for the root user
  • /sbin -- system-only binaries (see /bin)
  • /sys -- contains information about the system
  • /tmp -- temporary files
  • /usr -- applications mainly for regular users
  • /var -- mainly logs, databases, etc.
  • /usr/local/bin -- the place to put your own programs. They will not be overwritten with upgrades.
  • /usr/share/doc -- documentation.
于 2013-04-30T07:49:59.510 回答
0

我部署到/u/<app_name>/revisions以构建的日期时间命名的文件夹。然后我创建一个符号链接到/u/<app_name>/current. 这是 capistrano 的惯例,它适用于几乎任何类型的应用程序。

示例文件夹结构

u/foobar/
        |- current* -> /u/foobar/revisions/042920131205
        |- revisions/
                    |- 042920131205/
                                   |- bin/
                                   |- lib/
                                   |- spec/
                                   |- README.md
                                   |- ... (you get the idea)

手动执行此操作

要手动制定此部署策略,您将查看一些非常简单的命令。

date=`date +"%m%d%y%H%M"`
git clone <repo> /u/<app_name>/revisions/$date
ln -s /u/<app_name>/revisions/$date /u/<app_name>/current
于 2013-04-29T16:15:04.837 回答