Thanks
Anu reference or file need to be removed?
Thanks
Anu reference or file need to be removed?
I needed to run development discourse (set up following Install Discourse for development using Docker ) using database from another container. To do so, I had to modify the installation steps as follows:
git clone https://github.com/discourse/discourse.gitcd discoursevim config/database.yml , on the top of the file, make it into:development:
prepared_statements: false
adapter: postgresql
#database: <%= ENV['DISCOURSE_DEV_DB'] || 'discourse_development' %>
database: discourse
username: discourse
password: yourdbpassword
host: postgres
min_messages: warning
pool: 5
timeout: 5000
checkout_timeout: <%= ENV['CHECKOUT_TIMEOUT'] || 5 %>
host_names:
### Don't include the port number here. Change the "port" site setting instead, at /admin/site_settings.
### If you change this setting you will need to
### - restart sidekiq if you change this setting
### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake`
- "localhost"
vim bin/docker/boot_dev, find the line starting with docker run, and add a network definition matching the docker network to which your postgres container is attached to: docker run --network my-docker_network-name -d -p 4305:..../bin/docker/boot_dev./bin/docker/unicorndocker exec -it discourse_dev /bin/bash -c "cd /src; ./bin/rails db:migrate RAILS_ENV=development"Is there a simpler way to do it, just with environment variables?
This failed for me. Any suggestions on how to fix it ?
I am able to access DB discourse remotely from command line so the connection to DB looks good
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 274 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
578a8ec702d0025b01a0b8396985b8bfc25c7029769c2960b58693c64609a62a
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one
I got the same error with the following lines in the log above:
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Currently I am trying to find a fix.
The only way for me to rebuild with external postgres was the command mentioned earlier:
rebuild app --docker-args --net=host --skip-mac-address
But in this case unicorn is started with default port 3000. Exposing ports is disabled as well. I cannot explain exactly, but something has changed since Sep '17, probably in launcher code.
Hey guys,
what´s the best practice to migrate from docker based postgre db to dedicated?
The setup of the dedicated is described farther up this thread, right, but how can I then move the data from docker to dedicated db ?
Probably with backup & restore, but is there a tutorial for that available ?
Thanks and greetings,
Julian
Ideally, you have discourse stopped.
Dump your database with pg_dump and restore with pg_restore.
see http://www.postgresqltutorial.com/postgresql-restore-database/
Before starting up Discourse using the new database, issue as admin:
grant all privileges on database discourse to discourse;
alter schema public owner to discourse;
create extension if not exists hstore;
create extension if not exists pg_trgm;
호스트의 IP 주소를 사용하여 --net=host 옵션을 사용하지 않는 방법도 있습니다.
172.17.0.1은 유닉스 시스템에서 Docker 네트워크를 통해 호스트 머신으로 접근하기 위한 기본 주소입니다.
--net=host를 사용하면 Docker 인수로 -p 옵션을 사용할 수 없습니다.
DISCOURSE_DB_HOST = 172.17.0.1
안녕하세요,
정말 훌륭한 가이드를 작성해 주셔서 감사합니다.
불행히도 재현하는 과정에서 오류가 발생했습니다.
처음에는 launcher를 사용하여 app/redis/postgres를 모두 설정하여 discourse를 생성했고, 정상적으로 작동했습니다.
하지만 외부 RDS를 사용할 때 launcher가 실패했습니다:
root@ip-172-31-42-129:/var/discourse# ./launcher rebuild app
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
cd /pups && git pull && git checkout v1.0.3 && /pups/bin/pups --stdin
docker: Error response from daemon: could not get container for discourse.xxxxxxxx.us-west-2.rds.amazonaws.com: No such container: discourse.xxxxxxxx.us-west-2.rds.amazonaws.com.
See 'docker run --help'.
cat: cids/app_bootstrap.cid: No such file or directory
"docker rm" requires at least 1 argument.
See 'docker rm --help'.
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove one or more containers
rm: cannot remove 'cids/app_bootstrap.cid': No such file or directory
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
이 문제를 해결하는 방법에 대해 조언해 주시겠습니까?
감사합니다,
Alexander K
마이그레이션 단계를 거치지 않고 데이터베이스를 사전 생성하고 시드 데이터를 넣는 방법이 있을까요? 현재 AKS에서 외부 Postgres를 사용 중인데, DB 설정에 제가 생각하기에 비정상적으로 긴 시간(약 8~9분)이 걸리는 것 같습니다. 이 과정을 단축할 수 있으면 좋겠습니다. 아니면 해당 구성에서 알려진 문제인가요?
해당 구성은 지원되지 않습니다.
이미지를 빌드하는 경우 데이터베이스 외에도 템플릿이 사전 컴파일되는 등 여러 가지 작업이 수행됩니다. 이것이 정상적인 빌드 소요 시간이라고 생각합니다.
네, 다른 곳에서 부트스트랩을 수행한 후 데이터를 프로덕션 PostgreSQL로 이동하면 됩니다.
그러나 이렇게 하면 업데이트가 매우 번거로워집니다.
확인해야 할 3가지 사항.
1: 기본적으로 PostgreSQL은 localhost에서 리스닝합니다. 아래에 표시된 대로 postgresql.conf 파일의 리스닝 주소를 변경하세요.
listen_addresses = ‘localhost,172.17.0.1’
2: pg_hba.conf 파일에 다음 줄을 추가하여 PostgreSQL이 도커 이미지에서 온 연결을 수락하도록 설정하세요.
host all all 172.17.0.0/16 scram-sha-256
위 두 가지 변경 사항을 적용한 후 PostgreSQL 서비스를 재시작하세요.
3: 그래도 연결할 수 없다면 포트 5432의 수신 연결을 차단하고 있을 수 있는 방화벽을 확인하세요.
@Falco 기존 DB를 사용했을 때 기존 테이블을 삭제하는 데 위험이 있나요?
또한, discourse 테이블에 접두사를 추가하는 방법이 있나요?
아니요. 단, Discourse 이름과 충돌하는 경우가 아니라면요.
하지만 저는 그것이 나쁜 아이디어라고 생각합니다.
아니요. 특별한 이유가 없다면 별도의 데이터베이스를 사용하는 것을 권장합니다.
데이터베이스를 공유함으로써 어떤 문제를 해결하고자 하나요?
감사합니다. 저는 AWS RDS를 사용 중인데, 같은 인스턴스에 여러 DB를 만들 수 있다는 걸 방금 알게 되었습니다. 그래서 새로운 DB를 만들고 새로운 사용자를 생성했습니다.
Google Cloud의 VM에서 Docker를 통해 새로 설치한 Discourse 인스턴스를 실행 중입니다. 현재 파일 업로드와 Discourse 백업을 Google Cloud 버킷으로 설정했으며, S3 호환 객체 저장소 제공업체를 업로드용으로 설정하는 스레드의 지침을 따름으로써 해당 기능이 정상적으로 작동하고 있습니다. 버킷에서 테스트 업로드 파일을 확인할 수 있으며, 업로드 URL을 살펴보면 모든 업로드가 CDN의 올바른 URL을 표시하므로 버킷에서 올바르게 가져오고 있는 것으로 보입니다.
이후 Google Cloud에서 PostgreSQL 15.2 인스턴스를 생성하고, 첫 번째 게시물에 설명된 데이터베이스 설정 절차를 수행했으며 app.yml 파일도 설정했습니다. Google Cloud의 PostgreSQL 기본 포트는 5432이므로 해당 줄을 생략했습니다.
app.yml 설정에 PostgreSQL 인스턴스의 공용 IP 주소를 사용하면 앱을 다시 빌드할 때 다음과 같은 오류가 발생합니다:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1024 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
a6a71b00bce378aa6334ae1c9fe103778d260bb699fe598f9685689e8b5ce450
무슨 일이 일어나고 있는지 확인하기 위해 PostgreSQL 인스턴스의 다른 IP 주소들을 시도해 보았습니다.
PostgreSQL 인스턴스의 비공용(프라이빗) IP 주소를 사용하면 다음과 같은 오류가 발생합니다:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1024 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
7333126c522eb51ace4d55ea89803eea54b96704baab70c322008cf2836ba47a
PostgreSQL 인스턴스의 대외 IP(outgoing IP) 주소를 사용하면 다음과 같은 오류가 발생합니다:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1026 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
c588d2b6977b9e7d493b0b59bc694369cb7c2219de67d5886112ed16312626ae
모든 다른 IP 주소를 사용해도 실패 메시지는 매우 유사하며, PostgreSQL 데이터베이스에는 데이터나 연결이 전혀 수신되지 않습니다. 제가 어디에서 실수를 하고 있는지 통찰을 주실 분이 계신가요?
또한, 제 문제가 VM 인스턴스에서 Cloud SQL Auth Proxies를 사용하지 않기 때문에 발생하는 것일까요? 그렇다면 앱 재빌드 전에 프록시를 실행하는 스크립트를 작성하고 타이밍을 맞춰야 할 것 같습니다. 이 부분에 대해서도 조언을 주실 분이 계신가요?
시간 내어 답변 주셔서 감사합니다.
IP 주소를 바꿔가며 몇 번 더 재구축을 시도해 보니, 결국 discourse 데이터베이스에 테이블이 생성된 것 같습니다. 그래서 지금은 무슨 일이 일어나고 있는지 더더욱 혼란스럽습니다.
원래 설명서가 어떤 버전의 Discourse를 기준으로 작성되었는지 알려주실 수 있나요?
과거 5년간, 어쩌면 영원히 표준 설치 환경에서 정상적으로 작동해야 합니다.
문제가 있나요?