Skip to content

Commit

Permalink
feat: Added couchdb configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelweis committed Nov 26, 2024
1 parent 3e486d2 commit 8127277
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COUCHDB_USER=admin
COUCHDB_PASSWORD=password
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/
.idea/

.env
52 changes: 51 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,54 @@ services:
- ./frontend/dist:/usr/share/nginx/html:ro
- ./settings/nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- 8091:80
- 8091:80

backend:
image: couchdb
ports:
- 5984:5984
environment:
- COUCHDB_USER=${COUCHDB_USER:-admin}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
healthcheck:
test: curl -f http://localhost:5984/_up || exit 1
interval: 2s
timeout: 3s

accessible_backend:
image: curlimages/curl
entrypoint: [ "/bin/sh","-c" ]
command:
- |
alias put="curl -X PUT -u '${COUCHDB_USER}:${COUCHDB_PASSWORD}'"
put backend:5984/_node/nonode@nohost/_config/chttpd/enable_cors --data '"true"'
put backend:5984/_node/nonode@nohost/_config/cors/origins --data '"*"'
put backend:5984/blutt
put backend:5984/blutt/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
depends_on:
backend:
condition: service_healthy

updated_samples:
image: curlimages/curl
entrypoint: [ "/bin/sh","-c" ]
volumes:
- ./frontend/public:/public
command:
- |
curl -X POST http://backend:5984/blutt/_bulk_docs -H "Content-Type: application/json" -d @/public/sample_data.json
depends_on:
accessible_backend:
condition: service_completed_successfully

index:
image: curlimages/curl
entrypoint: [ "/bin/sh","-c" ]
volumes:
- ./backend/by_date.json:/by_date.json
command:
- |
curl -X POST http://backend:5984/qvotidie/_index -H "Content-Type: application/json" -d @/by_date.json -u '${COUCHDB_USER}:${COUCHDB_PASSWORD}'
depends_on:
accessible_backend:
condition: service_completed_successfully
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"carpools": [
"docs": [
{
"from": "Aulnay-sous-bois",
"to": "Monaco",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/CarpoolSearch.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from "react-router-dom";
import Header from "../components/Header.jsx";
import "../styles/CarpoolSearch.css";
import data from "../../sample_data.json";
import data from "../../public/sample_data.json";
import CarpoolEntry from "../components/CarpoolEntry.jsx";

export default function CarpoolSearch() {
Expand Down

0 comments on commit 8127277

Please sign in to comment.