huginn-mysql.json 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "huginn-mysql-persistent",
  6. "annotations": {
  7. "openshift.io/display-name": "Huginn + MySQL (Persistent)",
  8. "description": "A Huginn deployment with a MySQL database. For more information, see https://github.com/huginn/huginn.",
  9. "tags": "quickstart,ruby,huginn",
  10. "iconClass": "icon-huginn"
  11. }
  12. },
  13. "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}. Visit https://${NAME}-YOUR_PROJECT_NAME.${ROUTER_SHARD}.${CLUSTER_NAME}.openshiftapps.com and login as '${HUGINN_SEED_USERNAME}' with your password. If you'd like to make more users, you can visit https://${NAME}-YOUR_PROJECT_NAME.${ROUTER_SHARD}.${CLUSTER_NAME}.openshiftapps.com/users/sign_up and use the invitation code: ${HUGINN_INVITATION_CODE}\n\nFor more information, see https://github.com/huginn/huginn.",
  14. "labels": {
  15. "template": "huginn-mysql-persistent"
  16. },
  17. "objects": [{
  18. "kind": "Secret",
  19. "apiVersion": "v1",
  20. "metadata": {
  21. "name": "${NAME}"
  22. },
  23. "stringData" : {
  24. "databaseName" : "${DATABASE_NAME}",
  25. "databaseUser" : "${DATABASE_USER}",
  26. "databasePassword" : "${DATABASE_PASSWORD}",
  27. "seedUser" : "${HUGINN_SEED_USERNAME}",
  28. "seedPassword" : "${HUGINN_SEED_PASSWORD}",
  29. "seedEmail" : "${HUGINN_SEED_EMAIL}",
  30. "smtpDomain" : "${HUGINN_SMTP_DOMAIN}",
  31. "smtpUser" : "${HUGINN_SMTP_USER_NAME}",
  32. "smtpPassword" : "${HUGINN_SMTP_PASSWORD}",
  33. "smtpServer" : "${HUGINN_SMTP_SERVER}"
  34. }
  35. }, {
  36. "kind": "Service",
  37. "apiVersion": "v1",
  38. "metadata": {
  39. "name": "${NAME}",
  40. "annotations": {
  41. "description": "Exposes and load balances the application pods",
  42. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
  43. }
  44. },
  45. "spec": {
  46. "ports": [{
  47. "name": "web",
  48. "port": 8080,
  49. "targetPort": 8080
  50. }],
  51. "selector": {
  52. "name": "${NAME}"
  53. }
  54. }
  55. }, {
  56. "kind": "Route",
  57. "apiVersion": "v1",
  58. "metadata": {
  59. "name": "${NAME}"
  60. },
  61. "spec": {
  62. "host": "${APPLICATION_DOMAIN}",
  63. "tls": {
  64. "insecureEdgeTerminationPolicy": "Redirect",
  65. "termination": "edge"
  66. },
  67. "to": {
  68. "kind": "Service",
  69. "name": "${NAME}"
  70. }
  71. }
  72. }, {
  73. "kind": "ImageStream",
  74. "apiVersion": "v1",
  75. "metadata": {
  76. "name": "${NAME}",
  77. "annotations": {
  78. "description": "Keeps track of changes in the application image"
  79. }
  80. }
  81. }, {
  82. "kind": "BuildConfig",
  83. "apiVersion": "v1",
  84. "metadata": {
  85. "name": "${NAME}",
  86. "annotations": {
  87. "description": "Defines how to build the application"
  88. }
  89. },
  90. "spec": {
  91. "source": {
  92. "type": "Git",
  93. "git": {
  94. "uri": "${SOURCE_REPOSITORY_URL}",
  95. "ref": "${SOURCE_REPOSITORY_REF}"
  96. },
  97. "contextDir": "${CONTEXT_DIR}"
  98. },
  99. "strategy": {
  100. "type": "Source",
  101. "sourceStrategy": {
  102. "from": {
  103. "kind": "ImageStreamTag",
  104. "namespace": "${NAMESPACE}",
  105. "name": "ruby:2.3"
  106. },
  107. "env": [{
  108. "name": "APP_SECRET_TOKEN",
  109. "value": "${HUGINN_APP_SECRET}"
  110. }, {
  111. "name": "DATABASE_ADAPTER",
  112. "value": "${DATABASE_ADAPTER}"
  113. }, {
  114. "name": "LC_ALL",
  115. "value": "en_US.UTF-8"
  116. }, {
  117. "name": "ON_HEROKU",
  118. "value": "true"
  119. }]
  120. }
  121. },
  122. "output": {
  123. "to": {
  124. "kind": "ImageStreamTag",
  125. "name": "${NAME}:latest"
  126. }
  127. },
  128. "triggers": [{
  129. "type": "ImageChange"
  130. }, {
  131. "type": "ConfigChange"
  132. }, {
  133. "type": "GitHub",
  134. "github": {
  135. "secret": "${GITHUB_WEBHOOK_SECRET}"
  136. }
  137. }]
  138. }
  139. }, {
  140. "kind": "PersistentVolumeClaim",
  141. "apiVersion": "v1",
  142. "metadata": {
  143. "name": "${DATABASE_SERVICE_NAME}"
  144. },
  145. "spec": {
  146. "accessModes": [
  147. "ReadWriteOnce"
  148. ],
  149. "resources": {
  150. "requests": {
  151. "storage": "${VOLUME_CAPACITY}"
  152. }
  153. }
  154. }
  155. }, {
  156. "kind": "DeploymentConfig",
  157. "apiVersion": "v1",
  158. "metadata": {
  159. "name": "${NAME}",
  160. "annotations": {
  161. "description": "Defines how to deploy the application server"
  162. }
  163. },
  164. "spec": {
  165. "strategy": {
  166. "type": "Recreate"
  167. },
  168. "triggers": [{
  169. "type": "ImageChange",
  170. "imageChangeParams": {
  171. "automatic": true,
  172. "containerNames": [
  173. "huginn-mysql-persistent"
  174. ],
  175. "from": {
  176. "kind": "ImageStreamTag",
  177. "name": "${NAME}:latest"
  178. }
  179. }
  180. }, {
  181. "type": "ConfigChange"
  182. }],
  183. "replicas": 1,
  184. "selector": {
  185. "name": "${NAME}"
  186. },
  187. "template": {
  188. "metadata": {
  189. "name": "${NAME}",
  190. "labels": {
  191. "name": "${NAME}"
  192. }
  193. },
  194. "spec": {
  195. "containers": [{
  196. "name": "huginn-mysql-persistent",
  197. "image": "${NAME}",
  198. "ports": [{
  199. "containerPort": 8080
  200. }],
  201. "readinessProbe": {
  202. "timeoutSeconds": 3,
  203. "initialDelaySeconds": 3,
  204. "httpGet": {
  205. "path": "/",
  206. "port": 8080
  207. }
  208. },
  209. "livenessProbe": {
  210. "timeoutSeconds": 3,
  211. "initialDelaySeconds": 30,
  212. "httpGet": {
  213. "path": "/",
  214. "port": 8080
  215. }
  216. },
  217. "env": [{
  218. "name": "SEED_USERNAME",
  219. "valueFrom": {
  220. "secretKeyRef" : {
  221. "name" : "${NAME}",
  222. "key" : "seedUser"
  223. }
  224. }
  225. }, {
  226. "name": "SEED_PASSWORD",
  227. "valueFrom": {
  228. "secretKeyRef" : {
  229. "name" : "${NAME}",
  230. "key" : "seedPassword"
  231. }
  232. }
  233. }, {
  234. "name": "SEED_EMAIL",
  235. "valueFrom": {
  236. "secretKeyRef" : {
  237. "name" : "${NAME}",
  238. "key" : "seedEmail"
  239. }
  240. }
  241. }, {
  242. "name": "INVITATION_CODE",
  243. "value": "${HUGINN_INVITATION_CODE}"
  244. }, {
  245. "name": "SMTP_DOMAIN",
  246. "valueFrom": {
  247. "secretKeyRef" : {
  248. "name" : "${NAME}",
  249. "key" : "smtpDomain"
  250. }
  251. }
  252. }, {
  253. "name": "SMTP_USER_NAME",
  254. "valueFrom": {
  255. "secretKeyRef" : {
  256. "name" : "${NAME}",
  257. "key" : "smtpUser"
  258. }
  259. }
  260. }, {
  261. "name": "SMTP_PASSWORD",
  262. "valueFrom": {
  263. "secretKeyRef" : {
  264. "name" : "${NAME}",
  265. "key" : "smtpPassword"
  266. }
  267. }
  268. }, {
  269. "name": "SMTP_SERVER",
  270. "valueFrom": {
  271. "secretKeyRef" : {
  272. "name" : "${NAME}",
  273. "key" : "smtpServer"
  274. }
  275. }
  276. }, {
  277. "name": "EMAIL_FROM_ADDRESS",
  278. "value": "${HUGINN_EMAIL_FROM_ADDRESS}"
  279. }, {
  280. "name": "APPLICATION_DOMAIN",
  281. "value": "${APPLICATION_DOMAIN}"
  282. }, {
  283. "name": "RAILS_ENV",
  284. "value": "${HUGINN_RAILS_ENV}"
  285. }, {
  286. "name": "OPCACHE_REVALIDATE_FREQ",
  287. "value": "${OPCACHE_REVALIDATE_FREQ}"
  288. }, {
  289. "name": "DATABASE_NAME",
  290. "valueFrom": {
  291. "secretKeyRef" : {
  292. "name" : "${NAME}",
  293. "key" : "databaseName"
  294. }
  295. }
  296. }, {
  297. "name": "DATABASE_USERNAME",
  298. "valueFrom": {
  299. "secretKeyRef" : {
  300. "name" : "${NAME}",
  301. "key" : "databaseUser"
  302. }
  303. }
  304. }, {
  305. "name": "DATABASE_PASSWORD",
  306. "valueFrom": {
  307. "secretKeyRef" : {
  308. "name" : "${NAME}",
  309. "key" : "databasePassword"
  310. }
  311. }
  312. }, {
  313. "name": "DATABASE_HOST",
  314. "value": "${DATABASE_SERVICE_NAME}_SERVICE_HOST"
  315. }, {
  316. "name": "DATABASE_PORT",
  317. "value": "${DATABASE_SERVICE_NAME}_SERVICE_PORT"
  318. }, {
  319. "name": "DATABASE_ENCODING",
  320. "value": "utf8mb4"
  321. }, {
  322. "name": "DO_NOT_CREATE_DATABASE",
  323. "value": "1"
  324. }, {
  325. "name": "RAILS_SERVE_STATIC_FILES",
  326. "value": "1"
  327. }, {
  328. "name": "WORKER_CMD",
  329. "value": "unicorn -c ./deployment/heroku/unicorn.rb --listen 0.0.0.0:8080"
  330. }],
  331. "resources": {
  332. "limits": {
  333. "memory": "${MEMORY_LIMIT}"
  334. }
  335. }
  336. }]
  337. }
  338. }
  339. }
  340. }, {
  341. "kind": "Service",
  342. "apiVersion": "v1",
  343. "metadata": {
  344. "name": "${DATABASE_SERVICE_NAME}",
  345. "annotations": {
  346. "description": "Exposes the database server"
  347. }
  348. },
  349. "spec": {
  350. "ports": [{
  351. "name": "mysql",
  352. "port": 3306,
  353. "targetPort": 3306
  354. }],
  355. "selector": {
  356. "name": "${DATABASE_SERVICE_NAME}"
  357. }
  358. }
  359. }, {
  360. "kind": "DeploymentConfig",
  361. "apiVersion": "v1",
  362. "metadata": {
  363. "name": "${DATABASE_SERVICE_NAME}",
  364. "annotations": {
  365. "description": "Defines how to deploy the database"
  366. }
  367. },
  368. "spec": {
  369. "strategy": {
  370. "type": "Recreate"
  371. },
  372. "triggers": [{
  373. "type": "ImageChange",
  374. "imageChangeParams": {
  375. "automatic": true,
  376. "containerNames": [
  377. "mysql"
  378. ],
  379. "from": {
  380. "kind": "ImageStreamTag",
  381. "namespace": "${NAMESPACE}",
  382. "name": "mysql:5.7"
  383. }
  384. }
  385. }, {
  386. "type": "ConfigChange"
  387. }],
  388. "replicas": 1,
  389. "selector": {
  390. "name": "${DATABASE_SERVICE_NAME}"
  391. },
  392. "template": {
  393. "metadata": {
  394. "name": "${DATABASE_SERVICE_NAME}",
  395. "labels": {
  396. "name": "${DATABASE_SERVICE_NAME}"
  397. }
  398. },
  399. "spec": {
  400. "containers": [{
  401. "name": "mysql",
  402. "image": "mysql",
  403. "ports": [{
  404. "containerPort": 3306
  405. }],
  406. "readinessProbe": {
  407. "timeoutSeconds": 1,
  408. "initialDelaySeconds": 5,
  409. "exec": {
  410. "command": ["/bin/sh", "-i", "-c", "MYSQL_PWD='${DATABASE_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${DATABASE_NAME} -e 'SELECT 1'"]
  411. }
  412. },
  413. "livenessProbe": {
  414. "timeoutSeconds": 1,
  415. "initialDelaySeconds": 30,
  416. "tcpSocket": {
  417. "port": 3306
  418. }
  419. },
  420. "env": [{
  421. "name": "MYSQL_DATABASE",
  422. "valueFrom": {
  423. "secretKeyRef" : {
  424. "name" : "${NAME}",
  425. "key" : "databaseName"
  426. }
  427. }
  428. }, {
  429. "name": "MYSQL_USER",
  430. "valueFrom": {
  431. "secretKeyRef" : {
  432. "name" : "${NAME}",
  433. "key" : "databaseUser"
  434. }
  435. }
  436. }, {
  437. "name": "MYSQL_PASSWORD",
  438. "valueFrom": {
  439. "secretKeyRef" : {
  440. "name" : "${NAME}",
  441. "key" : "databasePassword"
  442. }
  443. }
  444. }],
  445. "resources": {
  446. "limits": {
  447. "memory": "${MEMORY_MYSQL_LIMIT}"
  448. }
  449. },
  450. "volumeMounts": [{
  451. "name": "${DATABASE_SERVICE_NAME}-data",
  452. "mountPath": "/var/lib/mysql/data"
  453. }]
  454. }],
  455. "volumes": [{
  456. "name": "${DATABASE_SERVICE_NAME}-data",
  457. "persistentVolumeClaim": {
  458. "claimName": "${DATABASE_SERVICE_NAME}"
  459. }
  460. }]
  461. }
  462. }
  463. }
  464. }],
  465. "parameters": [{
  466. "name": "NAME",
  467. "displayName": "Name",
  468. "description": "The name assigned to all of the frontend objects defined in this template.",
  469. "required": true,
  470. "value": "huginn"
  471. }, {
  472. "name": "HUGINN_SEED_USERNAME",
  473. "displayName": "Huginn SEED_USERNAME",
  474. "description": "Account ID for the admin user.",
  475. "value": "admin",
  476. "required": true
  477. }, {
  478. "name": "HUGINN_SEED_PASSWORD",
  479. "displayName": "Huginn SEED_PASSWORD",
  480. "description": "Password for the admin user.",
  481. "value": "password",
  482. "required": true
  483. }, {
  484. "name": "HUGINN_SEED_EMAIL",
  485. "displayName": "Huginn SEED_EMAIL",
  486. "description": "Email for the admin user.",
  487. "value": "huginn@example.com",
  488. "required": true
  489. }, {
  490. "name": "HUGINN_INVITATION_CODE",
  491. "displayName": "Huginn INVITATION_CODE",
  492. "description": "If you'd like to invite more users, give them this invitation code.",
  493. "generate": "expression",
  494. "from": "[\\w]{10}"
  495. }, {
  496. "name": "HUGINN_SMTP_DOMAIN",
  497. "displayName": "Huginn SMTP_DOMAIN",
  498. "description": "Domain for outbound emails.",
  499. "value": "example.com",
  500. "required": true
  501. }, {
  502. "name": "HUGINN_SMTP_USER_NAME",
  503. "displayName": "Huginn SMTP_USER_NAME",
  504. "description": "SMTP user name.",
  505. "value": "huginn@example.com",
  506. "required": true
  507. }, {
  508. "name": "HUGINN_SMTP_PASSWORD",
  509. "displayName": "Huginn SMTP_PASSWORD",
  510. "description": "SMTP password.",
  511. "value": "somepassword",
  512. "required": true
  513. }, {
  514. "name": "HUGINN_SMTP_SERVER",
  515. "displayName": "Huginn SMTP_SERVER",
  516. "description": "SMTP server address.",
  517. "value": "smtp.example.com",
  518. "required": true
  519. }, {
  520. "name": "HUGINN_EMAIL_FROM_ADDRESS",
  521. "displayName": "Huginn EMAIL_FROM_ADDRESS",
  522. "description": "The address from which system emails will appear to be sent.",
  523. "value": "huginn@example.com",
  524. "required": true
  525. }, {
  526. "name": "HUGINN_APP_SECRET",
  527. "displayName": "Huginn APP_SECRET_TOKEN",
  528. "description": "Set this to a 64 character random string (e.g., from 'rake secret').",
  529. "generate": "expression",
  530. "from": "[\\w]{64}"
  531. }, {
  532. "name": "SOURCE_REPOSITORY_URL",
  533. "displayName": "Git Repository URL",
  534. "description": "The URL of the repository with your application source code.",
  535. "value": "https://github.com/huginn/huginn.git",
  536. "required": true
  537. }, {
  538. "name": "SOURCE_REPOSITORY_REF",
  539. "displayName": "Git Reference",
  540. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  541. }, {
  542. "name": "CONTEXT_DIR",
  543. "displayName": "Context Directory",
  544. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  545. }, {
  546. "name": "GITHUB_WEBHOOK_SECRET",
  547. "displayName": "GitHub Webhook Secret",
  548. "description": "A secret string used to configure the GitHub webhook.",
  549. "generate": "expression",
  550. "from": "[a-zA-Z0-9]{40}"
  551. }, {
  552. "displayName": "Cluster Name",
  553. "name": "CLUSTER_NAME",
  554. "description": "The name of your current OpenShift cluster (console.CLUSTER_NAME.openshift.com).",
  555. "value": "starter-us-west-2",
  556. "required": true
  557. }, {
  558. "displayName": "Router Shard",
  559. "name": "ROUTER_SHARD",
  560. "description": "The router shard used by routes in your current OpenShift cluster (http://PROJECT_NAME-APPLICATION_NAME.ROUTER_SHARD.CLUSTER_NAME.openshiftapps.com/).",
  561. "value": "7e14",
  562. "required": true
  563. }, {
  564. "name": "APPLICATION_DOMAIN",
  565. "displayName": "Application Hostname",
  566. "description": "The exposed hostname that will route to the Huginn service, if left blank a value will be defaulted.",
  567. "value": ""
  568. }, {
  569. "name": "NAMESPACE",
  570. "displayName": "Namespace",
  571. "description": "The OpenShift Namespace where the ImageStream resides.",
  572. "required": true,
  573. "value": "openshift"
  574. }, {
  575. "name": "DATABASE_SERVICE_NAME",
  576. "displayName": "Database Service Name",
  577. "value": "mysql",
  578. "required": true
  579. }, {
  580. "name": "HUGINN_RAILS_ENV",
  581. "displayName": "Huginn Application Environment",
  582. "description": "Determines the 'environment' your application is currently.",
  583. "value": "production",
  584. "required": true
  585. }, {
  586. "name": "OPCACHE_REVALIDATE_FREQ",
  587. "displayName": "OPcache Revalidation Frequency",
  588. "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.",
  589. "value": "0"
  590. }, {
  591. "name": "MEMORY_LIMIT",
  592. "displayName": "Memory Limit",
  593. "description": "Maximum amount of memory the Huginn container can use.",
  594. "value": "512Mi",
  595. "required": true
  596. }, {
  597. "name": "MEMORY_MYSQL_LIMIT",
  598. "displayName": "Memory Limit (MySQL)",
  599. "description": "Maximum amount of memory the MySQL container can use.",
  600. "value": "512Mi",
  601. "required": true
  602. }, {
  603. "name": "VOLUME_CAPACITY",
  604. "displayName": "Volume Capacity",
  605. "description": "Volume space available for data, e.g. 512Mi, 2Gi",
  606. "value": "1Gi",
  607. "required": true
  608. }, {
  609. "name": "DATABASE_ADAPTER",
  610. "displayName": "Database Engine",
  611. "description": "Database engine: mysql2 (default) or postgresql.",
  612. "value": "mysql2",
  613. "required": true
  614. }, {
  615. "name": "DATABASE_NAME",
  616. "displayName": "Database Name",
  617. "generate": "expression",
  618. "from": "[a-zA-Z0-9]{6}"
  619. }, {
  620. "name": "DATABASE_USER",
  621. "displayName": "Database User",
  622. "generate": "expression",
  623. "from": "[a-zA-Z0-9]{6}"
  624. }, {
  625. "name": "DATABASE_PASSWORD",
  626. "displayName": "Database Password",
  627. "generate": "expression",
  628. "from": "[a-zA-Z0-9]{16}"
  629. }]
  630. }