@@ -31,23 +31,19 @@ def provision(conn, domain):
3131 conn .run (f"pyenv install { PYTHON_VERSION } " )
3232 conn .run (f"pyenv global { PYTHON_VERSION } " )
3333
34- # Tell redis to use systemd
35- conn .run ('sed -i "s/supervised no/supervised systemd/g" /etc/redis/redis.conf' )
36- conn .run ("service redis restart" )
37-
3834 # Create the `web` user with their own home director and group
39- conn .run ("useradd --create-home --user-group" )
35+ conn .run ("useradd --create-home --user-group web " )
4036
4137 # Clone the repository
42- conn .run ("git clone https://github.com/pipermerriam/ethereum-function-signature-database .git /home/web" )
38+ conn .run ("git clone https://github.com/pipermerriam/ethereum-function-signature-registry .git /home/web/ethereum-function-signature-registry " )
4339
4440 #
4541 # Setup and Install project dependencies
4642 #
4743 conn .run ("pip install virtualenv" )
4844 conn .run ("python -m virtualenv /home/web/venv" )
4945
50- conn .run ("/home/web/venv/bin/pip install -r /home/web/ethereum-function-signature-database /requirements.txt" )
46+ conn .run ("/home/web/venv/bin/pip install -r /home/web/ethereum-function-signature-registry /requirements.txt" )
5147
5248 with tempfile .TemporaryDirectory () as base_path :
5349 dotenv_file_path = pathlib .Path (base_path ) / '.env'
@@ -57,21 +53,27 @@ def provision(conn, domain):
5753 SECRET_KEY = django_secret_key ,
5854 ))
5955
60- conn .put (str (dotenv_file_path ), remote = '/home/web/ethereum-function-signature-database/.env' )
56+ conn .put (str (dotenv_file_path ), remote = '/home/web/ethereum-function-signature-registry/.env' )
57+
58+
59+ Setup Postgres User and Database
6160
62- #
63- # Setup Postgres User and Database
64- #
6561 with tempfile .TemporaryDirectory () as base_path :
6662 # systemd service for worker
6763 pgpass_file_path = pathlib .Path (base_path ) / '.pgpass'
68- pgpass_file_path .write_text (f"*.*.*.4byte. { postgress_password } " )
64+ pgpass_file_path .write_text (f"*.*.*.bytes4. { postgres_password } " )
6965
7066 conn .put (str (pgpass_file_path ), remote = '/root/.pgpass' )
7167 conn .run ("chmod 600 /root/.pgpass" )
7268
73- conn .run (f"sudo -u postgres psql -c 'CREATE ROLE joe PASSWORD \" { postgres_password } \" CREATEDB LOGIN;'" )
74- conn .run ("sudo -u postgres createdb --username 4byte --no-password 4byte" )
69+ conn .run (f"sudo -u postgres psql -c \" CREATE ROLE bytes4 PASSWORD '{ postgres_password } ' SUPERUSER LOGIN;\" " )
70+ conn .run ("sudo -u postgres createdb --no-password bytes4" )
71+
72+ #
73+ # Setup Redis
74+ #
75+ conn .run ('sed -i "s/supervised no/supervised systemd/g" /etc/redis/redis.conf' )
76+ conn .run ("service redis restart" )
7577
7678 #
7779 # Setup config files for uwsgi/nginx/4byte-worker
@@ -81,7 +83,7 @@ def provision(conn, domain):
8183 worker_service_file_path = pathlib .Path (base_path ) / '4byte.service'
8284 worker_service_file_path .write_text (SYSTEMD_WORKER_SERVICE )
8385
84- conn .put (str (worker_service_file_path ), remote = '/ect /systemd/system/4byte.service' )
86+ conn .put (str (worker_service_file_path ), remote = '/etc /systemd/system/4byte.service' )
8587
8688 # nginx configuration file
8789 nginx_4byte_conf = pathlib .Path (base_path ) / '4byte'
@@ -118,12 +120,21 @@ def _append_bashrc(conn, content: str) -> None:
118120 "gpg" ,
119121 "software-properties-common" ,
120122 "pkg-config" ,
123+ "zlib1g" ,
124+ "zlib1g-dev" ,
125+ "libbz2-dev" ,
126+ "libreadline-dev" ,
127+ "libssl-dev" ,
128+ "libsqlite3-dev" ,
129+ "libffi-dev" ,
121130 # application
122131 "nginx" ,
123132 "uwsgi" ,
133+ "uwsgi-plugin-python3" ,
124134 "redis-server" ,
125135 "postgresql" ,
126136 "postgresql-contrib" ,
137+ "postgresql-server-dev-11" ,
127138 # convenience
128139 "htop" ,
129140 "tmux" ,
@@ -215,10 +226,8 @@ def _append_bashrc(conn, content: str) -> None:
215226DJANGO_ALLOWED_HOSTS={DOMAIN}
216227DJANGO_DEBUG=False
217228DJANGO_DEBUG_TOOLBAR_ENABLED=False
218- DJANGO_DEFAULT_FILE_STORAGE=s3_folder_storage.s3.DefaultStorage
219229DJANGO_SECRET_KEY={SECRET_KEY}
220230DJANGO_SECURE_SSL_REDIRECT=False
221- DJANGO_STATICFILES_STORAGE=s3_folder_storage.s3.StaticStorage
222231HUEY_WORKER_TYPE=thread
223232REDIS_URL=redis://127.0.0.1:6379
224233"""
0 commit comments