forked from yongjhih/docker-parse-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support ssl parse-server and add yongjhih/parse-server:git
Fix yongjhih#30
- Loading branch information
Showing
10 changed files
with
127 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ node_modules | |
|
||
# Vim | ||
*.swp | ||
*.swo | ||
|
||
*.pem | ||
account_key.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,11 +55,16 @@ $ docker run -d \ | |
-e APP_ID=${PARSE_APP_ID} \ | ||
-e MASTER_KEY=${PARSE_MASTER_KEY} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--link mongo \ | ||
--name parse-server \ | ||
yongjhih/parse-server | ||
|
||
$ docker run -d \ | ||
-p 2022:22 \ | ||
--link parse-server \ | ||
--name parse-cloud-code-git \ | ||
yongjhih/parse-server:git | ||
|
||
# Test parse-server | ||
$ curl -X POST \ | ||
-H "X-Parse-Application-Id: {appId}" \ | ||
|
@@ -74,14 +79,14 @@ $ docker run -d \ | |
--link parse-server \ | ||
--name parse-dashboard \ | ||
yongjhih/parse-dashboard | ||
#The above command will asuume you will later create a ssh | ||
#and log into the dashboard remotely in production. | ||
# However, to see the dashboard instanly using either | ||
# localhost:4040 or someip:4040(if hosted somewhere remotely) | ||
#then you need to add extra option to allowInsecureHTTP like | ||
#It is also required that you create username and password | ||
#before accessing the portal else you cant get in | ||
|
||
# The above command will asuume you will later create a ssh | ||
# and log into the dashboard remotely in production. | ||
# However, to see the dashboard instanly using either | ||
# localhost:4040 or someip:4040(if hosted somewhere remotely) | ||
# then you need to add extra option to allowInsecureHTTP like | ||
# It is also required that you create username and password | ||
# before accessing the portal else you cant get in | ||
|
||
$ docker run -d \ | ||
-e APP_ID=$(PARSE_APP_ID)\ | ||
|
@@ -111,13 +116,13 @@ Deploy parse-cloud-code via git: | |
[](https://youtu.be/9YwWbiRyPUU) | ||
|
||
```sh | ||
#This command wil create a SSH keys for you as | ||
# ~/.ssh/id_rsa.pub and another private key. | ||
#you can leave the options balnk by pressing enter. | ||
# This command wil create a SSH keys for you as | ||
# ~/.ssh/id_rsa.pub and another private key. | ||
# you can leave the options balnk by pressing enter. | ||
|
||
$ssh-keygen -t rsa | ||
$ ssh-keygen -t rsa | ||
|
||
$ docker exec -i parse-server ssh-add-key < ~/.ssh/id_rsa.pub | ||
$ docker exec -i parse-cloud-code-git ssh-add-key < ~/.ssh/id_rsa.pub | ||
|
||
$ git clone ssh://git@localhost:2022/parse-cloud-code | ||
$ cd parse-cloud-code | ||
|
@@ -144,7 +149,6 @@ $ docker run -d \ | |
-e APP_ID=${PARSE_APP_ID} \ | ||
-e MASTER_KEY=${PARSE_MASTER_KEY} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--name parse-server \ | ||
yongjhih/parse-server | ||
``` | ||
|
@@ -167,7 +171,6 @@ $ docker run -d \ | |
-e APP_ID={appId} \ | ||
-e MASTER_KEY={masterKey} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--link mongo \ | ||
--name parse-server \ | ||
yongjhih/parse-server | ||
|
@@ -186,7 +189,6 @@ $ docker run -d \ | |
-e APP_ID=${PARSE_APP_ID} \ | ||
-e MASTER_KEY=${PARSE_MASTER_KEY} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--link mongo \ | ||
--name parse-server \ | ||
yongjhih/parse-server | ||
|
@@ -201,7 +203,6 @@ $ docker run -d \ | |
-e APP_ID=${PARSE_APP_ID} \ | ||
-e MASTER_KEY=${PARSE_MASTER_KEY} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--link mongo \ | ||
--name parse-server \ | ||
yongjhih/parse-server:2.2.7 | ||
|
@@ -217,7 +218,6 @@ $ docker run -d \ | |
-e APP_ID=${PARSE_APP_ID} \ | ||
-e MASTER_KEY=${PARSE_MASTER_KEY} \ | ||
-p 1337:1337 \ | ||
-p 2022:22 \ | ||
--link mongo \ | ||
--name parse-server \ | ||
yongjhih/parse-server:dev | ||
|
@@ -233,17 +233,20 @@ And, up other containers without parse-dashboard: | |
$ APP_ID=myAppId MASTER_KEY=myMasterKey docker-compose up -d -f docker-compose-without-dashboard.yml | ||
``` | ||
|
||
### Usage of letsencrypt for parse-dashboard with https certificated domain | ||
### Usage of https certificated domain with letsencrypt | ||
|
||
```sh | ||
$ git clone https://github.com/yongjhih/docker-parse-server | ||
$ cd docker-parse-server | ||
|
||
$ USER1=yongjhih \ | ||
USER1_PASSWORD=yongjhih \ | ||
[email protected] \ | ||
LETSENCRYPT_HOST=yongjhih.example.com \ | ||
VIRTUAL_HOST=yongjhih.example.com \ | ||
PARSE_DASHBOARD_VIRTUAL_HOST=parse.example.com \ | ||
PARSE_DASHBOARD_LETSENCRYPT_HOST=parse.example.com \ | ||
[email protected] \ | ||
PARSE_SERVER_VIRTUAL_HOST=api.example.com \ | ||
PARSE_SERVER_LETSENCRYPT_HOST=api.example.com \ | ||
[email protected] \ | ||
APP_ID=myAppId MASTER_KEY=myMasterKey docker-compose -f docker-compose-le.yml up | ||
``` | ||
|
||
|
@@ -265,7 +268,7 @@ sed -i -- '/- "80:80"/d' docker-compose-le.yml | |
Without docker-compose: | ||
|
||
* Re/create parse-cloud-code volume container: `docker create -v /parse/code --name parse-cloud-code {username}/parse-cloud-code /bin/true` | ||
* Re/create parse-server container with volume: `docker run -d --volumes-from parse-cloud-code APP_ID={appId} -e MASTER_KEY={masterKey} -p 1337:1337 -p 2022:22 --link mongo yongjhih/parse-server` | ||
* Re/create parse-server container with volume: `docker run -d --volumes-from parse-cloud-code APP_ID={appId} -e MASTER_KEY={masterKey} -p 1337:1337 --link mongo yongjhih/parse-server` | ||
|
||
With docker-compose.yml: | ||
|
||
|
@@ -361,7 +364,7 @@ parse-cloud-code: | |
## Add ssh-key for git | ||
|
||
```sh | ||
$ docker exec -i parse-server ssh-add-key < ~/.ssh/id_rsa.pub | ||
$ docker exec -i parse-cloud-cloud-git ssh-add-key < ~/.ssh/id_rsa.pub | ||
``` | ||
|
||
Import keys from github: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM debian:jessie | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git openssh-server && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
sed -i "s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config | ||
|
||
# Missing privilege separation directory: /var/run/sshd | ||
|
||
ENV PORT 22 | ||
EXPOSE $PORT | ||
|
||
ENV WORKTREE "/parse/cloud" | ||
ENV REPO_PATH "/parse-cloud-code" | ||
|
||
ADD ssh-add-key /sbin/ | ||
|
||
RUN useradd -s /bin/bash git | ||
RUN echo "git ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
ADD docker-entrypoint.sh / | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
CMD ["/usr/sbin/sshd", "-D"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ ! -d ${REPO_PATH} ]; then | ||
mkdir -p ${REPO_PATH} | ||
|
||
git init --bare ${REPO_PATH} > /dev/null | ||
|
||
cat << EOF > ${REPO_PATH}/hooks/post-receive | ||
#!/bin/bash | ||
unset GIT_INDEX_FILE | ||
git --work-tree="${WORKTREE}" clean -df | ||
git --work-tree="${WORKTREE}" checkout -f | ||
EOF | ||
|
||
chmod a+x ${REPO_PATH}/hooks/post-receive > /dev/null | ||
|
||
chown -R git:git ${REPO_PATH} > /dev/null | ||
chown -R git:git "$WORKTREE" > /dev/null | ||
fi | ||
|
||
exec "$@" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters