This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.6.4.2. 工作流
本地运行上述模板 URL 的 git clone
。添加并提交应用程序源代码并推送 GitHub 存储库,然后从上面列出的其中一个模板启动 v3 Quickstart 应用程序:
- 为您的应用程序创建 GitHub 存储库。
克隆快速入门模板,并将 GitHub 存储库添加为远程:
git clone <one-of-the-template-URLs-listed-above> cd <your local git repository> git remote add upstream <https://github.com/<git-id>/<quickstart-repo>.git> git push -u upstream master
$ git clone <one-of-the-template-URLs-listed-above> $ cd <your local git repository> $ git remote add upstream <https://github.com/<git-id>/<quickstart-repo>.git> $ git push -u upstream master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将您的源代码提交并推送到 GitHub:
cd <your local repository> git commit -am “added code for my app” git push origin master
$ cd <your local repository> $ git commit -am “added code for my app” $ git push origin master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在 v3 中创建一个新应用程序:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 仅适用于 MongoDB。
您现在应该有 2 个 pod 运行、Web 框架 Pod 和数据库 Pod。Web 框架 pod 环境应当与数据库 pod 环境匹配。您可以使用
oc set env pod/<pod_name> --list
列出环境变量:-
DATABASE_NAME
现在为<DB_SERVICE>_DATABASE
-
DATABASE_USER
现在是<DB_SERVICE>_USER
-
DATABASE_PASSWORD
现在为<DB_SERVICE>_PASSWORD
DATABASE_ADMIN_PASSWORD
现在是MONGODB_ADMIN_PASSWORD
(仅适用于 MongoDB)如果没有指定
SOURCE_REPOSITORY_URL
,该模板将使用上面列出的模板 URL(https://github.com/openshift/<quickstart>-ex)作为源存储库,并且将 hello-welcome 应用启动。
-
如果您要迁移数据库,请将数据库导出到转储文件,并在新的 v3 数据库 pod 中恢复数据库。请参阅 Database Applications 中介绍的步骤,跳过
oc new-app
步骤,因为数据库 pod 已启动并在运行。