Skip to content

Commit efbb011

Browse files
authored
Feature/docker settings (#37)
* updating docker settings to play better with IDEs * removing NODE_PORT env var and using location.origin as the default apiHost * adding restoration instructions to the backups file * updating docs on proxies * updating package.js * adding a release doc and updating the index * fixing the sample env file
1 parent b704c5d commit efbb011

13 files changed

+99
-66
lines changed

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ services:
1515
- "8000:8000"
1616
web:
1717
build: openeats-web/
18-
command: yarn start
18+
command: yarn dev
1919
env_file:
2020
env_dev.list
2121
volumes:
2222
- ./openeats-web:/code
23-
- node_modules:/code/node_modules
2423
depends_on:
2524
- api
2625
ports:
@@ -31,8 +30,9 @@ services:
3130
env_dev.list
3231
volumes:
3332
- database:/var/lib/mysql
33+
ports:
34+
- "3306:3306"
3435
volumes:
3536
database:
36-
node_modules:
3737
static-files:
3838
site-media:

docker-stage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ services:
1616
build: openeats-web/
1717
command: yarn start
1818
volumes:
19-
- node_modules:/code/node_modules
2019
- public-ui:/code/build
2120
depends_on:
2221
- api
@@ -46,7 +45,6 @@ services:
4645
env_stg.list
4746
volumes:
4847
database:
49-
node_modules:
5048
public-ui:
5149
static-files:
5250
site-media:

docs/Creating_a_Release.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Creating a Release
2+
3+
1. Get an Auth token from github. See Github for details on how to do this.
4+
2. Create a secrets folder and add a filer with the below strcuture:
5+
```python
6+
#!/usr/bin/env python
7+
# encoding: utf-8
8+
9+
username = 'username'
10+
password = 'token'
11+
```
12+
3. Create a release doc and place in the releases folder. See the release folder for examples.
13+
4. Once you have a release file created, you can run the release script. This script takes the release file you just created as it's only arg.
14+
- `./release x.x.x.json`
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Serving with a proxy server and HTTPS
2-
By default the docker application doesn't come with an https server. It is also likely that you want to server other applications.
2+
By default the docker application doesn't come with an https server. It is also likely that you want to server other applications.
33

4-
If you want to server the docker application via https or serve multiple applications via nginx/apache then you will also need a proxy server.
4+
If you want to server the docker application via https or serve multiple applications via nginx/apache then you will also need a proxy server.
55

6-
To change the port from which OpenEats is served you will need to update the left side of the port configuration.
7-
- Open the docker-prod.override.yml (your docker-compose configuration) file.
8-
- To serve the app via port 7000:
6+
To change the port from which OpenEats is served you will need to update the left side of the port configuration in the `docker-prod.override.yml` file.
7+
- Open the docker-prod.override.yml (your docker-compose configuration) file.
8+
- To serve the app via port 7000:
99
``` yml
1010
version: '2.3'
1111
services:
@@ -14,11 +14,16 @@ services:
1414
- "7000:80"
1515
```
1616
17-
- Restart you docker containers `docker-compose -f docker-prod.yml restart`
17+
- Restart you docker containers
18+
19+
- `
20+
docker-compose -f docker-prod.yml -f docker-prod.override.yml -f docker-prod.version.yml restart`
21+
- OR
22+
- Just run the `quick-start` script again: `./quick-start`
1823
- Load localhost:7000 to confirm it worked.
1924

20-
For free ssl crits see:
21-
https://letsencrypt.org/getting-started/
25+
26+
It is highly recommended that you server your content over https. [Let's Encrypt](https://letsencrypt.org/getting-started/) provides a super easy, automated, and free process for serving your content over https. If you are using nginx, they will also automatically update your plain http vhost files.
2227

2328
For more info on how to use proxies, see:
2429
https://www.nginx.com/resources/admin-guide/reverse-proxy/

docs/Setting_up_env_file.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,11 @@ The API will use this to prevent CORS issues.
9999

100100
EX: `NODE_URL=localhost:8080`
101101

102-
#### NODE_PORT
103-
The port node is served from.
104-
105-
EX: `NODE_PORT=8080`
106-
107102
#### NODE_API_URL
108-
The URL and port the frontend will call the API from.
109-
For production this should be your domain.
103+
The hostname/port (my.example.com:8080) the frontend will call the API from.
104+
If unset, the UI will call the API from the same hostname/port. If you are not using the default Nginx server that OpenEats comes with, you will either need to set this or configure your own proxy server to redirect all traffic that starts with `/api` or `/admin`.
110105

111-
EX: `NODE_API_URL=http://localhost`
106+
EX: `NODE_API_URL=http://localhost:8080`, `NODE_API_URL=https://api.example.com`
112107

113108
#### NODE_LOCALE
114109
The language the UI will be in.

docs/Taking_Backups.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/Taking_and_Restoring_Backups.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Backing up Your Data
2+
3+
The following commands can be used to take backups of your data and restore those backups. The backup commands are automatically run when you upgrade to a newer version as well.
4+
5+
6+
### Recipes Images
7+
8+
#### Backing up:
9+
10+
Replace `/dir/on/local/system/` with the location where you would like your images.
11+
```sh
12+
docker cp openeats_api_1:/code/site-media/ /dir/on/local/system/
13+
```
14+
15+
#### Restoring:
16+
17+
Replace `/dir/on/local/system/` with the location where you would like your images.
18+
```sh
19+
docker cp /dir/on/local/system/site-media/. openeats_api_1:/code/site-media/
20+
```
21+
22+
### Database
23+
24+
#### Backing up:
25+
26+
Places a sql dump of the database on your current working directory.
27+
```sh
28+
docker exec openeats_db_1 sh -c 'exec mysqldump openeats -uroot -p"$MYSQL_ROOT_PASSWORD"' > openeats.sql
29+
```
30+
31+
#### Restoring:
32+
33+
First cd into the dir that contains your sql backup. Once there you need to source your env file so you don't have to type your database password on the command line. Then run the last command to start the restore.
34+
Note: if you changed the database name then you will need to change the last word the statement below to the database name you gave OpenEats.
35+
```sh
36+
cd /open/eats/root/
37+
source env_prod.list
38+
cat openeats.sql | docker exec -i openeats_db_1 /usr/bin/mysql -u root -p"$MYSQL_ROOT_PASSWORD" openeats
39+
40+
```
41+
42+
43+
### Sources
44+
- [Copying Image Files to and from Docker Containers/Volumes](https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb)
45+
- [DB backups/restores](https://stackoverflow.com/questions/22907231/copying-files-from-host-to-docker-container)

docs/index.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
# OpenEats Project
22

3+
API Status:
4+
[![API Build Status](https://travis-ci.org/open-eats/openeats-api.svg?branch=master)](https://travis-ci.org/open-eats/openeats-api)
5+
[![Coverage Status](https://coveralls.io/repos/github/open-eats/openeats-api/badge.svg)](https://coveralls.io/github/open-eats/openeats-api)
6+
7+
Web Status:
8+
[![Web Build Status](https://travis-ci.org/open-eats/openeats-web.svg?branch=master)](https://travis-ci.org/open-eats/openeats-web)
9+
[![Coverage Status](https://coveralls.io/repos/github/open-eats/openeats-web/badge.svg)](https://coveralls.io/github/open-eats/openeats-web)
10+
311
OpenEats is a recipe management site that allows users to create, share, and store their personal collection of recipes. This fork uses Django Rest Framework as a backend and React (with flux) as a front end.
412

513
The usage for the app is intended for a single user or a small group. For my personal use, I would be an admin user and a few (about 5-6) friends and family would be normal users. Admin users can add other users to the project (no open sign-ups), make changes to the available Cuisines and Courses, and add to the homepage banner. Normal users just have the ability to add recipes. Below are a few of the core features the app provides.
614

7-
- Creating, viewing, and editing recipes.
15+
- Creating, viewing, sharing, and editing recipes.
16+
- Update Serving information on the fly.
817
- Browsing and searching for recipes.
9-
- Creating grocery lists
18+
- Creating grocery lists.
19+
- Automatically add recipes to your grocery lists.
1020
- Quickly print recipe.
11-
- Linking recipes and ingredient grouping
21+
- Linking recipes and ingredient grouping.
22+
23+
### [Read the docs on getting started here!](https://github.com/open-eats/OpenEats/blob/master/docs/Running_the_App.md)
24+
25+
### [The Update guide can be found here!](https://github.com/open-eats/OpenEats/blob/master/docs/Updating_the_App.md)
1226

1327
# Contributing
1428
Please read the [contribution guidelines](https://github.com/open-eats/OpenEats/blob/master/CONTRIBUTING.md) in order to make the contribution process easy and effective for everyone involved.
29+
30+
For a guide on how to setup an environment for development see [this guide](https://github.com/open-eats/OpenEats/blob/master/docs/Running_the_App_in_dev.md).

docs/samples/sample_docker_prod_override.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ version: '2.3'
22
services:
33
nginx:
44
ports:
5-
- "80:80"
5+
- "8000:80"

docs/samples/sample_env_file.list

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ HTTP_X_FORWARDED_PROTO=true
1414
# Node config
1515
NODE_ENV=production
1616
NODE_URL=localhost:8080
17-
NODE_PORT=8080
1817
NODE_API_URL=http://my.domain.com
1918
NODE_LOCALE=en

0 commit comments

Comments
 (0)