izayoi-akira removed a comment on issue #167:
URL: https://github.com/apache/apisix-docker/issues/167#issuecomment-829786446
> @izayoi-akira please add some details about your snapshot operations.
Indeed this is a right way
local server etcd_conf:
```
etcd:
volumes:
- ./etcd_data:/etcd_data
```
which be configured by /example/docker-compose.yml
then I run :
`docker exec -it docker-apisix_etcd_1 /bin/bash`
`etcdctl --endpoints localhost:2379 snapshot save /etcd_data/snapshot.db`
it works and I download the snapshot.db file from Host Machine.
later I use etcdctl snapshot restore like this:
`etcdctl snapshot restore snapshot.db --data-dir=/etcd_data`
it error with: Error: data-dir "/etcd_data" exists
then change the data-dir:
`etcdctl snapshot restore snapshot.db --data-dir=/etcd_data_new`
error with: Error: mkdir /etcd_data_new: permission denied
> > > > @izayoi-akira please add some details about your snapshot
operations. Indeed this is a right way
> > >
> > >
> > > @tokers how about we introduce the `Terraform` which is for
declarative configurations management. Thus we can export all the existing
resources into several `.tf` files that represent the declarative resources.
Also, we can import it via uploading files onto Dashboard or just run
`terraform apply`. This will give us full-fledged functionality for user data
import/export.
> > > Looking forward to your feedback.
> >
> >
> > Frankly, I'm not sure, as Terraform just likes a tool used on Cloud. Is
it also can be used in bare-metal or containers deployed on-premise?
>
> @tokers
> yep, the most commonly used scenarios of Terraform are for cloud
provisioning. While as a matter of fact, Terraform is a great tool that can
handle all the cases as long as Declarative Configuration is needed. For
example, we can also find the Github/Gitlab providers for the
repository/branch/privilege/user management here
[[1](https://registry.terraform.io/browse/providers)].
>
> With regards to APISIX, a minimum feasible Terraform `.tf` configurations
may seems like this:
>
> ```terraform
> provider "apisix" {
> # Assume we use Admin API here
> url = "https://your-apisix-server-addr:9080/"
> access_user = "admin"
> access_key = "the-access-key-for-admin-api"
> }
>
> resource "apisix_route" "route_1" {
> name = "r1"
> desc = "for buzi1"
> uri = "/foo/bar"
> host = "foo.com"
> methods = ["GET", "HOST"]
> status = 1
> labels = {
> "k1": "v1",
> "k2": "v2"
> }
> upstream_id = ${apisix_upstream.upstream_1.id}
> }
>
> resource "apisix_upstream" "upstream_1" {
> name = "u1"
> type = "chash"
> key = "remote_addr"
> nodes = {
> "127.0.0.1:80": 1,
> "foo.com:80": 2
> }
> }
> ```
>
> This would bring us the reproducible APISIX resource definitions. For
backup/restore, we need to support export these definitions as the format of
Terraform templates stored in `.tf` files.
>
> Please let me know what do you think. Maybe we all need much more
discussion. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]