jmessenger/maint-autobuildThis application is a conversion of the 802.1 Maintenance Database into a web application. The old database was formed from a single Excel workbook with magic formulae to generate static HTML output. It was difficult to maintain and keep error-free.
To modify the application or run it locally in a development environment, some setup is required. However if you just want to run it, you can skip to the "Deploying with Docker Compose" section below.
These commands are for Ubuntu. For other setups see [***]
$ git clone [***] ~/.rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc $ echo 'eval "$(rbenv init -)"' >> ~/.bashrc $ git clone [***] ~/.rbenv/plugins/ruby-build $ exec -l $SHELL
Then enter "type rbenv" to verify that rbenv is a function. Then install Ruby:
$ sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev $ rbenv install 2.4.2 $ rbenv global 2.4.2
Perviously, with Ubuntu 14.04 with Ruby 2.2.2 , due to problems with Readline, I found I had to use this incantation to install Ruby:
$ RUBY_CONFIGURE_OPTS=--with-readline-dir="/usr/include/readline" rbenv install 2.2.2
Install the bundler gem and other prerequisites:
$ gem install bundler $ sudo apt-get install postgresql postgresql-client libpq-dev git libicu-dev
Clone the source code from GitHub and install the required gems for the development environment:
$ git clone [***] $ cd maint $ bundle install $ mkdir public/uploads
Create .env, config/database.yml, config/secrets.yml based on the examples in the repository named "example-...". The title of the site
is configured using the COMMITTEE environment variable in the .env file
These instructions assume that the name of the Postgres user (called a "role") is "deploy". Also, that your UNX username is "deploy". If those assumptions are invalid, the PostgreSQL setup can be more complicated. It's much simpler if the UNX username and the PostgreSQL role name are the same.
$ sudo su - postgres $ psql postgres# create role deploy with createdb login password 'somepassword'; postgres# \q $ createdb -O deploy maint_development # actually this step should not be necessary, as rake db:setup does it. $ exit $ rake db:setup
At this point you should be able to start the server and connect to it using your web browser at http://localhost:3000/users/sign_in.
$ rbenv rehash $ rails server
Click on "sign up". Follow the instructions. For this to work, your development machine has to have a way to send emails, and the "devise"
gem has to be able to use it. This is configured in config/environments/development.rb (see the config.action_mailer.delivery_method entry).
If you don't have this set up, you can find the link for the sign-up configuration in the debug output in the terminal window,
and enter it directly into the browser. Then, log in to the application using your new username and password.
Here's the hacky bit: the app has no way to create an administrator user, so you have to hack this manually. After creating your user and logging in, stop the server and do the following, substituting the newly created user's email address:
$ rails console irb(main):001:0> u = User.where(*** "***").first ... irb(main):001:0> u.admin=true => true irb(main):002:0> u.save ... => true irb(main):003:0> quit $ rails server
Now, when logging in to the app or refreshing the page, you should see Administrator options in the top header.
The first real step is to import an existing maintenance database spreadsheet using the Import menu. Then use the Items menu to look at the maintenance database entries.
Importing Excel files into other environments can be a tricky business, because the variety of things that can be in an Excel file is vast. Some files will not import without preparatory clean-up. I have come across two classes of problems: hyperlinks on the Master and Minutes tabs (which should no longer present a problem) and illegal characters in Document Properties. For the latter, save a copy of the spreadsheet in Excel and then do File->Info->Inspect Workbook->Document Properties and Personal Information (just that category). Click "Remove", then save the copy and import it into the app.
This Ruby on Rails app is set up to deploy to a server using Capistrano. For instructions and background, see [] also described here, and [] My setup is based on an Ubuntu virtual machine running Nginx and Passenger. (However, it may be better to use Docker, as described below.)
Create .env, config/database.yml, config/secrets.yml based on the examples in the repository named "example-..."
$ cap production deploy
This step is quite messy, as /var/www/maint has to exist on the deployment server and it doesn't and needs creating with the right permissions (it tries to create it but the /var/www directory which it doesn't own). Then, some special files don't exist and have to be created:
~deploy/maint-secrets/database.yml~deploy/maint-secrets/secrets.ymlThese have to be linked to the right places in the deployment structure:
$ ln -s /home/deploy/maint-secrets/database.yml /var/www/maint/shared/config/ $ ln -s /home/deploy/maint-secrets/secrets.yml /var/www/maint/shared/config/
$ createdb maint_production
Apparently that step isn't automated.
The nginx configuration file is not altered automatically to add the new application, so you have to manually edit /opt/nginx/conf/nginx.conf to add a section for the new app,
in the existing server section after the root line.
Mine looked like this:
location ~ ^/maint(/.|$) { alias /var/www/maint/current/public$1; passenger_base_uri /maint; passenger_app_root /var/www/maint/current; passenger_document_root /var/www/maint/current/public; passenger_enabled on; }
On the development machine:
$ docker-compose build $ docker tag maint_web:latest yourusername/maint_web:latest $ docker push yourusername/maint_web:latest
The preferred method of deploying the application is using Docker Compose. This assumes you have a separate Docker hosting environment. I use an Ubuntu virtual machine for this, with Docker CE installed. Digital Ocean offers a pre-configured setup for this.
On the Docker host (target), first prepare the storage area for the database (there are lots of other, perhaps better ways to do this, including using a persistent docker volume):
bash$ sudo mkdir -p /srv/docker/postgresql/data $ sudo chmod -R go-rwx /srv $ sudo chown 999.root /srv/docker/postgresql/data
Then copy example-deploy-docker-compose.yml to deploy-docker-compose.yml and edit it to configure the application.
The POSTGRES_USER and POSTGRES_PASSWORD fields can be set arbitrarily (but must be the same for the db and web
sections). The SECRET_KEY_BASE and DEVISE_PEPPER entries are Rails secret keys, and can be generated using openssl rand -hex 64 or rake secret (if you happened to have Rake installed). The VIRTUAL_HOST and LETSENCRYPT* entries
are only required if you are using Jason Wilder's nginx-proxy and Yves Blusseau's docker-letsencrypt-nginx-proxy-companion
(see section below). The remaining fields configure aspects of the user interface that depend on the use you are
putting this project to.
Once the Docker Compose file has been customised, the application can be launched with the command
$ docker-compose -f deploy-docker-compose.yml up
It takes a couple of minutes to initialise, set up the database and write cache files. Test it by navigating to
localhost:80. To terminate, press Control-C. To launch it in the background, use
bash$ docker-compose -f deploy-docker-compose.yml up -d
Jason Wilder has written a very fine reverse proxy for Docker containers based on Nginx. Yves Blusseau has written an excellent companion utility which automatically generates, applies (and renews) Let's Encrypt certificates to each virtual host created by the above. No account or additional setup is needed.
With a few simple steps, this allows multiple Dockerized web applications to run on the same VM, each as different
virtual hosts, secured by valid certificates and supporting HTTPS without the web application having to be HTTPS-aware.
Adding a new application requires no configuration beyond including the VIRTUAL_HOST, LETSENCRYPT_HOST and
LETSENCRYPT_EMAIL environment variables to the environment of the new container.
To apply this to the maint application, first register the newly invented DNS name of the web application virtual
host to be a CNAME of the Docker host. Then, before starting the web application with Docker Compose as described
in the previous section, run these commands:
$ sudo mkdir /web/nginx-proxy $ sudo chown YOU /web/nginx-proxy $ curl [***] > /web/nginx-proxy/nginx.tmpl # Probably you need to patch nginx.tmpl to stop redirects to HTTPS for the letsencrypt verification files: $ wget -Onginx.tmpl.patch [***] $ patch /web/nginx-proxy/nginx.tmpl < nginx.tmpl.patch $ sudo docker network create nginx-proxy $ sudo docker run -d -p 80:80 -p 443:443 --name nginx-proxy --net nginx-proxy --restart=always -v /web/nginx-proxy:/etc/nginx/certs:ro -v /etc/nginx/vhost.d -v /usr/share/nginx/html -v /var/run/docker.sock:/tmp/docker.sock:ro --label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy jwilder/nginx-proxy $ sudo docker run -d --name nginx-letsencrypt --net nginx-proxy --restart=always -v /web/nginx-proxy:/etc/nginx/certs:rw -v /var/run/docker.sock:/var/run/docker.sock:ro --volumes-from nginx-proxy jrcs/letsencrypt-nginx-proxy-companion
Docker Cloud was a cloud-based Docker stack manager. It is gone, now. Sadface.
Another way of deploying the application is using Docker, managed with a service such as Docker Cloud. Once debugged, this provides a very convenient deployment environment. My setup for this involved providing my own node to the Docker Cloud service.
$ docker-compose build $ docker tag maint_web:latest yourusername/maint_web:latest $ docker push yourusername/maint_web:latest
Then navigate to the "Stacks" tab in Docker Cloud, and select "Create Stack" and upload example-docker-cloud-stack.yml.
Edit as appropriate. Then "Deploy" it!
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务