fix: local docker-compose setup (#460)

This commit is contained in:
Karol Sójko
2020-09-01 16:16:40 +02:00
committed by GitHub
parent 153d05d58c
commit 6a1c10d3f7
5 changed files with 64 additions and 22 deletions

View File

@@ -1,3 +1,5 @@
# git # git
.git/ .git/
.gitignore .gitignore
node_modules
public/assets

View File

@@ -1,14 +1,14 @@
RAILS_ENV=development RAILS_ENV=development
PORT=3000 PORT=3001
WEB_CONCURRENCY=0 WEB_CONCURRENCY=0
RAILS_LOG_TO_STDOUT=true RAILS_LOG_TO_STDOUT=true
RAILS_SERVE_STATIC_FILES=true RAILS_SERVE_STATIC_FILES=true
SECRET_KEY_BASE=test SECRET_KEY_BASE=test
APP_HOST=http://localhost:3000 APP_HOST=http://localhost:3001
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html
SF_DEFAULT_SERVER=http://localhost:3001 SF_DEFAULT_SERVER=http://localhost:3000
# Datadog # Datadog
DATADOG_ENABLED=false DATADOG_ENABLED=false

View File

@@ -62,11 +62,25 @@ Questions? Find answers on our [Help page](https://standardnotes.org/help).
--- ---
### Running with Docker image ### Docker setup
You can run the application by using our [official Docker image](https://hub.docker.com/r/standardnotes/web) Docker is the quick and easy way to try out Standard Notes. We highly recommend using our official [Docker hub image](https://hub.docker.com/repository/docker/standardnotes/web).
Make sure you are using the appropriate tag for your use case. `develop` branch is tagged with `latest` and `master` branch is tagged with `stable`. ### Standalone instance
Before you start make sure you have a `.env` file copied from the sample `env.sample` and configured with your parameters.
If your intention is not contributing but just running the app we recommend using our official image from Docker hub like this:
```
docker run -d -p 3001:3001 --env-file=your-env-file standardnotes/web:stable
```
Or if you want to use the `develop` branch that is in a work-in-progress state please use:
```
docker run -d -p 3001:3001 --env-file=your-env-file standardnotes/web:latest
```
You can then access the app at `http://localhost:3001` (please check Docker container logs if the server has started already and is listening on connections).
### Running Locally ### Running Locally
@@ -83,21 +97,6 @@ This repo contains the core code used in the web app, as well as the Electron-ba
Then open your browser to `http://localhost:3001`. Then open your browser to `http://localhost:3001`.
### Running Locally with Docker
To run the app locally with Docker, first create a configuration file:
```
cp .env.sample .env
```
Adjust the configuration file if needed. Then start the application by typing:
```
docker-compose build
docker-compose up
```
--- ---
**Extensions Manager and Batch Manager:** **Extensions Manager and Batch Manager:**
@@ -124,3 +123,17 @@ SF_DEFAULT_SERVER=https://sync.myserver
- Desktop app: https://github.com/standardnotes/desktop - Desktop app: https://github.com/standardnotes/desktop
- Mobile (iOS & Android): https://github.com/standardnotes/mobile - Mobile (iOS & Android): https://github.com/standardnotes/mobile
- Extensions: https://github.com/sn-extensions - Extensions: https://github.com/sn-extensions
## Contributing
For contributing we highly recommend you use our docker-compose setup that is provided in this repository.
### Docker compose setup
Use the included [docker-compose.yml](docker-compose.yml) file to build Standard Notes with `docker-compose`. Once your `.env` file has been copied and configured, simply run:
```
docker-compose up -d
```
This should load the app container and run the necessary scripts. You should then be able to reach the app at `http://localhost:3001`

View File

@@ -1,11 +1,23 @@
version: '3' version: '3.8'
services: services:
app: app:
build: build:
context: . context: .
command: start-local
env_file: .env env_file: .env
restart: unless-stopped restart: unless-stopped
ports: ports:
- ${PORT}:3001 - ${PORT}:3001
volumes: volumes:
- .:/app - .:/app
networks:
standardnotes_proxy:
aliases:
- web
web: {}
networks:
web:
name: web
standardnotes_proxy:
name: standardnotes

View File

@@ -9,6 +9,21 @@ case "$1" in
bundle exec rails s -b 0.0.0.0 bundle exec rails s -b 0.0.0.0
;; ;;
'start-local' )
echo "Prestart Step 1/5 - Removing server lock"
rm -f /app/tmp/pids/server.pid
echo "Prestart Step 2/5 - Cleaning assets"
bundle exec rails assets:clobber
echo "Prestart Step 3/5 - Installing dependencies"
npm install
echo "Prestart Step 4/5 - Creating Webpack bundle"
npm run bundle
echo "Prestart Step 5/5 - Compiling assets"
bundle exec rails assets:precompile
echo "Starting Server..."
bundle exec rails s -b 0.0.0.0
;;
* ) * )
echo "Unknown command" echo "Unknown command"
;; ;;