Skip to content

Commit f18ad8a

Browse files
imp: added docker-compose file
1 parent 9195926 commit f18ad8a

File tree

9 files changed

+313
-3
lines changed

9 files changed

+313
-3
lines changed

Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:14 as vsf-pre
2+
3+
WORKDIR /app
4+
5+
COPY . /
6+
7+
RUN apt-get install -y --no-install-recommends git \
8+
&& yarn install \
9+
--prefer-offline \
10+
--frozen-lockfile \
11+
--non-interactive \
12+
--production=false
13+
14+
RUN yarn build
15+
16+
RUN rm -rf node_modules && \
17+
NODE_ENV=development yarn install \
18+
--prefer-offline \
19+
--pure-lockfile \
20+
--non-interactive \
21+
--production=false
22+
23+
FROM node:14 as vsf2
24+
25+
WORKDIR /app
26+
27+
COPY --from=vsf-pre /app .
28+
29+
ENV HOST 0.0.0.0
30+
31+
32+
CMD [ "yarn", "start" ]

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ REDIS_PASSWORD=<redis_password>
2323

2424
or use environment variables
2525

26-
``` bash
26+
```bash
2727
export BASE_URL=<base_url>
2828
export REDIS_HOST=<redis_host>
2929
export REDIS_PORT=<redis_port>
@@ -42,6 +42,16 @@ yarn dev
4242
yarn build
4343
```
4444

45+
or use docker-compose
46+
47+
```bash
48+
docker-compose up --build -d
49+
# you might need to
50+
docker-compose restart odoo nginx
51+
```
52+
53+
54+
4555
Want to contribute? Ping us on `odoo` channel on [our Discord](https://discord.vuestorefront.io) or email us at info (at) odoogap.com!
4656

4757
## Resources

docker-compose.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
version: "3.7"
2+
3+
4+
services:
5+
6+
redis:
7+
container_name: redis
8+
image: library/redis:5.0-alpine
9+
restart: unless-stopped
10+
networks:
11+
- net1
12+
volumes:
13+
- redis_data:/data
14+
15+
nginx:
16+
env_file: .env
17+
image: nginx:latest
18+
container_name: nginx
19+
restart: unless-stopped
20+
depends_on:
21+
- odoo
22+
ports:
23+
- ${TEST_VSF_DOCKER_PORT}:${TEST_VSF_DOCKER_PORT}
24+
- ${TEST_ODOO_DOCKER_PORT}:${TEST_ODOO_DOCKER_PORT}
25+
volumes:
26+
- ./docker/nginx/templates:/etc/nginx/templates
27+
- web_root:/var/www/html
28+
networks:
29+
- net1
30+
31+
db:
32+
env_file: .env
33+
image: postgres:12
34+
container_name: db
35+
restart: unless-stopped
36+
networks:
37+
- net1
38+
volumes:
39+
- db_home:/var/lib/postgresql/data
40+
environment:
41+
- POSTGRES_USER=odoo
42+
- POSTGRES_PASSWORD=odoo
43+
- POSTGRES_DB=v14_odoo
44+
45+
odoo_init:
46+
env_file: .env
47+
build:
48+
context: ./docker/14.0
49+
dockerfile: Dockerfile
50+
container_name: odoo_ini
51+
working_dir: "/mnt/extra-addons"
52+
command: >
53+
bash -c "if [ ! -d "/mnt/extra-addons/graphql_vuestorefront" ]; then git clone --branch 14.0 https://github.com/odoogap/vuestorefront.git .
54+
&& git submodule update --init --recursive
55+
&& /entrypoint.sh odoo -d v14_odoo -i base --max-cron-threads 0 --no-http --stop-after-init -i graphql_vuestorefront
56+
&& /entrypoint.sh odoo shell -d v14_odoo --max-cron-threads 0 --no-http < /start_script.py ; fi"
57+
image: odoogap
58+
restart: "no"
59+
volumes:
60+
- odoo_home:/var/lib/odoo
61+
- odoo_extra:/mnt/extra-addons
62+
- ./docker/14.0/odoo.conf:/etc/odoo/odoo.conf
63+
- ./docker/14.0/start_script.py:/start_script.py
64+
depends_on:
65+
- db
66+
networks:
67+
- net1
68+
69+
odoo:
70+
env_file: .env
71+
build:
72+
context: ./docker/14.0
73+
dockerfile: Dockerfile
74+
container_name: odoo
75+
image: odoogap
76+
restart: unless-stopped
77+
volumes:
78+
- odoo_home:/var/lib/odoo
79+
- odoo_extra:/mnt/extra-addons
80+
- ./docker/14.0/odoo.conf:/etc/odoo/odoo.conf
81+
depends_on:
82+
- db
83+
networks:
84+
- net1
85+
86+
vsf:
87+
env_file: .env
88+
environment:
89+
BASE_URL: http://localhost:8069/
90+
BACKEND_BASE_URL: http://odoo:8069/
91+
REDIS_HOST: redis
92+
REDIS_PORT: 6379
93+
container_name: vsf
94+
image: vsf2
95+
restart: unless-stopped
96+
depends_on:
97+
- redis
98+
- odoo
99+
networks:
100+
- net1
101+
102+
103+
volumes:
104+
db_home:
105+
external: false
106+
odoo_home:
107+
external: false
108+
odoo_extra:
109+
external: False
110+
web_root:
111+
external: false
112+
redis_data:
113+
external: false
114+
115+
networks:
116+
net1:
117+
name: net1

docker/14.0/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM odoo:14.0 AS odoogap
2+
3+
USER root
4+
5+
COPY ./requirements.txt /
6+
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends git \
9+
&& python3 -m pip install --no-cache-dir -r requirements.txt \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
USER odoo
14+
15+
CMD ["odoo"]

docker/14.0/odoo.conf

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[options]
2+
addons_path = /mnt/extra-addons
3+
data_dir = /var/lib/odoo
4+
; admin_passwd = admin
5+
; csv_internal_sep = ,
6+
; db_maxconn = 64
7+
db_name = v14_odoo
8+
db_user = odoo
9+
db_password = odoo
10+
db_host = db
11+
; db_template = template1
12+
dbfilter = ^v14_odoo$
13+
; debug_mode = False
14+
; email_from = False
15+
; limit_memory_hard = 2684354560
16+
; limit_memory_soft = 2147483648
17+
; limit_request = 8192
18+
; limit_time_cpu = 60
19+
; limit_time_real = 120
20+
; list_db = True
21+
; log_db = False
22+
; log_handler = [':INFO']
23+
; log_level = info
24+
; logfile = None
25+
; longpolling_port = 8072
26+
; max_cron_threads = 2
27+
; osv_memory_age_limit = 1.0
28+
; osv_memory_count_limit = False
29+
; smtp_password = False
30+
; smtp_port = 25
31+
; smtp_server = localhost
32+
; smtp_ssl = False
33+
; smtp_user = False
34+
workers = 3
35+
; xmlrpc = True
36+
; xmlrpc_interface =
37+
; xmlrpc_port = 8069
38+
; xmlrpcs = True
39+
; xmlrpcs_interface =
40+
; xmlrpcs_port = 8071

docker/14.0/requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
redis==4.0.2
2+
graphene==3.0
3+
graphql-server==3.0.0b4

docker/14.0/start_script.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/python
2+
env['ir.config_parameter'].set_param('web.base.url', 'http://localhost:8069')
3+
env['ir.config_parameter'].set_param('web.base.url.freeze', 'True')
4+
env.cr.commit()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
upstream up-vsf {
2+
least_conn;
3+
server vsf:3000;
4+
}
5+
upstream up-odoo {
6+
least_conn;
7+
server odoo:8069;
8+
}
9+
upstream up-long {
10+
least_conn;
11+
server odoo:8072;
12+
}
13+
14+
# Vuestorefront2 Server
15+
server {
16+
listen ${TEST_VSF_DOCKER_PORT};
17+
18+
proxy_read_timeout 720s;
19+
proxy_connect_timeout 720s;
20+
proxy_send_timeout 720s;
21+
22+
proxy_buffers 16 64k;
23+
proxy_buffer_size 128k;
24+
client_max_body_size 10M;
25+
26+
# Redirect requests to vsf1 backend server
27+
location / {
28+
proxy_set_header X-Forwarded-Port ${TEST_VSF_DOCKER_PORT};
29+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
30+
proxy_set_header X-Forwarded-Proto $scheme;
31+
proxy_set_header X-Real-IP $remote_addr;
32+
proxy_set_header X-Forwarded-Host $server_name:${TEST_VSF_DOCKER_PORT};
33+
proxy_set_header X-Nginx-Proxy true;
34+
proxy_http_version 1.1;
35+
proxy_set_header Upgrade $http_upgrade;
36+
proxy_set_header Connection "upgrade";
37+
38+
proxy_pass http://up-vsf;
39+
proxy_redirect off;
40+
proxy_read_timeout 240s;
41+
}
42+
43+
# Common gzip
44+
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
45+
gzip on;
46+
47+
}
48+
49+
# Odoo Server
50+
server {
51+
listen ${TEST_ODOO_DOCKER_PORT};
52+
53+
proxy_read_timeout 720s;
54+
proxy_connect_timeout 720s;
55+
proxy_send_timeout 720s;
56+
57+
proxy_buffers 16 64k;
58+
proxy_buffer_size 128k;
59+
client_max_body_size 10M;
60+
61+
proxy_http_version 1.1;
62+
proxy_set_header X-Forwarded-Host $server_name:${TEST_ODOO_DOCKER_PORT};
63+
proxy_set_header X-Forwarded-Port ${TEST_ODOO_DOCKER_PORT};
64+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
65+
proxy_set_header X-Forwarded-Proto $scheme;
66+
proxy_set_header X-Real-IP $remote_addr;
67+
68+
location ~* ^/([^/]+/static/|web/(css|js)/|web/image|web/content|website/image/) {
69+
proxy_cache_valid 200 60m;
70+
proxy_buffering on;
71+
expires 30d;
72+
proxy_pass http://up-odoo;
73+
}
74+
75+
location /longpolling {
76+
proxy_pass http://up-long;
77+
}
78+
79+
# Redirect requests to odoo backend server
80+
location / {
81+
proxy_redirect off;
82+
proxy_pass http://up-odoo;
83+
}
84+
85+
# Common gzip
86+
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
87+
gzip on;
88+
89+
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
"cookie-universal-nuxt": "^2.1.3",
3333
"core-js": "^2.6.5",
3434
"nuxt": "2.15.6",
35+
"@nuxt/image": "^0.6.1",
36+
"@nuxt/types": "latest",
3537
"nuxt-i18n": "^6.5.0",
3638
"nuxt-precompress": "^0.5.9",
3739
"redis-tag-cache": "^1.2.1",
@@ -40,8 +42,6 @@
4042
"@nuxtjs/tailwindcss": "^4.1.3"
4143
},
4244
"devDependencies": {
43-
"@nuxt/image": "^0.6.1",
44-
"@nuxt/types": "latest",
4545
"@nuxt/typescript-build": "latest",
4646
"@vue/test-utils": "^1.0.0-beta.27",
4747
"autoprefixer": "^10.2.6",

0 commit comments

Comments
 (0)