ソースを参照

fix: docker detection on install

NGPixel 8 年 前
コミット
5d3edcef7b
4 ファイル変更165 行追加4 行削除
  1. 2 0
      Dockerfile
  2. 1 1
      README.md
  3. 155 0
      config.docker.yml
  4. 7 3
      npm/install.js

+ 2 - 0
Dockerfile

@@ -1,5 +1,7 @@
 FROM node:latest
 
+ENV WIKI_JS_DOCKER 1
+
 RUN mkdir -p /usr/src/app
 WORKDIR /usr/src/app
 RUN yarn add wiki.js@latest

+ 1 - 1
README.md

@@ -7,7 +7,7 @@
 [![Chat on Gitter](https://img.shields.io/badge/chat-on_gitter-CC2B5E.svg?style=flat-square&logo=image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAOCAMAAADUg/YpAAAABlBMVEUAAAD///%2Bl2Z/dAAAAAXRSTlMAQObYZgAAABVJREFUeAFjwAUYYTQByAAh0WicAAAFnwAYeB5bLwAAAABJRU5ErkJggg==)](https://gitter.im/Requarks/wiki)
 [![Twitter Follow](https://img.shields.io/badge/follow-%40requarks-blue.svg?style=flat-square)](https://twitter.com/requarks)  
 [![Build Status](https://img.shields.io/travis/Requarks/wiki/master.svg?style=flat-square)](https://travis-ci.org/Requarks/wiki)
-[![Codefresh Build Status]( https://g.codefresh.io/api/badges/build?repoOwner=Requarks&repoName=wiki&branch=master&pipelineName=wiki&accountName=NGPixel&type=cf-1)](https://g.codefresh.io/repositories/Requarks/wiki/builds?filter=trigger:build;branch:master;service:5903d09d270a090001e864b6~wiki)
+[![Codefresh Build Status]( https://g.codefresh.io/api/badges/build?repoOwner=Requarks&repoName=wiki&branch=master&pipelineName=wiki&accountName=NGPixel&type=cf-1&style=flat-square)](https://g.codefresh.io/repositories/Requarks/wiki/builds?filter=trigger:build;branch:master;service:5903d09d270a090001e864b6~wiki)
 [![Codacy Badge](https://img.shields.io/codacy/grade/1d0217a3153c4595bdedb322263e55c8/master.svg?style=flat-square)](https://www.codacy.com/app/Requarks/wiki)
 [![Dependency Status](https://img.shields.io/gemnasium/Requarks/wiki.svg?style=flat-square)](https://gemnasium.com/github.com/Requarks/wiki)
 [![Known Vulnerabilities](https://snyk.io/test/github/requarks/wiki/badge.svg?style=flat-square)](https://snyk.io/test/github/requarks/wiki)

+ 155 - 0
config.docker.yml

@@ -0,0 +1,155 @@
+#######################################################################
+# Wiki.js - CONFIGURATION                                             #
+#######################################################################
+# Full explanation + examples in the documentation:
+# https://wiki.requarks.io/install
+
+# ---------------------------------------------------------------------
+# Title of this site
+# ---------------------------------------------------------------------
+
+title: Wiki
+
+# ---------------------------------------------------------------------
+# Full public path to the site, without the trailing slash
+# ---------------------------------------------------------------------
+
+host: http://localhost
+
+# ---------------------------------------------------------------------
+# Port the main server should listen to (80 by default)
+# ---------------------------------------------------------------------
+# To use process.env.PORT, comment the line below:
+
+# port: 80
+
+# ---------------------------------------------------------------------
+# Data Directories
+# ---------------------------------------------------------------------
+
+paths:
+  repo: ./repo
+  data: ./data
+
+# ---------------------------------------------------------------------
+# Upload Limits
+# ---------------------------------------------------------------------
+# In megabytes (MB)
+
+uploads:
+  maxImageFileSize: 3
+  maxOtherFileSize: 100
+
+# ---------------------------------------------------------------------
+# Site Language
+# ---------------------------------------------------------------------
+# Possible values: en, fr
+
+lang: en
+
+# ---------------------------------------------------------------------
+# Site Authentication
+# ---------------------------------------------------------------------
+
+public: false
+
+auth:
+  defaultReadAccess: false
+  local:
+    enabled: true
+  google:
+    enabled: true
+    clientId: GOOGLE_CLIENT_ID
+    clientSecret: GOOGLE_CLIENT_SECRET
+  microsoft:
+    enabled: true
+    clientId: MS_APP_ID
+    clientSecret: MS_APP_SECRET
+  facebook:
+    enabled: false
+    clientId: FACEBOOK_APP_ID
+    clientSecret: FACEBOOK_APP_SECRET
+  github:
+    enabled: false
+    clientId: GITHUB_CLIENT_ID
+    clientSecret: GITHUB_CLIENT_SECRET
+  slack:
+    enabled: false
+    clientId: SLACK_CLIENT_ID
+    clientSecret: SLACK_CLIENT_SECRET
+  ldap:
+    enabled: false
+    url: ldap://serverhost:389
+    bindDn: cn='root'
+    bindCredentials: BIND_PASSWORD
+    searchBase: o=users,o=example.com
+    searchFilter: (uid={{username}})
+    tlsEnabled: false
+    tlsCertPath: C:\example\root_ca_cert.crt
+  azure:
+    enabled: false
+    clientID: APP_ID
+    clientSecret: APP_SECRET_KEY,
+    resource: '00000002-0000-0000-c000-000000000000',
+    tenant: 'YOUR_TENANT.onmicrosoft.com'
+
+# ---------------------------------------------------------------------
+# Secret key to use when encrypting sessions
+# ---------------------------------------------------------------------
+# Use a long and unique random string (256-bit keys are perfect!)
+
+sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz
+
+# ---------------------------------------------------------------------
+# Database Connection String
+# ---------------------------------------------------------------------
+# You can also use an ENV variable by using $ENV_VAR_NAME as the value
+
+db: mongodb://mongo:27017/wiki
+
+# ---------------------------------------------------------------------
+# Git Connection Info
+# ---------------------------------------------------------------------
+
+git:
+  url: https://github.com/Organization/Repo
+  branch: master
+  auth:
+
+    # Type: basic or ssh
+    type: ssh
+
+    # Only for Basic authentication:
+    username: marty
+    password: MartyMcFly88
+
+    # Only for SSH authentication:
+    privateKey: /etc/wiki/keys/git.pem
+
+    sslVerify: true
+
+  # Default email to use as commit author
+  serverEmail: marty@example.com
+
+  # Whether to use user email as author in commits
+  showUserEmail: true
+
+# ---------------------------------------------------------------------
+# Features
+# ---------------------------------------------------------------------
+# You can enable / disable specific features below
+
+features:
+  mathjax: true
+
+# ---------------------------------------------------------------------
+# External Logging
+# ---------------------------------------------------------------------
+
+externalLogging:
+  bugsnag: false
+  loggly: false
+  papertrail: false
+  rollbar: false
+  sentry: false
+

+ 7 - 3
npm/install.js

@@ -136,7 +136,11 @@ const tasks = {
       // Is New Install
       if (err.code === 'ENOENT') {
         ora.text = 'First-time install, creating a new config.yml...'
-        return fs.copyAsync(path.join(installDir, 'config.sample.yml'), path.join(installDir, 'config.yml')).then(() => {
+        let sourceConfigFile = 'config.sample.yml'
+        if (process.env.WIKI_JS_DOCKER) {
+          sourceConfigFile = 'config.docker.yml'
+        }
+        return fs.copyAsync(path.join(installDir, sourceConfigFile), path.join(installDir, 'config.yml')).then(() => {
           ora.succeed('Installation succeeded.')
           return true
         })
@@ -146,7 +150,7 @@ const tasks = {
     })
   },
   startConfigurationWizard () {
-    if (process.stdout.isTTY) {
+    if (process.stdout.isTTY && !process.env.WIKI_JS_DOCKER) {
       inquirer.prompt([{
         type: 'list',
         name: 'action',
@@ -205,7 +209,7 @@ const tasks = {
 // INSTALL SEQUENCE
 // =====================================================
 
-if (!process.env.IS_HEROKU) {
+if (!process.env.IS_HEROKU && !process.env.WIKI_JS_DOCKER) {
   console.info(colors.yellow(
     ' __    __ _ _    _    _     \n' +
     '/ / /\\ \\ (_) | _(_)  (_)___ \n' +